首页 > 解决方案 > 如何解决内核配置无效的问题

问题描述

我正在尝试构建模块。

但这里有一些问题。

错误:内核配置无效。缺少 include/generated/autoconf.h 或 include/config/auto.conf。在内核 src 上运行“make oldconfig && make prepare”来修复它。

警告:缺少符号版本转储 ./Module.symvers;模块将没有依赖项和修改版本。`

这是我的makefile

ifeq ($(KERNELRELEASE),)


KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

modules:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules

modules_install:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

clean:
    rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

.PHONY: modules modules_install clean

else
    # called from kernel build system: just declare what our modules are
    obj-m := hello.o hellop.o seq.o jit.o jiq.o sleepy.o complete.o \
             silly.o faulty.o kdatasize.o kdataalign.o
endif

我尝试像这样构建:

export KERNELDIR=/path/to/extern/linux/source
make

我怎么解决这个问题?

标签: linux-kernellinux-device-driver

解决方案


好的,所以我会尝试重新安装 linux-headers。告诉我这是否有效!或者如果没有!

在终端中(大概是bash):

需要root权限!

如果你不是root:

  • sudo apt install --reinstall linux-headers-$(uname -r)
  • sudo reboot# 或者现在:添加一个now

如果您已经是 root:

  • apt install --reinstall linux-headers-$(uname -r)然后reboot# 或现在:添加一个now

如果你得到它找不到任何包,(或类似的)(来自apt)尝试并重apt update试上述。

我不知道这是否有任何帮助,但是 - 检查/var/log/kern.log任何消息


推荐阅读