make -C /usr/src/linux M=/home/axlrose/myhome/program/module/test/scull_debug modules
make[1]: Entering directory `/usr/src/linux-2.6.25-thinkpad-r7'
scripts/Makefile.build:46: *** CFLAGS was changed in "/home/axlrose/myhome/program/module/test/scull_debug/Makefile". Fix it to use EXTRA_CFLAGS。 停止。
make[1]: *** [_module_/home/axlrose/myhome/program/module/test/scull_debug] 错误 2
make[1]: Leaving directory `/usr/src/linux-2.6.25-thinkpad-r7'
make: *** [modules] 错误
今天编译ldd模块发现遇到CLFAGS被修改的错误的提示
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
#CFLAGS += $(DEBFLAGS) ######AAAAAAA
注释掉后就OK了
因为内核编译时的CFLAGS参数不一样,
[axlrose@ibmgentoo linux] $ grep CFLAGS Makefile
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
CFLAGS_MODULE = $(MODFLAGS)
CFLAGS_KERNEL =
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
KBUILD_CFLAGS += -Os
KBUILD_CFLAGS += -O2
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
KBUILD_CFLAGS += -fomit-frame-pointer
KBUILD_CFLAGS += -g
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
ifneq ($(KCFLAGS),)
$(call warn-assign,CFLAGS)
KBUILD_CFLAGS += $(KCFLAGS)
[axlrose@ibmgentoo linux] $ pwd
/usr/src/linux
sudo gedit /usr/src/linux-headers-2.6.24-16-generic/scripts/Makefile.build
Delete ->
----------------------------------------------------------------------------------------------------------------------------
# If the save-* variables changed error out
ifeq ($(KBUILD_NOPEDANTIC),)
ifneq ("$(save-cflags)","$(CFLAGS)")
$(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
endif
endif
----------------------------------------------------------------------------------------------------------------------------
Save 引用自 https://bugs.launchpad.net/ubuntu/+source/gspca/+bug/213762
按理说应该有解决办法,等高手支招