Open Devices

For some of the Xperia™ devices, we provide Android™ Open Source Project (AOSP) device configurations on GitHub. This means that the software will be open for you as a developer to use and contribute to. This is a way for us to support the open Android community, and it is also a tool for us to facilitate and verify contributions to AOSP.

Build basic Linux environment for development – Buildroot for Xperia

Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems. We can utilize this to build a simple environment for supporting and testing our kernel during development on Xperia devices. Read more about Buildroot on wikipedia.

How to build a basic Linux environment for development – Buildroot for Xperia

1. Download buildroot

The releases of the buildroot system can be downloaded from:

  1. Download the sourcecode:
  1. Unpack the buildroot package into a new directory:
tar -xzf buildroot-2015.08.1.tar.gz

2. Configuration

The buildroot tool uses “make” and the Kbuild system to configure and build the resulting system. To configure what components should be included in the image we can use the menuconfig – which should be familiar to kernel developers.

  1. To launch menuconfig, run
make menuconfig
  1. Under “Target options” we need the following: Target Architecture = ARM (little endian) Target Architecture Variant = cortex-A9 Enable NEON and select that as “Floating point strategy”
  1. Under “Filesystem images”, select how the resulting system image should be packed. Select the two options:“cpio the root filesystem” “ext2/3/4 root filesystem” (and select “ext4” as variant).

3. Building

Once the configuration options has been selected, build the images by executing:


The result

Once make finishes successfully the configured output results can be found in the folder:


The cpio archive can be used as a ramdisk for mkbootimg (learn more in the guide How to build Linux mainline kernel for Xperia devices):

mkbootimg … --ramdisk output/images/rootfs.cpio ...

However, the size of the ramdisk is restricted by the size of the boot partition, so once more components are compiled in we need to flash the ext4 image in one of the partitions.

fastboot flash system output/images/rootfs.ext4

We can either use this partition directly or via an ramdisk that uses pivot_root. As we have working eMMC we can use the former for now. To do this we need to add an empty ramdisk to our boot.img and specify the partition as root on the kernel command line:

dd if=/dev/zero of=dummy.img bs=4096 count=1

  mkbootimg … --ramdisk dummy.img ...

To configure the Linux kernel to wait for the eMMC to become ready and use the “system” partition as root filesystem, use:

root=/dev/mmcblk0p25 rootwait

Make sure to replace “25” with the partition number for the “system” partition on your device.

This will provide a basic Linux environment that can be used for testing new kernel features.