module compiling : asm/linkage.h file not found module compiling : asm/linkage.h file not found linux linux

module compiling : asm/linkage.h file not found


obj-m += hello.oall:    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesclean:    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

is a proper way to build modules see kbuild documentation

And to see difference beetween your compiler invocation you could

cat /lib/modules/$(shell uname -r)/build/Makefile

And analyze an output


obj-m += hello.oall:    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesclean:    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

Here hello.c is your kernel source file. just use make to build your hello.ko module.


asm should be a link to the actual architecture you're compiling for, not to asm-generic.
You can't compile a generic kernel module, that would work on a generic architecture. You have to compile it for the particular architecture you're going to use.

I don't know why the asm didn't exist. It should be created as part of the configuration process.
You might get other errors later, if configuration is incomplete in other ways.