Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to solve Kernel configuration is invalid issues

I'm trying to build module.

But here's some issues.

ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it.

WARNING: Symbol version dump ./Module.symvers is missing; modules will have no dependencies and modversions.`

And here's my 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

I tried building like this:

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

How can I solve this problem?

like image 394
Woo-Hyun Avatar asked May 16 '18 03:05

Woo-Hyun


People also ask

How do I enable kernel configuration options?

To configure the kernel, change to /usr/src/linux and enter the command make config. Choose the features you want supported by the kernel. Usually, There are two or three options: y, n, or m. m means that this device will not be compiled directly into the kernel, but loaded as a module.

Where do I find kernel configuration?

The Linux kernel configuration is usually found in the kernel source in the file: /usr/src/linux/. config .

Which command is used to configure kernel?

config file in the root directory of the kernel tree. The configuration file itself can be generated by issuing the make menuconfig command.


2 Answers

Okay, so I would try to re-install the linux-headers. Tell me if this works! Or if it didn't!

in a terminal(bash presumably):

root privileges required!

if you're not root:

  • sudo apt install --reinstall linux-headers-$(uname -r)
  • sudo reboot # or now: add a now

If you already are root:

  • apt install --reinstall linux-headers-$(uname -r) and then reboot # or now: add a now

If you get it couldn't find any package, (or similar) (from apt) try apt update and re-try the above.

I don't know if this could be of any help, but - check /var/log/kern.log for any messages

like image 176
William Martens Avatar answered Oct 14 '22 08:10

William Martens


I solved this problem with the following commands:

  1. From your built sources take the most recent .config file with kernel configuration. Copy it to kernel-source directory (e.g.: build/tmp/work-shared/lmm-corei7/kernel-source).
  2. Run make prepare.
like image 37
Dr. Andrey Belkin Avatar answered Oct 14 '22 09:10

Dr. Andrey Belkin