Initializing the Host Environment

Introduction

To build the Codezero system, you will need to use Linux. Building under Windows is not currently supported. For all development purposes 32bit Ubuntu based host machines are used. 64bit Ubuntu host machines are also known to work well.

All the tutorials and information present on this website corresponds to 32bit Ubuntu host machine, unless otherwise specified.

Installing required packages

$ sudo apt-get install git libncurses-dev qemu qemu-system linaro-image-tools build-essential

Android (Google AOSP Releases)

Installing compiler/toolchain

AOSP prebuilt toolchain, version 4.4.3, is used to compile Codezero hypervisor kernel, virtual guest kernels and other libraries.

$ mkdir /opt/toolchain
$ cd /opt/toolchain
$ git clone https://android.googlesource.com/platform/prebuilt

Add toolchain’s path to the system by appending ~/.bashrc file with the following lines

PATH=$PATH:/opt/toolchain/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
export PATH

Configuring USB Access

Under GNU/linux systems (and specifically under Ubuntu systems), regular users can’t directly access USB devices by default. The system needs to be configured to allow such access.

The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. <username> must be replaced by the actual username of the user who is authorized to access the phones over USB.

# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"

Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.

Installing AOSP host tools

AOSP tools like fastboot, mkimage and adb are needed to build and flash images on the target device/board. You can compile your own AOSP tree for these or download the prebuilt ones from here.

Save the downloaded binaries at /opt/aosp-tools/. Make the downloaded binaries executable

$ cd /opt/aosp-tools
$ chmod 777 *

Add AOSP tools’s path to the system by appending ~/.bashrc file with the following lines

$ PATH=$PATH:/opt/aosp-tools
$ export PATH

Linaro

Linaro is an initiative to improve Ubuntu and Linux releases on ARM processor based platforms. For more information see: Linaro.org. Codezero supports Linaro releases.

Install linaro compilers on Ubuntu:

$ sudo add-apt-repository ppa:linaro-maintainers/tools
$ sudo apt-get update
$ sudo apt-get install linaro-image-tools

This should install all Linaro compiler tools and QEMU. Compiler tools should have the prefix arm-linux-gnueabi-

You will need to add this to your meta-config file:

$ cd c0meta
$ vim current/.config

# Add this line:
C0META_CROSS_COMPILE="arm-linux-gnueabi-"

Notes

Please do not try to compile Android AOSP release with Linaro compilers, or vice versa. Resulting systems may not work.

Further steps

Continue to Downloading the Source for information on how to download and build the Codezero system.