[Openembedded-users] Procedure to Bitbake a new "hello world" kernel module?

Bertrand Szoghy webmaster at quadmore.com
Wed Jan 19 22:24:49 UTC 2011


Hello,

I've had a lot of success with Bitbake for different target machines
(Atmel and TI boards, and a good old iPaq 3600). We will now need to
cross-compile a new Linux kernel module. I'm not too sure how to do this
using Bitbake.

# my "hello world" kernel module:
#(BEGIN hello.c)

#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */
#include <linux/init.h>         /* Needed for the macros */

static int __init hello_start(void)
{
printk(KERN_INFO "Loading hello module...\n");
printk(KERN_INFO "Hello world\n");
return 0;
}

static void __exit hello_end(void)
{
printk(KERN_INFO "Goodbye Mr.\n");
}

module_init(hello_start);
module_exit(hello_end);

#(END hello.c)

# My Bitbake commands:
# start over:
MACHINE=am180x-evm bitbake virtual/kernel -c clean

# To revert to kernel defconfig:
MACHINE=am180x-evm bitbake virtual/kernel -c configure

I am guessing I need to add "hello" in the list on line:
MACHINE_FEATURES = "kernel26 serial ethernet"

of my am180x-evm.conf file.

Now where do I put my .c file and where would the kernel module recipes be
located? Any help greatly appreciated.

Thank you in advance.

Best regards,
Bert








More information about the Openembedded-users mailing list