Compiling Android with Kernel 3.8

Replace Rowboat default Kernel with Kernel 3.8

Note 1: SGX is not yet supported on Kernel 3.8 so there is no hardware-accelerated OpenGL on this release./pre>
Note 2: Consider Rowboat for BeagleBone Black was cloned at ~/rowboat-android-bbb and Kernel 3.8 is at ~/linux-dev

cd ~/rowboat-android-bbb
mv kernel kernel.bkp
ln -s ~/linux-dev/KERNEL kernel

Compiling Android for BeagleBone Black

Let's modify some Makefiles in order to use 'arm-linux-gnueabihf-' instead of 'arm-eabi' for compiling.

chmod 644 ~/rowboat-android-bbb/Makefile
vi ~/rowboat-android-bbb/Makefile

And add a # (comment) in front of export PATH :=$(PATH):$(ANDROID_INSTALL_DIR)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin.
Below that (new) comment add the following two lines and save

export PATH :=~/linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin:$(PATH)
export CC_PREFIX := arm-linux-gnueabihf-

Search the Makefile for references to arm-eabi- and replace them with $(CC_PREFIX). Once all the changes are saved, go on building Android with SGX support.
$ make TARGET_PRODUCT=beagleboneblack OMAPES=4.x droid -j4 (It takes more or less 2 hours on a Intel i5 with 8GB of RAM.)

Compiling Android for BeagleBone Black

U-Boot for BeagleBone Black

Getting U-Boot and patching

Note: Use this guide only if you are building Android with Kernel 3.8

cd ~/
mkdir u-boot-bbb
cd u-boot-bbb
git clone git://git.denx.de/u-boot.git
cd u-boot/
git checkout v2013.04 -b tmp
wget https://raw.github.com/eewiki/u-boot-patches/master/v2013.04/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

Compiling U-Boot

We will compile U-Boot using the same toolchain used for compiling the Kernel, and not the one present in Rowboat-Android

export PATH=$PATH:~/linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

U-Boot for BeagleBone Black

Output files

The output files are ./MLO and u-boot.img. Copy these two files into a new folder in your home directory (i.e.: ~/bbb-android-image)
Next: Compiling Android with Kernel 3.8

beaglebone-black

BeagleBone Black and Linux Kernel 3.8 with Android support

Building Kernel 3.8 (with Device Tree)

cd ~/
git clone git://github.com/RobertCNelson/linux-dev.git
cd linux-dev/
git checkout origin/am33x-v3.8 -b tmp
./build_kernel.sh

If ./build_kernel.sh fails with ‘undefined references’ to some functions in files like ‘menubox.c’ try running: sudo apt-get install libncurses5 libncurses5-dev libelf-dev libncurses5 libncursesw5-dev and then retry with ./build_kernel.sh.

Setting up Kernel 3.8.x for Android

Once in the Kernel Configuration Utility (kConfig) scroll down, and enter, ‘Device Drivers’.

Beaglebone Black - Kernel Config for AndroidMake sure the ‘Staging drivers’ are enabled, or enable them (an asterisk will appear between brackets)

Beaglebone Black - Kernel Config for Android

Then, enter ‘Staging drivers’ -> ‘Android’. Enable all Android drivers. I recommend you to include them into the kernel, and not build them as module.

Beaglebone Black - Kernel Config for Android

Exit ‘kConfig’ and the Kernel will begin building.

Beaglebone Black - Kernel Config for Android

When it is done you will see something like

Beaglebone Black - Kernel Config for Android

Next: U-Boot for BeagleBone Black

Android 4.1.2 Image for Beagleboard XM

This Image can be loaded into an SD Card (4GBytes min). It can run entirely from the SD Card, or the Android OS can run from a USB Flash, and U-Boot, X-Loader and the Kernel on the SD Card.

Configure U-Boot

For running entirely from the SD Card

Setup U-BOOT for Android and Kernel on SD Card

./mkbootscr

For running Android OS from a USB Drive

Setup U-BOOT for Android on USB and Kernel on SD Card

./mkbootscrUSB

copy rootfs.tar.bz2 to USB Drive and untar (all these commands should be executed as Administrator)

Create SDCard

Note: Script not yet optimized for configuration with USB Drive (it is not necessary to copy rootfs to SD Card when booting from USB)
sudo ./mkmmc.sh /dev/sdb MLO u-boot uImage boot.scr rootfs.tar.bz2

Files: Android Image for BeagleBoard xM