|  | 
 
| 原来做的好使,暑假回来make 就不行了呢?是内核的问题吗? 
 源码如下 :/********************
 2 hello.c qudong
 3 duopin:2012.4.22
 4 ********************/
 5
 6
 7 #include <linux/init.h>
 8 #include <linux/module.h>
 9 MODULE_LICENSE("GPL");
 10
 11 static int hello_init(void)
 12 {
 13 //use printk ,not printf  --k is kernel
 14    printk(KERN_ALERT "Hello, world!!\nthis is my hello world!!\n");
 15    return 0;
 16 }
 17
 18 static void hello_exit(void)
 19 {
 20    printk(KERN_ALERT "Goodbye, curel world--pin\n");
 21    return 0;
 }
 
 makefile:
 KERNELDIR=/opt/EmbedSky/linux-2.6.30.4
 2 PWD:=$(shell pwd)
 3 INSTALLDIR=$(PWD)
 4 CC=arm-linux-gcc
 5 obj-m := hello.o
 6 modules:
 7         $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
 8
 9 clean:
 10         rm -rf *.o *.ko *.mod.c *.markers *.order *.symvers
 11 .PHONY:modules clean
 在别机器好make通过的。
 
 
 [root@tdp hello]# ls
 hello.c  Makefile
 [root@tdp hello]# make
 make -C /opt/EmbedSky/linux-2.6.30.4      M=/opt/EmbedSky/modulesmy430/hello      modules
 make[1]: Entering directory `/opt/EmbedSky/linux-2.6.30.4'
 ERROR: Kernel configuration is invalid.
 include/linux/autoconf.h or include/config/auto.conf are missing.
 Run 'make oldconfig && make prepare' on kernel src to fix it.
 
 WARNING: Symbol version dump /opt/EmbedSky/linux-2.6.30.4/Module.symvers
 is missing; modules will have no dependencies and modversions.
 CC [M]  /opt/EmbedSky/modulesmy430/hello/hello.o
 cc1: error: include/linux/autoconf.h: No such file or directory
 In file included from include/linux/prefetch.h:14,
 from include/linux/list.h:6,
 from include/linux/module.h:9,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/processor.h:109:5: warning: "__LINUX_ARM_ARCH__" is not defined
 In file included from include/linux/list.h:7,
 from include/linux/module.h:9,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:111:5: warning: "__LINUX_ARM_ARCH__" is not defined
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:117:5: warning: "__LINUX_ARM_ARCH__" is not defined
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:121:35: warning: "__LINUX_ARM_ARCH__" is not defined
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:247:5: warning: "__LINUX_ARM_ARCH__" is not defined
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:254:5: warning: "__LINUX_ARM_ARCH__" is not defined
 In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:320,
 from include/linux/list.h:7,
 from include/linux/module.h:9,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/asm-generic/cmpxchg-local.h: In function '__cmpxchg_local_generic':
 include/asm-generic/cmpxchg-local.h:23: error: implicit declaration of function 'local_irq_save'
 include/asm-generic/cmpxchg-local.h:44: error: implicit declaration of function 'local_irq_restore'
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:322:5: warning: "__LINUX_ARM_ARCH__" is not defined
 In file included from include/linux/bitops.h:17,
 from include/linux/kernel.h:15,
 from include/linux/cache.h:4,
 from include/linux/time.h:7,
 from include/linux/stat.h:60,
 from include/linux/module.h:10,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/bitops.h:237:5: warning: "__LINUX_ARM_ARCH__" is not defined
 In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/thread_info.h:16,
 from include/linux/thread_info.h:55,
 from include/linux/preempt.h:9,
 from include/linux/spinlock.h:50,
 from include/linux/seqlock.h:29,
 from include/linux/time.h:8,
 from include/linux/stat.h:60,
 from include/linux/module.h:10,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/fpstate.h:32:5: warning: "__LINUX_ARM_ARCH__" is not defined
 In file included from include/linux/spinlock.h:359,
 from include/linux/seqlock.h:29,
 from include/linux/time.h:8,
 from include/linux/stat.h:60,
 from include/linux/module.h:10,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/atomic.h:24:5: warning: "__LINUX_ARM_ARCH__" is not defined
 In file included from include/linux/time.h:9,
 from include/linux/stat.h:60,
 from include/linux/module.h:10,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/math64.h: In function 'div_u64_rem':
 include/linux/math64.h:43: error: '__LINUX_ARM_ARCH__' undeclared (first use in this function)
 include/linux/math64.h:43: error: (Each undeclared identifier is reported only once
 include/linux/math64.h:43: error: for each function it appears in.)
 In file included from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
 In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/page.h:197,
 from include/linux/mmzone.h:20,
 from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:18:25: error: mach/memory.h: No such file or directory
 In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/page.h:197,
 from include/linux/mmzone.h:20,
 from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'virt_to_phys':
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:167: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'phys_to_virt':
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:172: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'virt_to_bus':
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:196: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'bus_to_virt':
 /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:201: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
 In file included from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/mmzone.h:256:5: warning: "MAX_NR_ZONES" is not defined
 In file included from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/mmzone.h: At top level:
 include/linux/mmzone.h:290: error: 'MAX_NR_ZONES' undeclared here (not in a function)
 In file included from include/linux/notifier.h:14,
 from include/linux/memory_hotplug.h:6,
 from include/linux/mmzone.h:644,
 from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
 In file included from include/linux/memory_hotplug.h:6,
 from include/linux/mmzone.h:644,
 from include/linux/gfp.h:4,
 from include/linux/kmod.h:22,
 from include/linux/module.h:13,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/notifier.h:62: error: field 'rwsem' has incomplete type
 In file included from include/linux/tracepoint.h:18,
 from include/linux/module.h:19,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/rcupdate.h:64:2: error: #error "Unknown RCU implementation specified to kernel configuration"
 In file included from include/linux/module.h:19,
 from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
 include/linux/tracepoint.h: In function 'tracepoint_synchronize_unregister':
 include/linux/tracepoint.h:153: error: implicit declaration of function '__synchronize_sched'
 /opt/EmbedSky/modulesmy430/hello/hello.c: In function 'hello_exit':
 /opt/EmbedSky/modulesmy430/hello/hello.c:21: warning: 'return' with a value, in function returning void
 make[2]: *** [/opt/EmbedSky/modulesmy430/hello/hello.o] 错误 1
 make[1]: *** [_module_/opt/EmbedSky/modulesmy430/hello] 错误 2
 make[1]: Leaving directory `/opt/EmbedSky/linux-2.6.30.4'
 make: *** [modules] 错误 2
 
 
 | 
 |