Saturday, 10 November 2012

How to SPLIT BOOT.IMG file into kernel and ramdisk.gz (Android)

This article shows how to split a boot.img file into kernel and ramdisk parts.

In Android systems kernel and initial ramdisk filesystem are usually joined into an only file, named boot.img, and flashed into the device.

Recover image files have same structure too.

mkbootimg is the tool which builds a boot.img file from its kernel and ramdisk parts.

Boot.img file could also contain a second filesystem within it.

Split boot.img file using a python script

Copy code at the end of this article in a file named

Then execute (you need to already have a boot.img file):
$ python -i boot.img -o parts # This splits boot.img, create parts directory and stores there zImage (kernel) and ramdisk.gz.