Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to see the content in a boot.img file from an Android image.

I googled and got http://javigon.com/category/development-tools/ to extract system.img. But it doesn't work for boot.img. When trying to do this for boot.img, it is showing the following:

Invalid sparse file format at header magi
Failed to read sparse file

Is simg2img used only for extracting system.img?

  1. If so, Is there any other method to extract boot.img?
  2. If not, what is the problem for not extracting boot.img?
share|improve this question
    
please identify the specific linux distribution and the kernel version. –  mdpc Feb 13 '13 at 20:53

2 Answers 2

up vote 4 down vote accepted

boot.img is a small(ish) file that contain two main parts.

          * kernel(important for android)
          * ramdisk( a core set of instruction & binaries)

Unpack boot.img:

It contains the following steps:

  1. Download the tool using wget http://android-serialport-api.googlecode.com/files/android_bootimg_tools.tar.gz

  2. Extract the file using tar xvzf android_bootimg_tools.tar.gz.

    It contains two binaries:

           * unpackbootimg
           * mkbootimg
    

3.Then execute ./unpackbootimg -i <filename.img> -o <output_path>

It will contain,

           * boot.img-zImage     ----> kernel
           * boot.img-ramdisk.gz ----> ramdisk

We can extract ramdisk also, using the following command

gunzip -c boot.img-ramdisk.gz | cpio -i

After changing the files, we can again pack those files as boot.img using mkbootimg

Have fun!

share|improve this answer
    
I am getting error at third step please help me...the terminal says unpackbootimg command not found –  Rahul Matte Jun 17 at 10:04

boot.img is not a compressed filesystem image like system.img. It is read by the bootloader, and contains little more than a kernel image and a ramdisk image.

Some binary distribution ship the kernel and ramdisk images separately. In that case you don't need to do anything with boot.img, just regenerate a new one with mkbootimg.

If you need to extract information from a boot.img, try split_bootimg (by William Enck, via the Android wiki).

share|improve this answer
    
The link to split_bootimg is no longer valid. –  Nathan Osman Sep 28 '13 at 3:19
    
@NathanOsman Replaced by a link to the copy on William Enck's page. –  Gilles Sep 28 '13 at 10:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.