Beagleboard Kernel Module Cross Compiling

Hi!

I am trying to cross-compile a kernel module for a few days now.
This module is just a hello world module to get started.

The module should be cross-compiled for Beagleboard XM Rev C with an
ARM processor.

I installed the Angstrom toolchain by doing this:

git clone git://git.angstrom-distribution.org/setup-scripts

After that i build the kernel and an image:

MACHINE=beagleboard ./oebb.sh config beagleboard
MACHINE=beagleboard ./oebb.sh update
MACHINE=beagleboard ./oebb.sh bitbake virtual/kernel
MACHINE=beagleboard ./oebb.sh bitbake systemd-gnome-image

Then i use just a small Makefile for the Kernel Module:

obj-m := mod1.o

And this build script:

#!/bin/bash
export SYSROOTS=${HOME}/source/toolchain/setup-scripts/build/tmp-
angstrom_2010_x-eglibc/sysroots
export PATH=${PATH}:${SYSROOTS}/x86_64-linux/usr/bin/armv7a-angstrom-
linux-gnueabi
export ARCH=arm
export CROSS_COMPILE=arm-angstrom-linux-gnueabi-
export KERNELDIR=${SYSROOTS}/beagleboard/kernel
make -C ${KERNELDIR} M=$(pwd) modules

The Problem now:

tom@***:~/source/modtest$ ./run.sh
make: Entering directory `/home/tom/source/toolchain/setup-scripts/
build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/kernel'
CC [M] /home/tom/source/modtest/mod1.o
/bin/sh: scripts/basic/fixdep: not found
make[1]: *** [/home/tom/source/modtest/mod1.o] Error 127
make: *** [_module_/home/tom/source/modtest] Error 2
make: Leaving directory `/home/tom/source/toolchain/setup-scripts/
build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/kernel'

I think fixdep is used to find out the dependencies for something,
what do i have to do, to get fixdep.c compiled (source and Makefile
are present in this folder). And which platform do i have to compile
it to: ARM or x86 ? I think x86... but how can i do that?

--> I am using a Ubuntu Server Edition to do all the cross compiling.

Any suggestions are welcome!

Just write a recipe for your module that does 'inherit module'

Thomas:
I’ve had success with a simpler file. I source:

export ARM_TOOLCHAIN_PATH=~/BeagleBoard/oe/build/tmp-angstrom_2010_x-eglibc/sysroots/x86_64-linux/usr/bin/armv7a-angstrom-linux-gnueabi
PATH=$PATH:$ARM_TOOLCHAIN_PATH/…
PATH=$ARM_TOOLCHAIN_PATH:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-angstrom-linux-gnueabi-

And then just run:
$ make modules

Maybe your exporting the other variables is confusing things.

–Mark

Hello,

I’m trying to build the hello_world module with the tree created by OE for my BB-xM
I found the directories :
/home/mum/OE/setup-scripts/build/tmp-angstrom_v2012_05-eglibc/sysroots/beagleboard/usr/include
/home/mum/OE/setup-scripts/build/tmp-angstrom_v2012_05-eglibc/sysroots/i686-linux/usr/bin/armv7a-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc
I want to use this kind of makefile :


obj-m += hello-1.o
make ARCH=arm CROSS_COMPILE= -C kernel_include_repository M=$(pwd)  modules

I understand the theory, but I’m lost for the practice.
Where do I put the makefile and the source file to run it after ?
do I use /home/mum/OE/setup-scripts/build/tmp-angstrom_v2012_05-eglibc/sysroots/beagleboard/usr/include for the kernel_include_repository ?

Do you have any link/tutorial to explain how to do this ?
Thank youi