[XPERIA X8 Android Development] pulpoff:
Cooking custom rom for X8

Greetings all,

I will post these tips for those willing to repeat the success of custom roms on the X10i.

You can find a few X10i forums where they have cooked cyanogen rom.

To cook the new 2.1/2.2 rom, use standard kitchen from this link :

Cooker guide

You can start with HTC Legend template, but than modifications to .mk file are required.

Finally all the binary libs and custom files should be added to the rom, than cook it.

Once cooked (took 50min on dual P4-3Ghz machine), you get update.zip, system.img and boot.img files.

I've been playing with .zip files and noticed they don't have file permissions kept.

So the one to use is system.img, you can extract files from it with unyaffs tool (google it, its free).

If you extract files under unix (Linux/MacOS) file permissions will be kept and files are ready to be copied to the phone.

It's quite annoying to flash phone every time you made a mistake, so first make sure you prepare your X8 to boot from sdcard.

To boot from sdcard, we need to hijack the boot process from sony and mount our own /system and /data partitions.

After booting kernel, X8 runs the init.rc script that loads up Android.

Before the start, it checks if phone is off and plugged to charge (you probably saw this feature when phone is switched off on charge and screen shows battery animation)

This check is called chargemon, and its /system/bin/chargemon.

We can replace this file with a script.

Prepare the card like this :

1. FAT partition (fat16/fat32), 100MB or more

2. /system partition EXT2, 512MB

3. /data partition EXT2, 512MB

Once partitioning is done, mount the 2nd and 3rd partition on the phone and copy files over :

mkdir /data/local/tmp/1

mount -t ext2 /dev/block/mmcblk0p2 /data/local/tmp/1

busybox cp -rp /system/* /data/local/tmp/1/

umount /data/local/tmp/1

mount -t ext2 /dev/block/mmcblk0p3 /data/local/tmp/1

busybox cp -rp /data/* /data/local/tmp/1/

umount /data/local/tmp/1

This script will make phone mount /system and /data partitions from the sdcard :

chargemon:

#!/system/bin/sh

# Mount system and data @SD card

/system/bin/e2fsck -y /dev/block/mmcblk0p3

/system/bin/mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p3 /data

/system/bin/e2fsck -y /dev/block/mmcblk0p2

/system/bin/mount -t ext2 -o rw,noatime,nodiratime /dev/block/mmcblk0p2 /system

create file chargemon, chmod it 755 and put in /system/bin/

You should also put e2fsck from CM Legend rom in /system/bin/ and ext2 libs that it needs into /system/lib/, or put a # before checks if you don't care :)

If sdcard is not present, phone will boot in normal way, and with sdcard inside you can boot your custom rom or modified standard system (for example with lots of installed apps and custom framework/fonts/...)

I hope this helps someone with more time, as I don't have much experience cooking roms.

Summary

1. Kernel can't be changed until bootloader is hacked, so we have to stick with 2.6.29.

2. Boot process can be hijacked by modifying files called from init.rc script.

3. We can boot anything from the sdcard

P.S. if you have little idea what this is about, better wait and don't bother.