Problem building an out of tree modules for kernel version 5.8.0

Michael McCann kb2ghz at
Wed Apr 28 15:48:31 EDT 2021

I'm trying to build out of tree modules for kernel version 5.8.0 for a X86
host. Below are the results when I attempt to compile the modules.

*test at test-GA-78LMT-USB3-6-0:~/X86module$ ./BuildDrivermake: Entering
directory '/home/test/LinuxKernel/linux-git'  CC [M]
 /home/test/X86module/thread.oIn file included from
./include/linux/types.h:6,                 from
./include/linux/limits.h:6,                 from
./include/linux/kernel.h:7,                 from
/home/test/X86module/thread.c:3:./include/uapi/linux/types.h:5:10: fatal
error: asm/types.h: No such file or directory    5 | #include
<asm/types.h>      |          ^~~~~~~~~~~~~compilation terminated.make[1]:
*** [scripts/ /home/test/X86module/thread.o] Error
1make: *** [Makefile:1756: /home/test/X86module] Error 2make: Leaving
directory '/home/test/LinuxKernel/linux-git'*

This is the source code for the module being compiled:

*/* out-of-tree kthreads module */#include <linux/kernel.h>#include
<linux/module.h>#include <linux/kthread.h>#include <linux/delay.h>#define
LOGLEVEL KERN_INFOstatic struct task_struct *mythread;static int work(void
*dummy);static int __init kthread_init(void) { int r; printk(LOGLEVEL
"kthread module start\n"); mythread = kthread_create(work, NULL,
"mykthread"); if (mythread > 0) { printk(LOGLEVEL "kthread created\n");
               r = wake_up_process(mythread);                     if (r) {
printk(LOGLEVEL "kthread started\n");
printk(LOGLEVEL "kthread pid = %0#10x  %d\n", mythread->pid,
mythread->pid);            }                    else printk(LOGLEVEL
"kthread already running??\n");                  } else printk(LOGLEVEL
"kthread_create failed\n"); return(0);}static int work(void *dummy) { int i
= 1; while (1) { ssleep(1); printk(LOGLEVEL "mykthread i = %d\n",i); i++;
if (kthread_should_stop()) { printk(LOGLEVEL "my kthread is
stopping...\n"); do_exit(0); } }}static void __exit kthread_exit(void) {
int r; r = kthread_stop(mythread); printk(KERN_INFO "kthread module
McCann");MODULE_DESCRIPTION("kernal threads experiment");*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Kernelnewbies mailing list