Cross compiling linux for BBB

I want to get started in kernel development for the BBB and I can’t find where to start, I have done work before developing Linux drivers for network interface cards and TV tuner cards. Is there a document that describes how to setup a cross compilation environment for lets say an ubuntu workstation or any other mainstream distribution and step by step how to build a bin file for flashing ?

I have looked at and can’t find something like that

http://www.openembedded.org/wiki/Main_Page

http://www.angstrom-distribution.org

According to thread linked below the BBB will be going towards debian, is there a tutorial on how to cross compile debian ?

https://groups.google.com/forum/#!category-topic/beagleboard/beaglebone-black/WYrk-JUAkbM

For me this is the number one stumbling block, I haven’t tried compiling just a kernel on the beagle itself, I assume thats not how you do it?

I want to get started in kernel development for the BBB and I can’t find where to start, I have done work before developing Linux drivers for network interface cards and TV tuner cards. Is there a document that describes how to setup a cross compilation environment for lets say an ubuntu workstation or any other mainstream distribution and step by step how to build a bin file for flashing ?

I have looked at and can’t find something like that

http://www.openembedded.org/wiki/Main_Page

http://www.angstrom-distribution.org

According to thread linked below the BBB will be going towards debian, is there a tutorial on how to cross compile debian ?

https://groups.google.com/forum/#!category-topic/beagleboard/beaglebone-black/WYrk-JUAkbM

For me this is the number one stumbling block, I haven’t tried compiling just a kernel on the beagle itself, I assume thats not how you do it?

sudo apt-get install arm-linux-gnueabihf-gcc

if you use make, you want to setup these env variables

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm

To compile

arm-linux-gnueabihf-gcc test.c –o test

Copy file to BBB, set execute permission and run.

Regards,
John

In part, that's because it's not really necessary to build a bin file
for flashing. The BBB is much more like a desktop system than a
'traditional' embedded Linux board, and unless you're playing with the
uBoot loader, you don't really have to invoke any black magic or secret
sauce.

For kernel development, you can just drop a new kernel onto the FAT boot
partition and load it. You can cross-build the kernel as usual, or if
you're not familiar with the process just grab RCN's linux-dev github
and it will do everything for you (including downloading a known-good
cross-compiler tool chain if you don't already have one installed).

To avoid pulling out too much hair while testing new kernels, I
recommend you obtain a serial port cable for the BBB, which lets you
interact with the uBoot loader and see all the boot messages. Both can
be critical in figuring out why your shiny new kernel doesn't boot and
in recovering from this state.

Also, I find it easier to play with kernels when network booting or
booting from the SD card. With both of these options you can easily
recover a non-booting system...if you mess up the kernel in the on-board
eMMC flash, it can be difficult to recover from. If you're using an SD
card, you can just pop it into another system to fix the problem, and
with network booting, you don't even have to do that, you can just swap
kernel files around and reboot in seconds.

So its the hard float tool chain that I need to use, for userland programs its the emulated float version thats used at least for the angstrom version I am playing with.

Thats looks a lot easier than I thought.

Thanks

I posted some notes on that here: http://bonenotes.tumblr.com/ under “Cross-compiling the BeagleBone 3.8 Kernel”

Chris,

This is exactly what I have been looking for! Nicely done!
Everywhere else I have seen general steps but no actual procedures. This is great for a beginner like myself.

Great - I’m glad someone has found it useful :slight_smile:

I do too .Disapointed by the recent events from Angstrom side I think it’s
a good way and alternative to buildroot.

PS : in the build_kernel.sh you use a

“make -j 8”

assuming the user will have 4 cpu which is not allways the case. Maybe something like


cat /proc/cpuinfo | awk '/^processor/{print $3}' | tail -1

would help to retrieve CPU cores to x2 to be more generic.

Anyway very interesting notes.

Yeah good point - my machine is 4core/ht but that should change depending on what your machine is!

One thing I should update also on the wifi - i switched from the crap realtek chipset to an atheros-based TP-LINK adaptor, and things are MUCH much better.