Need help with building Kernel Model for Angstrom + BeagleBoard

Hi,
I am learning building driver for BeagleBoard, but I am just a beginner. Currently I try to follow the Linux Device Driver book to build the kernel model for Angstrom. One thing I don’t know is where and how I should get the kernel tree specify for Angstrom and Beagleboard?
Thank you for your time reading and answering my question.
I am sorry if I post in the wrong email group, in that case please tell me where I should post the question.
Best regards,
Thang Nguyen

I have just already built and run the image X11-image for Beagleboard as well as build and run a simple program such as Hello World to run on Beagleboard.

In the building kernel module, they write I need the kernel source to build it. As I understand, I need to get a kernel source with specific patches for Anstrom and Beagleboard. I don’t sure where I can get this.

Best regards,
Thang Nguyen

If you build using openembedded, I think the kernel source is in one of the directories inside $OEBASE/tmp/work/

Hope that helps :slight_smile:

Thanh

— On Fri, 4/3/09, Thang Nguyen airthang@gmail.com wrote:


> From: Thang Nguyen airthang@gmail.com
> Subject: [beagleboard] Re: Need help with building Kernel Model for Angstrom + BeagleBoard
> To: beagleboard@googlegroups.com
> Date: Friday, April 3, 2009, 10:52 PM
>
> I have just already built and run the image X11-image for Beagleboard as well as build and run a simple program such as Hello World to run on Beagleboard.
>
> In the building kernel module, they write I need the kernel source to build it. As I understand, I need to get a kernel source with specific patches for Anstrom and Beagleboard. I don’t sure where I can get this.
>
> Best regards,
> Thang Nguyen

|

Hi Thanh,
Thank you so much for your help.
After looking at the folder you told me I found some sub directories:

  • all-angstrom-linux-gnueabi
  • armv7a-angstrom-linux-gnueabi
  • beagleboard-angstrom-linux-gnueabi
  • i686-linux

I guess the one I should use is beagleboard-angstrom-linux-gnueabi.

But then next one I have another question:
As I know, after writing the module “moduleA.c” and a “Makefile” with the content is obj-m := moduleA.o, I need to compile it with the kernel source.
The instruction says that from the directory of the module source I should type
$make -C “kernel source path” M=pwd modules
and I got the error:
make: *** No rule to make target `modules’. Stop.
I don’t know what I should do next. Could you please tell me how to do it right?

Thank you for your time.
Thang Nguyen

There are a number of pre-made recipes for a number of kernels already
in openembedded. You can get a list with something like:

grep -l COMPATIBLE_MACHINE.*beagleboard openembedded/recipes/linux/
linux*

If you build 2.6.69 with:

bitbake -b openembedded/recipes/linux/linux-omap_2.6.29.bb

... the unpacked, configured kernel source will end up somewhere like:

tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.29*/git

You can use this directory to setup patches or play around with the
kernel config with:

make ARCH=arm menuconfig

I haven't tried but I believe you can do a build from this directory
with:

bitbake -f -c compile -b openembedded/recipes/linux/linux-
omap_2.6.29.bb

If you change the config you should copy the .config back to:

openembedded/recipes/linux/linux-omap/beagleboard/defconfig

.. and remake with:

bitbake -c clean -b openembedded/recipes/linux/linux-omap_2.6.29.bb
bitbake -b openembedded/recipes/linux/linux-omap_2.6.29.bb

Is it right that with the kernel source linux-omap_2.6.29 after using
bitbake -b openembedded/recipes/linux/linux-omap_2.6.29.bb
, I can apply patch for Angstrom modules to make it similar to Angstrom distribution version?
Sorry for stupid question cause I am still new with these.

Thang Nguyen

Hi Thang
I think there is problem with your make file. If you post it up, maybe someone can spot out what’s wrong

Thanh

If you want to build kernel modules against the angstrom kernel, you should make a recipe for them and do 'inherit module' in that.

regards,

Koen

Hi,
I found in the $OEBASE/tmp/work/beagleboard-angstrom-linux-gnueabi/angstrom-version-1_2009.X-test-20090422-4r2 there is a file angstrom-version.bb. Is this the file I should inherit from? How should I indicate it in the Makefile?

Hi,
I need help with my current status. I don’t understand why like the compiler cannot find the makefile while it’s there.
This is the content of the log file:

NOTE: make CROSS_COMPILE=arm-angstrom-linux-gnueabi- KERNELDIR=/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28/git CC=ccache arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
make -C /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28 M=/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/hellokernel-1.0-r28/hellokernel ARCH=arm CROSS_COMPILE=/home/naruto/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi- modules
make[1]: Entering directory /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28' make[1]: *** No rule to make target modules’. Stop.
make[1]: Leaving directory `/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28’
make: *** [kernel-module] Error 2
FATAL: oe_runmake failed

I checked in this folder: /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/hellokernel-1.0-r28/hellokernel and found 2 files hellokernel.c and Makefile which I think are copied from my original folder which is in $OEBASE/build/hellokernel/files/

I attach here all of my files.

I really need your help cause I don’t know how to fix this issue.

Best regards,
Thang Nguyen

hellokernel.c (294 Bytes)

Makefile (1 KB)

hellokernel.bb (1.19 KB)

Hello Thang,

I’m still learning how to use bitbake / open embedded, so I can’t answer your Bitbake recipe stuff. But I could build your helloworld kernel module using the Sourcery arm tool
I could build your helloworld kernel module using regular make command. I don’t have the OE set up here so I can’t try using OE. Also, your source file has a typo (KERN_ALER) in the hello_exit() function. Maybe that’s why it can’t compile?

I mod. your make file to match my environemnt:

# KERNEL_VERSION := 2.6.28-r28
# KERNEL_DIR := /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28

KERNEL_DIR := “/home2/beagle/2.6_kernel”
KERNEL_CROSS := “arm-none-linux-gnueabi-”

ifeq ($(DEBUG),y)
EXTRA_CFLAGS += -O -g # -O is need to expand inlines
else
EXTRA_CFLAGS += -O2
endif

# cd helloworld
# export PATH=$PATH:/apps/codesourcery/arm-2007q3/bin/
# make

Hope that helps

Thanh










— On Sun, 5/3/09, Thang Nguyen airthang@gmail.com wrote:


> From: Thang Nguyen airthang@gmail.com
> Subject: [beagleboard] Re: Need help with building Kernel Model for Angstrom + BeagleBoard
> To: beagleboard@googlegroups.com
> Cc: thanhtranhd@yahoo.com
> Date: Sunday, May 3, 2009, 7:51 PM
>
> Hi,
> I need help with my current status. I don’t understand why like the compiler cannot find the makefile while it’s there.
> This is the content of the log file:
>
> NOTE: make CROSS_COMPILE=arm-angstrom-linux-gnueabi- KERNELDIR=/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28/git CC=ccache arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
> make -C /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28 M=/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/hellokernel-1.0-r28/hellokernel ARCH=arm CROSS_COMPILE=/home/naruto/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi- modules
> make[1]: Entering directory /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28'<br>> make[1]: *** No rule to make target modules’. Stop.
> make[1]: Leaving directory `/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28’
> make: *** [kernel-module] Error 2
> FATAL: oe_runmake failed
>
> I checked in this folder: /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/hellokernel-1.0-r28/hellokernel and found 2 files hellokernel.c and Makefile which I think are copied from my original folder which is in $OEBASE/build/hellokernel/files/
>
> I attach here all of my files.
>
> I really need your help cause I don’t know how to fix this issue.
>
> Best regards,
> Thang Nguyen
>
> On Sun, Apr 26, 2009 at 11:34 PM, Thang Nguyen <airthang@gmail.com> wrote:
>
> > Hi,
> > I found in the $OEBASE/tmp/work/beagleboard-angstrom-linux-gnueabi/angstrom-version-1_2009.X-test-20090422-4r2 there is a file angstrom-version.bb. Is this the file I should inherit from? How should I indicate it in the Makefile?
> >
> > On Mon, Apr 6, 2009 at 1:43 AM, Koen Kooi <koen@beagleboard.org> wrote:
> >
> > > Op 6 apr 2009, om 07:40 heeft Thang Nguyen het volgende geschreven:
> > >
> > > > Is it right that with the kernel source linux-omap_2.6.29 after using
> > > > bitbake -b openembedded/recipes/linux/linux-omap_2.6.29.bb
> > > > , I can apply patch for Angstrom modules to make it similar to Angstrom distribution version?
> > > > Sorry for stupid question cause I am still new with these.
> > >
> > > If you want to build kernel modules against the angstrom kernel, you should make a recipe for them and do ‘inherit module’ in that.
> > >
> > > regards,
> > >
> > > Koen
>
> #include

|

Hi Thanh,
Could you tell me where you get your kernel from. I think this is my problem. When I try to use make as you told me, I got the same error:

naruto@naruto-laptop:~/oe/build/hellokernel/files$ make
make -C /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28 M=/home/naruto/oe/build/hellokernel/files ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
make[1]: Entering directory /home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28' make[1]: *** No rule to make target modules’. Stop.
make[1]: Leaving directory `/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28’
make: *** [kernel-module] Error 2

By the way, can you send me the Makefile so I can make sure I understand what said.

Hi Thang

My kernel wasn’t the Angstrom kernel. I downloaded it from google code page a while ago.

http://code.google.com/p/beagleboard/wiki/BeagleSourceCode

I attached the modified Makefile.

Best regards

Thanh

Makefile (1 KB)

Hi,
This is what I got so far with make command:

naruto@naruto-laptop:~/oe/build/hellokernel/files$ make
make -C /home/naruto/oe/linux-omap-2.6 M=/home/naruto/oe/build/hellokernel/files ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
make[1]: Entering directory `/home/naruto/oe/linux-omap-2.6’

WARNING: Symbol version dump /home/naruto/oe/linux-omap-2.6/Module.symvers
is missing; modules will have no dependencies and modversions.

CC [M] /home/naruto/oe/build/hellokernel/files/hellokernel.o
In file included from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /home/naruto/oe/build/hellokernel/files/hellokernel.c:2:
include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
include/linux/mmzone.h:256:5: warning: “MAX_NR_ZONES” is not defined
In file included from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /home/naruto/oe/build/hellokernel/files/hellokernel.c:2:
include/linux/mmzone.h:290: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)
make[2]: *** [/home/naruto/oe/build/hellokernel/files/hellokernel.o] Error 1
make[1]: *** [module/home/naruto/oe/build/hellokernel/files] Error 2
make[1]: Leaving directory `/home/naruto/oe/linux-omap-2.6’
make: *** [kernel-module] Error 2

As I understand, I have issue with the bounds.h file and the parameter ‘MAX_NR_NONES’. By searching on the internet, some topic say that I need to do make prepare from the folder of kernel linux-omap-2.6.
And I got this error:

naruto@naruto-laptop:~/oe/linux-omap-2.6$ make prepare
make: arm-linux-gcc: Command not found
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h’ is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm → include/asm-arm
CC kernel/bounds.s
/bin/sh: arm-linux-gcc: command not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2

Thank you for your time reading and answering my questions.

Best regards,
Thang Nguyen

Hi Thang

Are you sure the directory: `/home/naruto/oe/linux-omap-2.6’ is where the kernel is?

The kernel in OE is normally sits in the one of the directory in $OEBASE/tmp/work/…

In my set up, the kernel fed by OE is here:
"/home/thanhtram/oe/tmp/work/dm355-leopard-angstrom-linux-gnueabi/linux-davinci-2.6.29+2.6.29-rc7-r3+gitr486afa37130356662213cc1a2199a285b4fd72af-r3/git/

After OE runs for the first time, it creates a cross compiler which sits at:
/home/thanhtram/oe/tmp/cross/armv5te/bin

This is the cross compiler I will use to build your kernel module.

I tried your makefile source files on my OE set up, and it worked fine.

The commands I ran:

// add the path of the cross compiler (created by OE)
(Fuji)hellomodule$ export PATH=$PATH:/home/thanhtram/oe/tmp/cross/armv5te/bin

(Fuji)hellomodule$ cat /tmp/output.txt
make -C “/home/thanhtram/oe/tmp/work/dm355-leopard-angstrom-linux-gnueabi/linux-davinci-2.6.29+2.6.29-rc7-r3+gitr486afa37130356662213cc1a2199a285b4fd72af-r3/git/” M=/home/thanhtram/working/hellomodule ARCH=arm CROSS_COMPILE=“arm-angstrom-linux-gnueabi-” modules
make[1]: Entering directory /home/thanhtram/oe/tmp/work/dm355-leopard-angstrom-linux-gnueabi/linux-davinci-2.6.29+2.6.29-rc7-r3+gitr486afa37130356662213cc1a2199a285b4fd72af-r3/git' Building modules, stage 2. MODPOST 1 modules make[1]: Leaving directory /home/thanhtram/oe/tmp/work/dm355-leopard-angstrom-linux-gnueabi/linux-davinci-2.6.29+2.6.29-rc7-r3+gitr486afa37130356662213cc1a2199a285b4fd72af-r3/git’
(Fuji)hellomodule$

The setting in your Makefile
(Fuji)hellomodule$ cat Makefile

Come to now, I guess my problem is both the kernel and the cross compiler.
The kernel I used in my Makefile is from:

git clone git://[git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git](http://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git) linux-omap-2.6

And the cross compiler I used is the Sourcery_G++_Lite compiler.

Now everything is clearer and I did build successfully after I modify Makefile follow your suggestion. But I still have not time to test it yet.
I feel weird why I don’t have the same structure with your folder. After doing bitbake console-image successfully and I can run my BeagleBoard with this kernel, what I have in my folder which correspondent to your directory is:

In the cross folder I have armv7a not armv5te. In this case I guess I can use the cross compiler from this path:
KERNEL_CROSS := “/home/naruto/oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-”

In the work folder, I found 4 subdirectory, they are:

  1. all-angstrom-linux-gnueabi (6 items)
  2. armv7a-angstrom-linux-gnueabi (93 items)
  3. beagleboard-angstrom-linux-gnueabi (14 items)
  4. i686-linux (49 items)

I used this one:
KERNEL_DIR := “/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28/git/”

Anyway, I will try to run this module on the BeagleBoard and I will let you know.

Thank you so much for your patient.

Best regards,
Thang Nguyen

Dear Experts,
I am a newbie, I want to use beagle board to prototype a vision inspection system.

Therefore i’ll need a USB camera(atleast 5MP) and the related drivers so that i can control the image grabbing operations and then process image(raw)

My question to the community is to suggest

  1. what camera to use?
  2. where do i get the drivers and control application/demo.

thanks in advance
regards
Amit


Hi Thang

I’m glad you figure it out.
My OE environment is set up for a different target (the Leopardboard.org), and that’s why its directory name and files are different from your set up.

Thanh

— On Tue, 5/5/09, Thang Nguyen airthang@gmail.com wrote:


> From: Thang Nguyen airthang@gmail.com
> Subject: [beagleboard] Re: Need help with building Kernel Model for Angstrom + BeagleBoard
> To: beagleboard@googlegroups.com
> Date: Tuesday, May 5, 2009, 10:20 PM
>
> Come to now, I guess my problem is both the kernel and the cross compiler.
> The kernel I used in my Makefile is from:
>
> <br>> git clone git://[git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git](http://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git) linux-omap-2.6<br>> <br>>
>
> And the cross compiler I used is the Sourcery_G++_Lite compiler.
>
> Now everything is clearer and I did build successfully after I modify Makefile follow your suggestion. But I still have not time to test it yet.
> I feel weird why I don’t have the same structure with your folder. After doing bitbake console-image successfully and I can run my BeagleBoard with this kernel, what I have in my folder which correspondent to your directory is:
>
> In the cross folder I have armv7a not armv5te. In this case I guess I can use the cross compiler from this path:
> KERNEL_CROSS := “/home/naruto/oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-”
>
> In the work folder, I found 4 subdirectory, they are:
> 1. all-angstrom-linux-gnueabi (6 items)
> 2. armv7a-angstrom-linux-gnueabi (93 items)
> 3. beagleboard-angstrom-linux-gnueabi (14 items)
> 4. i686-linux (49 items)
>
> I used this one:
> KERNEL_DIR := “/home/naruto/oe/tmp/work/beagleboard-angstrom-linux-gnueabi/linux-omap-2.6.28-r28/git/”
>
> Anyway, I will try to run this module on the BeagleBoard and I will let you know.
>
> Thank you so much for your patient.
>
> Best regards,
> Thang Nguyen

|

Dear Experts,
Sorry for re-posting my email.
I want to use beagle board to prototype a vision inspection system.

Therefore i'll need a USB camera(atleast 5MP) and the related drivers so that i can control the image grabbing operations and then process image(raw)

My question to the community is to suggest
1. what camera to use?
2. where do i get the drivers and control application/demo.

thanks in advance
regards
Amit

Will leopardboard.org be of any use to you ?

Regards,
Khasim