2.3.2 Die Lösung ist das Including von "Rules.make"Die Lösung fand ich im Makefile von minix Darin steht der wichtige für den Kernel 2.4 noch typische Befehl: include $(TOPDIR)/Rules.make Damit erweiterte ich das Makefile zu dieser Form (also auch ein clean-Befehl wurde eingebaut): ifneq ($(KERNELRELEASE),) obj-m := hello-4.o include $(TOPDIR)/Rules.make else KDIR := /home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324/ PWD := $(shell pwd) CLEAN_FILES = \ hello-4.o hello-4.ko hello-4.mod.o hello-4.mod.c default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: rm -f $(CLEAN_FILES) endif Damit ergab sich: andreas@gericom:~/Development/driver> make clean rm -f hello-4.o hello-4.ko hello-4.mod.o hello-4.mod.c andreas@gericom:~/Development/driver> make make -C /home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324/ SUBDIRS=/home/andreas/Development/driver modules make[1]: Entering directory `/home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324' . linux-2.4.x/.config; if [ "$CONFIG_MODULES" = "y" ]; then \ [ -d linux-2.4.x/modules ] || mkdir linux-2.4.x/modules; \ make ARCH=m68knommu CROSS_COMPILE=m68k-elf- -C linux-2.4.x modules; \ fi make[2]: Entering directory `/home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324/linux-2.4.x' make -C /home/andreas/Development/driver CFLAGS="-fno-builtin -nostdinc -D__KERNEL__ -I/home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324/linux-2.4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -O1 -g -fno-strict-aliasing -fno-common -I/usr/local/lib/gcc-lib/m68k-elf/2.95.3/./include -pipe -DNO_MM -DNO_FPU -m5307 -Wa,-S -Wa,-m5307 -D__ELF__ -DMAGIC_ROM_PTR -DUTS_SYSNAME=\"uClinux\" -D__linux__ -O1 -DMODULE" MAKING_MODULES=1 modules make[3]: Entering directory `/home/andreas/Development/driver' m68k-elf-gcc -fno-builtin -nostdinc -D__KERNEL__ -I/home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324/linux-2.4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -O1 -g -fno-strict-aliasing -fno-common -I/usr/local/lib/gcc-lib/m68k-elf/2.95.3/./include -pipe -DNO_MM -DNO_FPU -m5307 -Wa,-S -Wa,-m5307 -D__ELF__ -DMAGIC_ROM_PTR -DUTS_SYSNAME="uClinux" -D__linux__ -O1 -DMODULE -nostdinc -iwithprefix include -DKBUILD_BASENAME=hello_4 -c -o hello-4.o hello-4.c make[3]: Leaving directory `/home/andreas/Development/driver' make[2]: Leaving directory `/home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324/linux-2.4.x' make[1]: Leaving directory `/home/andreas/Development/COBRA_rot/uClinux/uClinux-dist-20040218-cobra-20040324' andreas@gericom:~/Development/driver> ls hello-3.c hello-3.o Makefile qadc-1_0.c V_1_4 hello-3.c~ hello-4.c Makefile~ qadc-1_0.c~ hello-3.ko hello-4.c~ myreadme-driver.txt V_1_0 hello-3.mod.c hello-4.o myreadme-driver.txt~ V_1_2 hello-3.mod.o Linux-Modul-Programming.kateproject myreadme.txt~ V_1_3 andreas@gericom:~/Development/driver> pwd /home/andreas/Development/driver andreas@gericom:~/Development/driver> Copyright © Andreas Birkert Letzte Aktualisierung am 20. Dezember 2013 |