Create Android Images

To boot the Android userland on top of L4Android you need to create disk images of the root and the system file system. If you have configured ext4 support into your L4Android kernel, you can take the system.img created by the Android build system directly. However we recommend using a cramfs image as it is significantly smaller.

Root File System Image

You need to build a small root file system image. First you create a file which contains device nodes to be created. After creating the actual image you need to adapt the init script to our setup.

somedir$ cd /path/to/android/src/out/target/product/generic_x86
generic_x86$ cat << EOL > devfile
> /l4bdds0 b 755 0 0 254 0 - - -
> /l4bdds1 b 755 0 0 254 1 - - -
> /l4bdds2 b 755 0 0 254 2 - - -
generic_x86$ genext2fs -b 1024 -D devfile -d root/ root-x86-ginger.img

Next we need to modify the init.rc script. Mount the newly created image and locate the section where the system and data partition are to be mounted and replace the commands with the lines following the mount

generic_x86$ mount root-x86-ginger.img <mnt> -o loop
mount cramfs /l4bdds0 /system
mount cramfs /l4bdds0 /system ro remount
mount tmpfs tmpfs /data size=32M

Save your changes and unmount the image

generic_x86$ umount <mnt>
generic_x86$ gzip -9 root-x86-ginger.img

Gzipping the image is not required but it can save you a few hundred kilobytes.

System File System Image

Creating the system image is easy

generic_x86$ mkfs.cramfs system/ system-x86-ginger.img