I have pulled boot.img from my phone's CWM backup. How do I extract it? I tried split_bootimg.pl. But throws an error -
Android Magic not found in boot.img. Giving up.
I have pulled boot.img from my phone's CWM backup. How do I extract it? I tried split_bootimg.pl. But throws an error -
Android Magic not found in boot.img. Giving up.
After reading the comment, I spotted the error...
anirudh@Kat ~/Downloads/mkboot $ ./unpack-bootimg.pl /home/anirudh/Downloads/boot.img-tools/source_img/boot.img kernel written to /home/anirudh/Downloads/boot.img-tools/source_img/boot.img-kernel.gz ramdisk written to /home/anirudh/Downloads/boot.img-tools/source_img/boot.img-ramdisk.cpio.gz gzip: ..//home/anirudh/Downloads/boot.img-tools/source_img/boot.img-ramdisk.cpio.gz: No such file or directory cpio: premature end of archive extracted ramdisk contents to directory /home/anirudh/Downloads/boot.img-tools/source_img/boot.img-ramdisk/
For the boot.img-ramdisk.cpio.gz
- this needs special handling... try this:
gzip -dc boot.img-ramdisk.cpio.gz | cpio -i
The way to do it is after unpacking the boot.img
, create a directory called something like ramdisk
, go into that directory and use gzip -dc ../boot.img-ramdisk.cpio.gz | cpio -i
, the reason is, to organize the structure and files with minimum clutter.
gzip
decompresses the ramdisk archive to stdout
, pipe it into cpio
with the -i
switch to read from stdin
and it will correctly extract the data.
To do the reverse, say after making a change here and there within the ramdisk
directory:
mkbootfs ramdisk/ | gzip > my_new_ramdisk.gz
kernel written to /home/anirudh/Downloads/boot.img-tools/source_img/boot.img-kernel.gz ramdisk written to /home/anirudh/Downloads/boot.img-tools/source_img/boot.img-ramdisk.cpio.gz gzip: ..//home/anirudh/Downloads/boot.img-tools/source_img/boot.img-ramdisk.cpio.gz: No such file or directory cpio: premature end of archive
extracted ramdisk contents to directory /home/anirudh/Downloads/boot.img-tools/source_img/boot.img-ramdisk/
– Anirudh Jul 20 '12 at 14:55boot.img
for ROM porting? – WhiteWinterWolf Aug 11 '16 at 15:38