I'm trying to compile a sample kernel module (test.c) on my Arch linux just typing make in the directory with source and Makefile.
It creates empty folder .tmp_versions and empty files Module.symvers and modules.order, but no .ko
I also tried to compile it under virtual machine with Ubuntu, but I have absolutely the same output. Samples were from the Internet (2 ones).
What I should do else to compile it?
Makefile:
obj−m += test.o
default:
$(MAKE) -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
But it shows me:
make -C /lib/modules/4.18.14-arch1-1-ARCH/build SUBDIRS=/home/hime/Documents/module modules
make[1]: Entering directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
Building modules, stage 2.
MODPOST 0 modules
make[1]: Leaving directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
or (verbose):
make -C "/lib/modules/4.18.14-arch1-1-ARCH/build" SUBDIRS="/home/hime/Documents/module" modules V=1
make[1]: Entering directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
mkdir -p /home/hime/Documents/module/.tmp_versions ; rm -f /home/hime/Documents/module/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/hime/Documents/module
(cat /dev/null; ) > /home/hime/Documents/module/modules.order
make -f ./scripts/Makefile.modpost
find /home/hime/Documents/module/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -a -i ./Module.symvers -I /home/hime/Documents/module/Module.symvers -o /home/hime/Documents/module/Module.symvers -S -w -s -T -
make[1]: Leaving directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'