I have build a linux kernel for the beaglebone black using buildroot. Now I would like to develop a hello world linux kernel module application:

#include <linux/init.h>
#include <linux/module.h>


static int hello_init(void)
    printk(KERN_ALERT "Hello, world\n");
    return 0;

static void hello_exit(void)
    printk(KERN_ALERT "Goodbye, cruel world\n");


The problem is I still keep missing some header files. After finally gathering them all, I get an error that the code is not compilable (many errors, dont want to paste them all). What I was wondering is either I am really including the right files? At the moment I have:


Its a bit odd to me that the c include files and asm files are so scattered around within the directory.

My linux version:

# uname -a
Linux buildroot 4.9.59 #1 SMP Fri Oct 5 11:55:54 CEST 2018 armv7l GNU/Linux

You don't give enough details on how you're building your Linux kernel module. Please follow the instructions at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/modules.txt to learn how to build a kernel module.

  • Hi Thomas, you have already helped me with this problem over the buildroot mailing group at 20 December. In my case the problem was that I was including the linux headers instead of sources in the makefile. – Łukasz Przeniosło Jan 1 '19 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.