内核2.6.30.4,ARM 2440.
在Makefiel中修改了ARCH=arm和CROSS_COMPILE=arm-linux-,
然后修改平台输入时钟,
再然后就是make menuconfig,做了一些简单的配置。
保存配置后make zImage了一下,没有错误。
然后在/drivers/char下写了个简单的打印hello-linux驱动程序。
修改Kconfig,在make menuconfig中选进来。
再然后就是make SUBDIR=dirvers/char modules,
所有步骤都是完全按照手册上来的。
然后就出现了下面的报错
root@eddy-desktop:/home/eddy/SharedFoler/linux-2.6.30.4# make SUBDIR=devices/char modules
CHK include/linux/version.h
make[1]: “include/asm-arm/mach-types.h”是最新的。
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
CC [M] drivers/char/EmbedSky_hello.o
drivers/char/EmbedSky_hello.c:13:31: error: asm/arch/regs-gpio.h: No such file or directory
drivers/char/EmbedSky_hello.c:14:25: error: asm/hardware.h: No such file or directory
drivers/char/EmbedSky_hello.c:16: error: expected declaration specifiers or '...' before string constant
drivers/char/EmbedSky_hello.c:16: warning: data definition has no type or storage class
drivers/char/EmbedSky_hello.c:16: warning: type defaults to 'int' in declaration of 'MODULE_LIXENSE'
drivers/char/EmbedSky_hello.c:16: warning: function declaration isn't a prototype
make[2]: *** [drivers/char/EmbedSky_hello.o] 错误? 1
make[1]: *** [drivers/char] 错误? 2
make: *** [drivers] 错误? 2
root@eddy-desktop:/home/eddy/SharedFoler/linux-2.6.30.4#
看编译报错很容易找到,是因为编译过程中找不到头文件造成的。
在编写这个简单的驱动时,例程里有
#include
#include
#include
我在include里找到了asm是对asm-arm的链接,但问题是:
asm-arm里只有asm-offsets.h和mach-types.h并没有irq.h和hardware.h更没有arch/regs/regs-gpio.h,这是为什么呢?
eddy_liu 于 2010-11-16 19:59:28发表:
我用find命令找了下,结果果然是找到了相关的文件
eddy@eddy-desktop:~/SharedFoler/linux-2.6.30.4$ find -name hardware.h
./drivers/char/pcmcia/ipwireless/hardware.h
./drivers/isdn/sc/hardware.h
./arch/arm/mach-versatile/include/mach/hardware.h
./arch/arm/mach-mv78xx0/include/mach/hardware.h
./arch/arm/mach-ep93xx/include/mach/hardware.h
./arch/arm/mach-mmp/include/mach/hardware.h
./arch/arm/mach-h720x/include/mach/hardware.h
./arch/arm/mach-w90x900/include/mach/hardware.h
./arch/arm/mach-aaec2000/include/mach/hardware.h
./arch/arm/mach-s3c2410/include/mach/hardware.h
./arch/arm/mach-loki/include/mach/hardware.h
./arch/arm/mach-ebsa110/include/mach/hardware.h
./arch/arm/mach-davinci/include/mach/hardware.h
./arch/arm/mach-ixp4xx/include/mach/hardware.h
./arch/arm/mach-kirkwood/include/mach/hardware.h
./arch/arm/mach-gemini/include/mach/hardware.h
./arch/arm/mach-orion5x/include/mach/hardware.h
./arch/arm/mach-ns9xxx/include/mach/hardware.h
./arch/arm/mach-pxa/include/mach/hardware.h
./arch/arm/mach-ixp2000/include/mach/hardware.h
./arch/arm/mach-realview/include/mach/hardware.h
./arch/arm/plat-omap/include/mach/hardware.h
./arch/arm/mach-msm/include/mach/hardware.h
./arch/arm/mach-iop32x/include/mach/hardware.h
./arch/arm/mach-pnx4008/include/mach/hardware.h
./arch/arm/mach-integrator/include/mach/hardware.h
./arch/arm/plat-mxc/include/mach/hardware.h
./arch/arm/mach-rpc/include/mach/hardware.h
./arch/arm/mach-ks8695/include/mach/hardware.h
./arch/arm/mach-s3c6400/include/mach/hardware.h
./arch/arm/mach-clps711x/include/mach/hardware.h
./arch/arm/mach-shark/include/mach/hardware.h
./arch/arm/mach-at91/include/mach/hardware.h
./arch/arm/mach-iop33x/include/mach/hardware.h
./arch/arm/mach-iop13xx/include/mach/hardware.h
./arch/arm/mach-lh7a40x/include/mach/hardware.h
./arch/arm/mach-netx/include/mach/hardware.h
./arch/arm/mach-sa1100/include/mach/hardware.h
./arch/arm/mach-l7200/include/mach/hardware.h
./arch/arm/mach-footbridge/include/mach/hardware.h
./arch/arm/mach-ixp23xx/include/mach/hardware.h
./arch/arm/mach-imx/include/mach/hardware.h
./arch/xtensa/platforms/xt2000/include/platform/hardware.h
./arch/xtensa/platforms/s6105/include/platform/hardware.h
./arch/xtensa/platforms/iss/include/platform/hardware.h
./arch/xtensa/variants/s6000/include/variant/hardware.h
./arch/parisc/include/asm/hardware.h
eddy@eddy-desktop:~/SharedFoler/linux-2.6.30.4$
hardware.h是找到了,但问题是,如果我想用这个头文件,那么我就要修改Makefile吗?因为这个头文件显然是没在include/asm下,而makefile的寻找路径则是include/asm
我在想,既然在写驱动前,已通过make menuconfig 进行了处理器级选型,板级选型,以及相关外设的配置。那么系统就应该把相关的硬件信息集中起来呀,而不是重新跑到分散的文件夹里去找。
当然这也只是个人看法罢了,高手给说说
shenhao0129 于 2010-11-16 18:03:30发表:
这种情况一般是由于不同的内核的版本,头文件的路径有时候有一些变动,具体头文件变动到那去了,建议把找不到的头文件搜索一下,看存在的路径是代码中写的路径