写了一个类似于"hello world"的模块:mydrive.c
makefile的内容:
obj-m := mydrive.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
rm -f *.ko *.o *.mod.c
下面是我make时出现的东东,不知道为什么没有生成 mydrive.o文件,可能是makefile写错了,我的内核是2.4.20-8
哪位能帮帮忙
[root@eeko firstdrv]# ls
makefile mydrive.c
[root@eeko firstdrv]# make
make -C /lib/modules/2.4.20-8/build M=/home/eeko/mydoc/firstdrv modules
make[1]: Entering directory `/usr/src/linux-2.4.20-8'
make -r -f tmp_include_depends all
make[2]: Entering directory `/usr/src/linux-2.4.20-8'
make[2]: Circular /usr/src/linux-2.4.20-8/include/asm/smplock.h <- /usr/src/linux-2.4.20-8/include/linux/interrupt.h dependency dropped.
make[2]: Circular /usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/ip_conntrack.h <- /usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/ip_conntrack_helper.h dependency dropped.
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8'
make -C kernel CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/kernel'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/kernel'
make -C drivers CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/drivers'
make -C addon modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/addon'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/addon'
make -C block modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/block'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/block'
make -C cdrom modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/cdrom'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/cdrom'
make -C char modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/char'
make -C drm modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/char/drm'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/char/drm'
make -C pcmcia modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/char/pcmcia'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/char/pcmcia'
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/char'
make -C hotplug modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/hotplug'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/hotplug'
make -C ide modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/ide'
make -C arm modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/ide/arm'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/ide/arm'
make -C legacy modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/ide/legacy'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/ide/legacy'
make -C pci modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/ide/pci'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/ide/pci'
make -C ppc modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/ide/ppc'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/ide/ppc'
make -C raid modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/ide/raid'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/ide/raid'
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/ide'
make -C media modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/media'
make -C radio modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/media/radio'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/media/radio'
make -C video modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/media/video'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/media/video'
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/media'
make -C misc modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/misc'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/misc'
make -C net modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/net'
make -C pcmcia modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/net/pcmcia'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/net/pcmcia'
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/net'
make -C parport modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/parport'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/parport'
make -C pnp modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/pnp'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/pnp'
make -C scsi modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/scsi'
make -C aic7xxx modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/scsi/aic7xxx'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/scsi/aic7xxx'
make -C pcmcia modules
make[4]: Entering directory `/usr/src/linux-2.4.20-8/drivers/scsi/pcmcia'
make[4]: Nothing to be done for `modules'.
make[4]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/scsi/pcmcia'
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/scsi'
make -C sound modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/sound'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/sound'
make -C usb modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/usb'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/usb'
make -C video modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/drivers/video'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/drivers/video'
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/drivers'
make -C mm CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/mm'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/mm'
make -C fs CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/fs'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/fs'
make -C net CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/net'
make -C core modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/net/core'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/net/core'
make -C ipv4 modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/net/ipv4'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/net/ipv4'
make -C netlink modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/net/netlink'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/net/netlink'
make -C sched modules
make[3]: Entering directory `/usr/src/linux-2.4.20-8/net/sched'
make[3]: Nothing to be done for `modules'.
make[3]: Leaving directory `/usr/src/linux-2.4.20-8/net/sched'
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/net'
make -C ipc CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/ipc'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/ipc'
make -C lib CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/lib'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/lib'
make -C crypto CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/crypto'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/crypto'
make -C arch/i386/kernel CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/arch/i386/kernel'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/arch/i386/kernel'
make -C arch/i386/mm CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/arch/i386/mm'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/arch/i386/mm'
make -C arch/i386/lib CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20-8/include/linux/modversions.h" MAKING_MODULES=1 modules
make[2]: Entering directory `/usr/src/linux-2.4.20-8/arch/i386/lib'
make[2]: Nothing to be done for `modules'.
make[2]: Leaving directory `/usr/src/linux-2.4.20-8/arch/i386/lib'
make[1]: Leaving directory `/usr/src/linux-2.4.20-8'