tica, SimSun, sans-serif">我把TQ2440开发板的linux源代码放到了虚拟机上面,用的是redhat 4 企业版,并且把EABI编译器安装上了,编译内核的时候没有问题,能生成zImage,可我编写驱动程序的时候,linux/下的文件都能找到,比如 #include <linux/fs.h>,但是mach下的却找不到,#include <mach/regs-gpio.h> 就会出现 No directory。。。。,但是涉及硬件必须要用啊,郁闷,我想知道,编译器是怎么寻找头文件的,这种情况到底是怎么回事,一概不知啊,恳请哪路大神帮小弟一把!
Makefile的内容
ifneq ($(KERNELRELEASE),)
obj-m :=EmbedSky_gpio.o
ARCH =ARM
CROSS_COMPILE =arm-linux-
else
KERNELDIR =/opt/EmbedSky/linux-2.6.30.4/
#KERNELDIR=/lib/modules/$(shell uname -r)/build
#KERNELDIR=/usr/src/kernels/2.6.21-1.3194.fc7-i686
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c
endif
结果:
[root@vm-dev led]# make
make -C /opt/EmbedSky/linux-2.6.30.4/ M=/lifuxing/led modules
make[1]: Entering directory `/opt/EmbedSky/linux-2.6.30.4'
CC [M] /lifuxing/led/EmbedSky_gpio.o
/led/EmbedSky_gpio.c:11:28: error: mach/regs-gpio.h: No such file or directory
/led/EmbedSky_gpio.c:42: error: 'S3C2410_GPB5' undeclared here (not in a function)
/led/EmbedSky_gpio.c:43: error: 'S3C2410_GPB6' undeclared here (not in a function)
/led/EmbedSky_gpio.c:44: error: 'S3C2410_GPB7' undeclared here (not in a function)
/led/EmbedSky_gpio.c:45: error: 'S3C2410_GPB8' undeclared here (not in a function)
/led/EmbedSky_gpio.c:51: error: 'S3C2410_GPB5_OUTP' undeclared here (not in a function)
/led/EmbedSky_gpio.c:51: error: initializer element is not constant
/led/EmbedSky_gpio.c:51: error: (near initialization for 'gpio_cfg_table[0]')
/led/EmbedSky_gpio.c:52: error: 'S3C2410_GPB6_OUTP' undeclared here (not in a function)
/led/EmbedSky_gpio.c:52: error: initializer element is not constant
/led/EmbedSky_gpio.c:52: error: (near initialization for 'gpio_cfg_table[1]')
/led/EmbedSky_gpio.c:53: error: 'S3C2410_GPB7_OUTP' undeclared here (not in a function)
/led/EmbedSky_gpio.c:53: error: initializer element is not constant
/led/EmbedSky_gpio.c:53: error: (near initialization for 'gpio_cfg_table[2]')
/led/EmbedSky_gpio.c:54: error: 'S3C2410_GPB8_OUTP' undeclared here (not in a function)
/led/EmbedSky_gpio.c:54: error: initializer element is not constant
/led/EmbedSky_gpio.c:54: error: (near initialization for 'gpio_cfg_table[3]')
/led/EmbedSky_gpio.c: In function 'tq2440_gpio_ioctl':
/led/EmbedSky_gpio.c:72: error: implicit declaration of function 's3c2410_gpio_setpin'
/led/EmbedSky_gpio.c: In function 'dev_init':
/led/EmbedSky_gpio.c:104: error: implicit declaration of function 's3c2410_gpio_cfgpin'
make[2]: *** [/led/EmbedSky_gpio.o] 错误 1
make[1]: *** [_module_/led] 错误 2
make[1]: Leaving directory `/opt/EmbedSky/linux-2.6.30.4'
make: *** [default] 错误 2
[root@vm-dev led]#
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
评分
查看全部评分
一周热门 更多>