User:Arete74/Boot Android from SdCard

Boot Android From SdCard
For extract need file from android image, have need of awutils and android tools.

$ git clone https://github.com/Ithamar/awutils.git $ make

Extract file from Android Image
In this guide the name the Android Image is android.img $ awimage -u android.img

this command create an folder android.dump with many files. The three following files are the ones we are interested :

RFSFAT16_BOOT_00000000000 (the boot partition)

RFSFAT16_RECOVERY_0000000 (the recovery partition)

RFSFAT16_SYSTEM_000000000 (the system partition, ext4 sparse).

for simplicity rename: $ mv RFSFAT16_BOOT_00000000000 boot.img $ mv RFSFAT16_RECOVERY_0000000 recovery.img $ mv RFSFAT16_SYSTEM_000000000 system.img

Extract kernel and ramdisk
For extract kernel and boot ramdisk try this command:

$ ../tools/split_bootimg.pl boot.img Page size: 2048 (0x00000800) Kernel size: 4215036 (0x004050fc) Ramdisk size: 974998 (0x000ee096) Second size: 0 (0x00000000) Board name: Command line: console=ttyS0,115200 rw init=/init loglevel=5 Writing boot.img-kernel ... complete. Writing boot.img-ramdisk.gz ... complete.

decompress the ramdisk data $ mkdir boot $ cd boot $ gunzip -c ../boot.img-ramdisk.gz | cpio -i $ tar -cpvf ../boot.tar *

Convert kernel to uImage $ mkimage -A arm -O linux -T kernel -a 0x40008000 -e 0x40008000 -n "Linux 2.6" -d boot.img-kernel uImage

Extract system image
$ ../tools/simg2img system.img system1.img $ mkdir system $ sudo mount -o loop system1.img system $ cd system $ tar -cpvf ../system.tar * $ cd .. $ umount system

Extract recovery image
$ ../tools/split_bootimg.pl recovery.img Page size: 2048 (0x00000800) Kernel size: 4215036 (0x004050fc) Ramdisk size: 974998 (0x000ee096) Second size: 0 (0x00000000) Board name: Command line: console=ttyS0,115200 rw init=/init loglevel=5 Writing recovery.img-kernel ... complete. Writing recovery.img-ramdisk.gz ... complete.

decompress the ramdisk data $ mkdir recovery $ cd recovery $ gunzip -c ../recovery.img-ramdisk.gz | cpio -i $ tar -cpvf ../recovery.tar *

SdCard Partition
Partitions description (todo : table)

First identify the device of the card and export it as $card.

$ card=/dev/sdc

$ dd if=/dev/zero of=$card bs=1M count=1 $ sfdisk -R $card $ cat <<EOT | sfdisk --in-order -uM $card /dev/sdc1 : start=   32768, size=    32769, Id=83 /dev/sdc2 : start=   65537, size=    62604, Id=83 /dev/sdc3 : start=  128141, size=  1000110, Id=83 /dev/sdc4 : start= 1128251, size= 30163141, Id= 5 /dev/sdc5 : start= 1128254, size=  7999989, Id=83 /dev/sdc6 : start= 9128246, size=    31299, Id=83 /dev/sdc7 : start= 9159577, size=    63456, Id=83 /dev/sdc8 : start= 9223065, size=   249824, Id=83 /dev/sdc9 : start= 9472921, size=    30688, Id=83 /dev/sdc10: start= 9503641, size=  6061159, Id=83 EOT