韦东山Linux嵌入式课程社区
直播中

李凤璐

7年用户 203经验值
私信 关注

为什么我写的Makefile总是出错?

KERN_DIR = /work/sys/linux-2.6.22.6
all :
        make -C $(KERN_DIR) M='pwd' modules
clean:
        make -C $(KERN_DIR) M='pwd' modules clean
        rm -rf modules.order

obj-m   +=first_diver.o

以上是我写的Makefile
但是我make之后:

book@book-desktop:/work/project/first_drv$ ls
first_diver.c  Makefile
book@book-desktop:/work/project/first_drv$ make
make -C /work/sys/linux-2.6.22.6 M='pwd' modules
make[1]: Entering directory `/work/sys/linux-2.6.22.6'
scripts/Makefile.build:17: /work/sys/linux-2.6.22.6/pwd/Makefile: No such file or directory
make[2]: *** No rule to make target `/work/sys/linux-2.6.22.6/pwd/Makefile'.  Stop.
make[1]: *** [_module_pwd] Error 2
make[1]: Leaving directory `/work/sys/linux-2.6.22.6'
make: *** [all] Error 2
book@book-desktop:/work/project/first_drv$

我检查了C文件的文件名,和makefile内是对的上的,而且我已经配置、编译了内核,也已经生成了uImage,但还是出错,请各位大神帮帮忙


以上是make和make uImage之后的提示信息,都是成功的

WARNING: arch/ARM/mach-s3c2443/built-in.o(.text+0x1020): Section mismatch: reference to .init.data: (after 's3c2443_dma_add')
WARNING: arch/arm/plat-s3c24xx/built-in.o(.text+0x2a8c): Section mismatch: reference to .init.text:s3c24xx_dma_init (between 's3c2410_dma_init' and 's3c2410_dma_request')
WARNING: arch/arm/plat-s3c24xx/built-in.o(.data+0x23cc): Section mismatch: reference to .init.text: (between 's3c24xx_timer' and 's3c2410_timer_irq')
WARNING: sound/built-in.o(.text+0x18c3c): Section mismatch: reference to .init.text: (between 's3c2410iis_probe' and 's3c2410iis_remove')
WARNING: sound/built-in.o(.text+0x18c64): Section mismatch: reference to .init.text: (between 's3c2410iis_probe' and 's3c2410iis_remove')
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
  Building modules, stage 2.
  MODPOST 22 modules



3c2443_irq_init')
WARNING: arch/arm/mach-s3c2443/built-in.o(.text+0x1020): Section mismatch: reference to .init.data: (after 's3c2443_dma_add')
WARNING: arch/arm/plat-s3c24xx/built-in.o(.text+0x2a8c): Section mismatch: reference to .init.text:s3c24xx_dma_init (between 's3c2410_dma_init' and 's3c2410_dma_request')
WARNING: arch/arm/plat-s3c24xx/built-in.o(.data+0x23cc): Section mismatch: reference to .init.text: (between 's3c24xx_timer' and 's3c2410_timer_irq')
WARNING: sound/built-in.o(.text+0x18c3c): Section mismatch: reference to .init.text: (between 's3c2410iis_probe' and 's3c2410iis_remove')
WARNING: sound/built-in.o(.text+0x18c64): Section mismatch: reference to .init.text: (between 's3c2410iis_probe' and 's3c2410iis_remove')
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
  Image arch/arm/boot/uImage is ready

回帖(2)

张桂芝

2019-9-3 10:06:44
M=`pwd`  不是M='pwd'   你写错了。 注意不是单引号 而是1左边那个
举报

徐丽丽

2019-9-3 10:23:27
建议后面学习 如果遇到问题, 先用老师的代码实验一下,实验成功 说明环境没问题 那肯定是代码问题。然后用对比软件一对比,就找到问题了。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分