[TOOL] Boot.img tools [unpack, repack, ramdisk]

Search This thread
M

mantalamo

Guest
Beginner me

are these tools would be enough to edit/modify something in the boot.img? This will be my first attempt. My purpose is to change the boot splash image of a Kernel. With my intent to use this tool, would these suffice my needs? Thanks
 

oldsoldier2003

Senior Member
Jun 30, 2012
133
57
Eldorado
Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.
I suspect they were compiled on Ubuntu since Debian stable (wheezy as of this writing) uses an older version of glibc which causes mkbootimg to choke. Debian users will need to upgrade to testing/Jessie (swapping libc is not advisable, it is just better to go with Jessie)
 
  • Like
Reactions: ShinySide

oldsoldier2003

Senior Member
Jun 30, 2012
133
57
Eldorado
I suspect they were compiled on Ubuntu since Debian stable (wheezy as of this writing) uses an older version of glibc which causes mkbootimg to choke. Debian users will need to upgrade to testing/Jessie (swapping libc is not advisable, it is just better to go with Jessie)

Update:
These tools work great on Debian Jessie/SID

I forgot to mention this for folks that are Debian users. Thanks for making these tools accessible to the masses :)
 

oldsoldier2003

Senior Member
Jun 30, 2012
133
57
Eldorado
These tools are command line tools you run them from a terminal. See the first part for usage

Sent from my XT1031 using XDA Premium 4 mobile app
 

ShinySide

Inactive Recognized Developer
Nov 30, 2013
3,951
4,780
IHB
I suspect they were compiled on Ubuntu since Debian stable (wheezy as of this writing) uses an older version of glibc which causes mkbootimg to choke. Debian users will need to upgrade to testing/Jessie (swapping libc is not advisable, it is just better to go with Jessie)

God I need to start reading posts more often.... Thanks for the tip....
 

nasr18

Member
Dec 3, 2013
28
2
Tirunelveli
I have not seen this posted anywhere, so I thought I would post it here. This is NOT purely my work, and I do not take credit for it as such.

Included in the attached ZIP are the following files:

  • boot_info - prints information about the boot.img passed to it, including the base address and ramdisk address. This tool prints out everything needed to repack the boot.img correctly.
  • split_boot - More commonly known as split_bootimg.pl, this rips apart the boot.img to extract the ramdisk and zImage. It has been modified by me to split the boot.img into a separate folder (specified by the file name of the boot.img passed to it) and to extract the ramdisk into a sub-folder as well (extracts the cpio from the gz and then extracts the actual files from the cpio archive)
  • unpack_ramdisk - unpacks the given ramdisk file.
    Code:
    Usage: unpack_ramdisk <ramdiskFile>
  • repack_ramdisk - repacks the ramdisk from the given directory (found online and modified slightly to take a directory)
    Code:
    Usage: repack_ramdisk <ramdiskDirectory> [outputFile]
  • mkbootimg - mkbootimg binary that creates a boot.img file from the given ramdisk and zImage. Updated to a version compiled by me to support the --ramdiskaddr option (ramdisk address) so that even nonstandard boot.img's can be repacked correctly (Use with boot_info for best results).
  • umkbootimg - included for convenience. Not made by me. Original thread here.
  • unpack - wrapper script made by me for the umkbootimg binary^ to unpack the boot.img into a separate directory and then unpack the ramdisk into a sub-directory.

Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.

ANYONE is free to use / modify / kang these files as they see fit. No need to ever ask or do anything more than download.

Enjoy.


bro I'm having ur file, but don't know how to run. please say it elaborately for me.

hope you will reply.
 

m9j_cfALt

Member
Oct 4, 2013
19
19
Didwana
better tool than urs..
no need of cygwin.. perl interpreter
with GUI.. for windows.. tiny and fast..

xdaforums.com/general/general/tool-abime-android-boot-image-editor-t2847426
 

m9j_cfALt

Member
Oct 4, 2013
19
19
Didwana
And shameful. And rude

Sent from my SPH-L710 using Tapatalk

i know i dont know how to write without being rude..
i just wrote the comment.. and thought over and over whole the night why did i wrote in such language..
im feeling guilty.. apologize..
btw.. ur tool is mother of mine.. and i learned lot from it..

honestly... Manoj Bhakar PCM(m9j_cfALt)
 

mikeymopar

Senior Member
Jan 14, 2011
447
922
a little stuck on mkbootimg

hi guys...i need a little help please.
unpack works perfectly and it displays (among other things):
Code:
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0xFE208100
OFF_RAMDISK_ADDR is 0x00200100
OFF_SECOND_ADDR is 0xFF100100
Please modify mkbootimg.c using the above values to build your image.
where do i enter those values. i'm guessing the mkbootimg command line but where and how is it worded.

repack_ramdisk works as advertised giving new-ramdisk.cpio.gz. but then using mkbootimg with what unpack displays as shown above (without trying to add the non-standard addr values yet just to see if it works)
Code:
To recompile this image, use:
  mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3' -o new_boot.img
i get this error all the time
Code:
mike@mike-VirtualBox:/usr/local/bin/kernels$ mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3' -o new_boot.img
bash: /usr/local/bin/kernels/mkbootimg: cannot execute binary file: Exec format error
before using mkbootimg do zImage and new-ramdisk.clio.gz need to be moved into a separate folder or renamed or...or.......:confused:
(i'm using lubuntu. all the first steps of this kernel tool work perfect. i couldn't get mkbootimg to work for the life of me over the last two nights)
THANKS for any help/suggestions!!!:cool:
 

Top Liked Posts

  • There are no posts matching your filters.
  • 182
    I have not seen this posted anywhere, so I thought I would post it here. This is NOT purely my work, and I do not take credit for it as such.

    Included in the attached ZIP are the following files:

    • boot_info - prints information about the boot.img passed to it, including the base address and ramdisk address. This tool prints out everything needed to repack the boot.img correctly.
    • split_boot - More commonly known as split_bootimg.pl, this rips apart the boot.img to extract the ramdisk and zImage. It has been modified by me to split the boot.img into a separate folder (specified by the file name of the boot.img passed to it) and to extract the ramdisk into a sub-folder as well (extracts the cpio from the gz and then extracts the actual files from the cpio archive)
    • unpack_ramdisk - unpacks the given ramdisk file.
      Code:
      Usage: unpack_ramdisk <ramdiskFile>
    • repack_ramdisk - repacks the ramdisk from the given directory (found online and modified slightly to take a directory)
      Code:
      Usage: repack_ramdisk <ramdiskDirectory> [outputFile]
    • mkbootimg - mkbootimg binary that creates a boot.img file from the given ramdisk and zImage. Updated to a version compiled by me to support the --ramdiskaddr option (ramdisk address) so that even nonstandard boot.img's can be repacked correctly (Use with boot_info for best results).
    • umkbootimg - included for convenience. Not made by me. Original thread here.
    • unpack - wrapper script made by me for the umkbootimg binary^ to unpack the boot.img into a separate directory and then unpack the ramdisk into a sub-directory.

    Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.

    ANYONE is free to use / modify / kang these files as they see fit. No need to ever ask or do anything more than download.

    Enjoy.
    14
    Updated tools with a new boot_info script, also added my own mkbootimg binary compiled with the ramdisk address option.

    Boot_info now displays the following information:
    Commandline
    Pagesize
    Base address
    Ramdisk address.

    Which is everything you need to make a functional boot.img, even when the original boot.img is packed with a non-standard mkbootimg (ie, the ramdisk offset is different than the normal offset).
    13
    UPDATE: If you downloaded, please redownload. There was an error with my repack_ramdisk script, but it's fixed now.
    6
    All the scripts must be in a folder in your path (~/bin for example)

    Then it should work, because they call on each other. I keep all of them in my ~/bin folder, but they can be anywhere in your PATH

    Sent from my buttered S3
    3
    How exactly do we use these files to unpack and repack?
    I've tried running the scripts with chmod at 755 but it doesn't work.
    I am i missing something?