4
votes

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?

2
What is unclear in phrase "include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it."? The error itself means that kernel source directory, which you point to, isn't ready for build neither kernel itself nor modules for it. - Tsyvarev
@Tsyvarev Thank you for your comment. - Woo-Hyun
@Woo-Hyun, could you solve the problem? - russoue
@Tsyvarev well in my case, I get the same error if my custom kernel module is included and get no error if I exclude my kernel module. That means that kernel source directory is ready to build kernel and is valid. - Dr. Andrey Belkin

2 Answers

2
votes

Hi,

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):

root privileges required!

if you're not root:

sudo apt install --reinstall linux-headers-$(uname -r)

sudo reboot

If you already are root:

apt install --reinstall linux-headers-$(uname -r)

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

0
votes

I solved this problem with the following commands:

  1. Switch to kernel-source directory (e.g.: build/tmp/work-shared/lmm-corei7/kernel-source).
  2. Copy there .config file with kernel configuration.
  3. Run make prepare.