Linux内核模块编译失败
我的上一次内核开发是在2.6版本中~ 现在我尝试编译一个模块,当在内核树之外编译时,我得到以下错误Linux内核模块编译失败,linux,makefile,linux-kernel,Linux,Makefile,Linux Kernel,我的上一次内核开发是在2.6版本中~ 现在我尝试编译一个模块,当在内核树之外编译时,我得到以下错误 /bin/sh: 1: /home/blabla/workspace/kernel35/linux-3.5/scripts/recordmcount: not found 对象文件创建正确,但是问题出在内核Makefile本身,有些东西已经改变了,我没有更新 我正在使用kernel.org上的香草内核源代码,我已经这么做了 make oldconfig && make prepa
/bin/sh: 1: /home/blabla/workspace/kernel35/linux-3.5/scripts/recordmcount: not found
对象文件创建正确,但是问题出在内核Makefile本身,有些东西已经改变了,我没有更新
我正在使用kernel.org上的香草内核源代码,我已经这么做了
make oldconfig && make prepare
我发布了我正在使用的Makefile,它是内核模块的标准Makefile
# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DBLABLA_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
ccflags-y += $(DEBFLAGS)
ccflags-y += -I..
ifneq ($(KERNELRELEASE),)
# call from kernel build system
obj-m := blabla.o
else
KERNELDIR ?= /home/blabla/workspace/kernel35/linux-3.5
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
好吧,我知道怎么解决这个问题了。 显然,这是我第一次尝试在没有事先编译内核的情况下编译模块。 为了解决这个问题,我从内核源代码树运行以下命令
make modules_prepare
这将创建所有必要的基础结构来支持模块构建。您是否尝试过
make KERNELDIR=
。您拥有的文件的默认值为/home/blabla/./linux-3.5。这就是您的内核源代码所在的位置吗?实际上,它看起来像KERNELDIR
是指向构建树的路径。构建和源代码是否不同?