After successfully building the Android OS, and flashing to the Galaxy Nexus, I've started investigating how it all hangs together. Starting with the boot.img, and unpacking the parts; header, kernel, and ramdisk. The structure is explained in detail on the Wiki, but also in the source for building the boot.img file.

As mentioned on the Wiki, and seen in the source, the page size can be 2048 or 4096 bytes, with the former the default. The header, which is rather boring, containing only a "magic string" ("ANDROID!") and a checksum takes up the first page of 2048 bytes. It can be separated from a boot.img with the following command:

dd bs=2048 if=boot.img of=header count=1

Next up is the kernel. I've yet to find a way to determine its size, however you could go looking for white space padding and then round up to the nearest 2048 bytes. (Also, magic bytes (1F 8B) of the gzipped ramdisk will provide a clue.) In my case, I "cheated" and looked at the size of the kernel file under out/target/product/maguro. It turned out to take 1912 pages, so we can separate it by the following command (skipping the header part):

dd bs=2048 if=boot.img of=kernel skip=1 count=1912

Then it's only the ramdisk filesystem left (there's no "second stage" section in use). It will take the rest of the size of the file, which came down to 158 pages in my case:

dd bs=2048 if=boot.img of=ramdisk skip=1913 count=158

The ramdisk is a gziped, cpio packed archive, which can be extracted into its own directory by
mkdir ram
cd ram
gunzip -c ../ramdisk | cpio -i

That should give you the following files and directories


For more about the Android boot process, and kernel, look at the Embedded Linux Wiki.

As seen from the files above, the charger icons displayed when the phone is charging while off is plain PNG images. Might be fun to change. Furthermore, the initial splash screen logo can be changed by adding a file called initlogo.rle to the root directory of the ramdisk. Might try that next.