Re: compile a network device driver( a kernel module)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi, I think that $ in -I$/usr/src/linux-2.4/include is not needed.

On Mon, 14 Oct 2002, Yuan Huailin-w19410 wrote:

> Hi,all
>
>      I wrote a network device driver as a kernel module, but when i compile it, there are something wrong. Who can help me ? It's very urgent!
>
> The Makefile:
> ======================================================
> INCL = -I$/usr/src/linux-2.4/include
> MODFLAGS = -D__KERNEL__ -DLINUX -DMODULE -O2 -Wall
> CC = gcc
>
> gprsv.o:gprsv.c
> 	$(CC) $(MODFLAGS) $(INCL) -c gprsv.c -o gprsv.o
>
>
> clean:
> 	rm -f gprsv.o
>
> The include section of mymod.c:
> =================================================================================
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/skbuff.h>
> #include <linux/config.h>
> #include <linux/tty.h>
> #include <linux/kmod.h>
> #include <linux/init.h>
> #include <linux/list.h>
> #include <linux/devfs_fs_kernel.h>
> #include <linux/netdevice.h>
> #include <linux/poll.h>
> #include <linux/filter.h>
> #include <linux/rtnetlink.h>
> #include <linux/if_arp.h>
> #include <linux/ip.h>
> #include <linux/tcp.h>
> #include <linux/spinlock.h>
> #include <linux/smp_lock.h>
> #include <asm/atomic.h>
> #include <asm/uaccess.h>
>
>
> The gcc output messages :
> ======================================================
> [harrin@localhost mymod]$ make
> gcc -D__KERNEL__ -DLINUX -DMODULE -O2 -Wall -Iusr/src/linux-2.4/include -c mymod.c -o mymod.o
> mymod.c:46: parse error before `sk_buff_head'
> mymod.c:46: warning: no semicolon at end of struct or union
> mymod.c:49: parse error before `*'
> mymod.c:49: warning: type defaults to `int' in declaration of `rq'
> mymod.c:49: warning: data definition has no type or storage class
> mymod.c:59: parse error before `}'
> mymod.c: In function `mymod_start_xmit':
> mymod.c:70: `mymod_struct' undeclared (first use in this function)
> mymod.c:70: (Each undeclared identifier is reported only once
> mymod.c:70: for each function it appears in.)
> mymod.c:70: parse error before `)'
> mymod.c:76: dereferencing pointer to incomplete type
> mymod.c:79: warning: implicit declaration of function `mymod_push'
> mymod.c:68: warning: `mymod' might be used uninitialized in this function
> mymod.c: In function `mymod_net_stats':
> mymod.c:92: dereferencing pointer to incomplete type
> mymod.c:95: warning: control reaches end of non-void function
> mymod.c: In function `mymod_net_ioctl':
> mymod.c:101: storage size of `stats' isn't known
> mymod.c:102: storage size of `idle' isn't known
> mymod.c:117: `SIOCGMYMODSTATS' undeclared (first use in this function)
> mymod.c:118: dereferencing pointer to incomplete type
> mymod.c:119: dereferencing pointer to incomplete type
> mymod.c:124: `SIOCGMYMODIDLETIME' undeclared (first use in this function)
> mymod.c:129: dereferencing pointer to incomplete type
> mymod.c:130: dereferencing pointer to incomplete type
> mymod.c:120: warning: unreachable code at beginning of switch statement
> mymod.c:102: warning: unused variable `idle'
> mymod.c:101: warning: unused variable `stats'
> mymod.c: At top level:
> mymod.c:164: warning: `mymod_push' was declared implicitly `extern' and later `st
> atic'
> mymod.c:79: warning: previous declaration of `mymod_push'
> mymod.c: In function `mymod_push':
> mymod.c:166: `tty_struct' undeclared (first use in this function)
> mymod.c:166: `tty' undeclared (first use in this function)
> mymod.c:166: dereferencing pointer to incomplete type
> mymod.c:167: `sk_buff' undeclared (first use in this function)
> mymod.c:167: `skb' undeclared (first use in this function)
> mymod.c:167: warning: statement with no effect
> mymod.c:169: dereferencing pointer to incomplete type
> mymod.c:171: dereferencing pointer to incomplete type
> mymod.c:172: dereferencing pointer to incomplete type
> mymod.c:174: dereferencing pointer to incomplete type
> mymod.c:175: dereferencing pointer to incomplete type
> mymod.c:178: dereferencing pointer to incomplete type
> mymod.c:180: dereferencing pointer to incomplete type
> mymod.c:185: dereferencing pointer to incomplete type
> mymod.c:191: dereferencing pointer to incomplete type
> mymod.c:194: dereferencing pointer to incomplete type
> mymod.c:195: dereferencing pointer to incomplete type
> mymod.c:165: warning: `avail' might be used uninitialized in this function
> mymod.c: In function `mymod_ldisc_open':
> mymod.c:233: sizeof applied to an incomplete type
> mymod.c:240: sizeof applied to an incomplete type
> mymod.c:240: sizeof applied to an incomplete type
> mymod.c:240: sizeof applied to an incomplete type
> mymod.c:240: sizeof applied to an incomplete type
> mymod.c:240: sizeof applied to an incomplete type
> mymod.c:240: sizeof applied to an incomplete type
> mymod.c:261: dereferencing pointer to incomplete type
> mymod.c:262: dereferencing pointer to incomplete type
> mymod.c:272: parse error before `}'
> mymod.c:299: warning: control reaches end of non-void function
> mymod.c: In function `mymod_ldisc_receive':
> mymod.c:362: dereferencing pointer to incomplete type
> mymod.c:367: dereferencing pointer to incomplete type
> mymod.c:378: dereferencing pointer to incomplete type
> mymod.c:380: dereferencing pointer to incomplete type
> mymod.c:381: dereferencing pointer to incomplete type
> mymod.c:383: dereferencing pointer to incomplete type
> mymod.c:384: dereferencing pointer to incomplete type
> mymod.c:385: dereferencing pointer to incomplete type
> mymod.c:387: dereferencing pointer to incomplete type
> mymod.c:407: dereferencing pointer to incomplete type
> mymod.c:409: dereferencing pointer to incomplete type
> mymod.c:412: dereferencing pointer to incomplete type
> mymod.c:413: dereferencing pointer to incomplete type
> mymod.c:422: dereferencing pointer to incomplete type
> mymod.c:425: parse error before `}'
> mymod.c:433: dereferencing pointer to incomplete type
> mymod.c:437: dereferencing pointer to incomplete type
> mymod.c:450: dereferencing pointer to incomplete type
> mymod.c:452: dereferencing pointer to incomplete type
> mymod.c:455: dereferencing pointer to incomplete type
> mymod.c:456: dereferencing pointer to incomplete type
> mymod.c:464: dereferencing pointer to incomplete type
> mymod.c:351: warning: unused variable `left'
> mymod.c:376: label `errret' used but not defined
> mymod.c: At top level:
> mymod.c:468: parse error before `if'
> mymod.c:476: warning: type defaults to `int' in declaration of `netif_rx'
> mymod.c:476: warning: parameter names (without types) in function declaration
> mymod.c:476: warning: data definition has no type or storage class
> mymod.c:478: parse error before `->'
> mymod.c:480: warning: type defaults to `int' in declaration of `skb_unlink'
> mymod.c:480: warning: parameter names (without types) in function declaration
> mymod.c:480: conflicting types for `skb_unlink'
> /usr/include/linux/skbuff.h:695: previous declaration of `skb_unlink'
> mymod.c:480: warning: data definition has no type or storage class
> mymod.c:481: warning: type defaults to `int' in declaration of `kfree_skb'
> mymod.c:481: warning: parameter names (without types) in function declaration
> mymod.c:481: conflicting types for `kfree_skb'
> /usr/include/linux/skbuff.h:288: previous declaration of `kfree_skb'
> mymod.c:481: warning: data definition has no type or storage class
> mymod.c:485: parse error before `if'
> mymod.c:489: parse error before `->'
> mymod.c:489: warning: type defaults to `int' in declaration of `skb_queue_head'
> mymod.c:489: conflicting types for `skb_queue_head'
> /usr/include/linux/skbuff.h:494: previous declaration of `skb_queue_head'
> mymod.c:489: warning: data definition has no type or storage class
> mymod.c:502: parse error before string constant
> mymod.c:502: warning: type defaults to `int' in declaration of `printk'
> mymod.c:502: warning: data definition has no type or storage class
> mymod.c:525: `mymod_ldisc_close' undeclared here (not in a function)
> mymod.c:525: initializer element is not constant
> mymod.c:525: (near initialization for `mymod_ldisc.close')
> mymod.c:534: initializer element is not constant
> mymod.c:534: (near initialization for `mymod_ldisc')
> mymod.c: In function `mymod_init':
> mymod.c:548: `N_MYMOD' undeclared (first use in this function)
> mymod.c: In function `mymod_cleanup':
> mymod.c:559: `N_MYMOD' undeclared (first use in this function)
> mymod.c: At top level:
> mymod.c:569: parse error before string constant
> mymod.c:569: warning: type defaults to `int' in declaration of `MODULE_LICENSE'
> mymod.c:569: warning: data definition has no type or storage class
> make: *** [mymod.o] Error 1
>
> -
> : send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux