内核驱动的小错误

1、 Directory nonexistent

/bin/sh: cannot create /mnt/new/driver/��级驱动最后6个实验/2410_button_scan/.button_scan.o.tmp: Directory nonexistent

TMD,居然是中文路径的影响

2、warning: function declaration isn't a prototype
很可能是函数申明,没有参数时没有指明viod

3、make[1]: Entering directory `/usr/src/linux-headers-2.6.27-7-generic'
scripts/Makefile.build:46: *** CFLAGS was changed in "/mnt/new/driver/1day/ex11-debug/Makefile". Fix it to use EXTRA_CFLAGS.  Stop.

新版本的内核不允许直接在外部makefile里修改CFLAGS,可以改为EXTRA_CFLAG

DEBUG = y

ifeq ($(DEBUG),y)
DEBFLAGS = -DHELLO_DEBUG
else
DEBFLAGS = -O2
endif

EXTRA_CFLAG += $(DEBFLAGS)   

obj-m    += hello.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

你可能感兴趣的:(linux)