Step by step guild to cross compiling a kernel for the Beagleboard xM

Hi All,

  I have had a Beagleboard xM for some time now and with the use of a
pre built images from Robert Nelson have developed some simple
programs that work successfully. The problem I have is that not all
the images I have tried, have the right combination of devices built
in to the kernel that I require, so I embarked on trying to build my
own ‘tailor made’ kernel. So far without success. I have used various
guilds and instructions found on the Web. In all cases I get so far
long and then get errors I cannot resolve, mainly down to my lack of
knowledge in this subject. In some cases, terms are used like
‘toolchains’ which is not explained, or when down loading an item from
a repositories the item is not found or permission block the download.
It seems a bit confusing to someone new to this environment, not
having been involved with the history of the various development
methods. I have seen procedures using things like ‘git’ or ‘schroot’
and I am not sure which is the best approach to take.

  Does anyone have a good ‘Step by Step’ guild on how to build a Linux
(perhaps Ubuntu) kernel for the Beagleboard xM, including the steps
required to get the new kernel on to a SD card so it will boot on the
BB. My preferred method would be to cross compile the kernel under
Ubuntu 10.10 running in a virtual VMWare environment under Windows.

  Information on how to configure the kernel build options would also
be useful.

  Any help in progressing my problem would be much appreciated.

    Ernie

Ernie:
Here [1] is what I use with my students. Most have been able to get it work.

It points you to Angstrom [2] and bitbake but adds some details so the kernel source code isn’t removed.

–Mark

[1] http://elinux.org/EBC_Exercise_01_Using_bitbake_for_Kernel_and_U-boot
[2] http://www.angstrom-distribution.org/building-angstrom

cross compilation howto for Ubuntu:

// get the source first
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git

// tweak the config
cd ubuntu-precise
export $(dpkg-architecture -aarmel); export
CROSS_COMPILE=arm-linux-gnueabi-
fakeroot debian/rules clean editconfigs

// compile it
fakeroot debian/rules binary-omap

// copy the generated .deb on the sd:

cp ../linux-image-$your-own-kernel-version-here.deb /media/$something

// boot the beagle and install it via dpkg:

dpkg -i linux-image-$your-own-kernel-version-here.deb

if you want to mark your kernel in some way (so you can distinguish it
from stock ones), modify debian.master/changelog:

linux (3.2.0-9.16) precise; urgency=low

to

linux (3.2.0-9.16~myownkernel) precise; urgency=low

this way you will get a kernel with "~myownkernel" appended at the end
(and whenever a new offical Ubuntu kernel is available it will
overwrite it).

The same steps are required for a Pandaboard, but you'll have to
switch branch after you checked out the source:

git co ti-omap4

and when you compile it use binary-omap4 insted of binary-omap.

- --
bye,
p.

Hi Mark,

Hi Mark,

Is this valid for the Beagleboard xM system?

    Ernie

Paolo,
  Thanks for the feedback.

  I am trying your instructions at the moment and I have got to the
point of running the command: fakeroot debian/rules binary-omap and
the result was and error: make: *** No rule to make target ‘binary-
omap’. STOP. I have seen this before not sure how to put it right.

  What I was also not clear about is when you run the command fakeroot
debian/rules clean editconfigs and I get asks a list of questions
about which component to edit the config for, I chose the armel/
config.flavour.omap option, is this right for BB xM. Do I need to do
anything special when I exit the edit? Do I need to save the config
with a name even if I don’t change anything?

  Ernie

Hey kids, this is my first attempt to boot from SD card.

I followed the procedure of Sec. 12.3 of Beagle_SRM_C4.pdf.
(SD Card Configuration). The tail end of the boot log is listed
below. Note that this procedure (from the SRM) only involves
one FAT32 partition for the SD card. All the source files came
from links at this page:

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

I did not seek out the Rev-C4-specific files at the angstrom-
distribution site. (Is that the problem?)

I could use a hint or two on where to go from here. Thanks!

/rafe


Disabling unused clock “gpt11_fck”
Disabling unused clock “gpt10_fck”
Disabling unused clock “dpll4_m6x2_ck”
Disabling unused clock “dpll3_m3x2_ck”
Disabling unused clock “sys_clkout1”
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1
Console: switching to colour frame buffer device 80x30
clock: clksel_round_rate_div: dpll4_m4_ck target_rate 48000000
clock: new_div = 9, new_rate = 48000000
twl4030_rtc twl4030_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
RAMDISK: Compressed image found at block 0
invalid compressed format (err=2)
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 168K
EXT2-fs error (device ram0): ext2_check_page: bad entry in directory #12: : rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, name_len=0
Warning: unable to open an initial console.
EXT2-fs error (device ram0): ext2_check_page: bad entry in directory #143: : rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, name_len=0
Kernel panic - not syncing: No init found. Try passing init= option to kernel.

Try this.

http://circuitco.com/support/index.php?title=BeagleBoard

Gerald

I’ll try that, Gerald. No problem.

But seriously – the procedure I tried is probably one
of the first that a newb might try – it comes straight
from the beagleboard wiki, as referenced from the
BB SRM. So shouldn’t we try to clarify that procedure,
if there’s a problem with it?

/rafe

Typically, I send every one to this link. This is my page and this procedure works for me. I plan to update the SRM and add this link in the SRM, removing all that stuff that is there now. That should solve the issue. In reality, most people know enough about Linux and have their own method of creating the image onto a card, using things like scrots, as described on the Angstrom site for example… This process if for folks that are more on the Window side of the planet…

Gerald