Howto - unpack,change,repack boot.img

Search This thread

tobr

Member
Dec 30, 2010
34
14
Hi, for those interested I wrote following steps (ubuntu 10.10 32b):
(based on excellent http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images )

I included compiled tools mkbootfs , mkbootimg and perl scripts unpack-bootimg.pl and repack-bootimg.pl.
Repack-bootimg.pl is edited and the needed parameters for our folio are included (mem=448M@0M nvmem=64M@448M vmalloc=192M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:122000:a00:800,linux:a0e00:1000:800,loader:300:400:800,mbr:700:200:800,system:900:20000:800,cache:20900:80000:800,misc:a0900:400:800,userdata:a1f00:80000:800 boardtype=PR)

1) unpack attachement mytools.tgz into your home, in your home the folder ~/mytools is created:
tar -xzf mytools.tgz

2) copy existing boot.img into ~/mytools (from foliomod update.zip)

3) ./unpack-bootimg.pl boot.img
- old kernel from boot.img is extracted: boot.img-kernel.gz
- content of contained ramdisk is extracted in folder: boot-img.ramdisk

4) copy new compiled kernel (zImage) into ~/mytools (from <source>/kernel/arch/arm/boot/zImage , you have to compile yourself with the weeds2000 quide http://xdaforums.com/showthread.php?p=10331797#post10331797)

5) make all desired changes into ramdisk folder

6) repack new boot.img with a new kernel and changed ramdisk
./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img

7) new boot image is created as boot-new.img

8) if you want just to experiment, you can take any full foliomod dexter's update.zip (1.3d), put the new boot image inside instead original one.
It is possible to remove the other 2 images (recovery and system) if you want just to flash kernel. NOTE! But you have to remove the extrating command for recovery and system from update.zip/meta-inf/com/google/android/update-script.

p.s. Feel free to correct me, if something wrong with the steps. It's my first attempt to compile kernel :)

I am on FolioMod 1.3d and I use the kernel built without patches from http://tegramid.com/wiki/Main_Page(Full GPL source bundle including framework) for a day without problems. I had to do a full wipe. It's meant for testing, I don't say that kernel from source is better or worse.

Many thanks to Dexter because everything is based on his release, weeds2000 because of his kernel compile quide and tsh who placed the sources on the git and to all who try hacking our folio :)
 

Attachments

  • mytools.zip
    20.3 KB · Views: 9,793
Last edited:

add.thebad

Senior Member
Apr 4, 2009
267
32
Lincoln UK
thanks for the guide.
i have managed to do every thing up to the repack

when i type
Code:
perl repack-bootimg.pl boot.img-kernel.gz boot.img-ramdisk.gz boot.img


i get error
Code:
boot.img-ramdisk.gz Not a directory at repack-bootimg.pl line 13.

even though it is definatly in their. any idea how to get it to work?
 

°EraZoR°

Member
Mar 2, 2011
32
5
You don't have to provide the folder instead of the packed Ramdisk-File!
Because this script is made doing changes in Ramdisk and kernel..
So you can change the scripts inside the boot.img-ramdisk folder and the script will repack and add it to the new boot.img!
 

yashuu

New member
Jun 9, 2011
2
0
permission denied

i have done everything as you said, but while using split_bootimg.pl i got "permission denied". please suggest me what to do?
 

Jon2555

Senior Member
Jan 17, 2011
789
242
Belgrade
1. Enable read/write permissions for that file.

2. Tobr, you made a mistake in repack-bootimg.pl. You forgot to add " ./ " before mkbootimg.
 

tobr

Member
Dec 30, 2010
34
14
1. Enable read/write permissions for that file.

2. Tobr, you made a mistake in repack-bootimg.pl. You forgot to add " ./ " before mkbootimg.
The script was downloaded from internet not written by me. And it worked for me just fine. I can not verify now that you are right (probably you are). If it works for you with ./ then either I can put fixed version for download for others (if there is anybody) or it can be here just as a notice for other users, if not working.
I have ./ defined in my path variable in my profile so that i don't need it.
 

khaksarrr

New member
Jan 6, 2011
4
0
eror when repack

Hi, for those interested I wrote following steps (ubuntu 10.10 32b):
(based on excellent http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images )

I included compiled tools mkbootfs , mkbootimg and perl scripts unpack-bootimg.pl and repack-bootimg.pl.
Repack-bootimg.pl is edited and the needed parameters for our folio are included (mem=448M@0M nvmem=64M@448M vmalloc=192M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:122000:a00:800,linux:a0e00:1000:800,loader:300:400:800,mbr:700:200:800,system:900:20000:800,cache:20900:80000:800,misc:a0900:400:800,userdata:a1f00:80000:800 boardtype=PR)

1) unpack attachement mytools.tgz into your home, in your home the folder ~/mytools is created:
tar -xzf mytools.tgz

2) copy existing boot.img into ~/mytools (from foliomod update.zip)

3) ./unpack-bootimg.pl boot.img
- old kernel from boot.img is extracted: boot.img-kernel.gz
- content of contained ramdisk is extracted in folder: boot-img.ramdisk

4) copy new compiled kernel (zImage) into ~/mytools (from <source>/kernel/arch/arm/boot/zImage , you have to compile yourself with the weeds2000 quide http://xdaforums.com/showthread.php?p=10331797#post10331797)

5) make all desired changes into ramdisk folder

6) repack new boot.img with a new kernel and changed ramdisk
./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img

7) new boot image is created as boot-new.img

8) if you want just to experiment, you can take any full foliomod dexter's update.zip (1.3d), put the new boot image inside instead original one.
It is possible to remove the other 2 images (recovery and system) if you want just to flash kernel. NOTE! But you have to remove the extrating command for recovery and system from update.zip/meta-inf/com/google/android/update-script.

p.s. Feel free to correct me, if something wrong with the steps. It's my first attempt to compile kernel :)

I am on FolioMod 1.3d and I use the kernel built without patches from http://tegramid.com/wiki/Main_Page(Full GPL source bundle including framework) for a day without problems. I had to do a full wipe. It's meant for testing, I don't say that kernel from source is better or worse.

Many thanks to Dexter because everything is based on his release, weeds2000 because of his kernel compile quide and tsh who placed the sources on the git and to all who try hacking our folio :)

hi
when do this in ubuntu 11.4
get eorr below

alireza@alireza:~/Desktop/untitled folder$ ./unpack-bootimg.pl boot.img

kernel written to boot.img-kernel.gz
ramdisk written to boot.img-ramdisk.cpio.gz
463 blocks

extracted ramdisk contents to directory boot.img-ramdisk/
alireza@alireza:~/Desktop/untitled folder$ ./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img
gzip: folder/ramdisk-repack.cpio.gz: No such file or directory
sh: mkbootimg: not found
No such file or directory at ./repack-bootimg.pl line 21.
alireza@alireza:~/Desktop/untitled folder
can any one help me?
 

dd_command

Member
May 21, 2014
17
2
Nottingham
repack problem

Can somebody tell me is it possible to repack kernel and ramdisk using just hex editor? Without this scripts and unmkbootimg and mkbootimg. What does not work for me cos im using i9100 Philz root. I know how to unpack it and change init.rc and pack it back again. So can i just put my (kernel+ramdisk) ramdisk.cpio.gz file inside mmcblk0p5 in exac location. Will that work out? I dont know what this is doing:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x20000000
--cmdline 'no_console_suspend=1' -o new_boot.img
this address thing and cmdline but if i replace just ramdisk i dont need to set up addres again cos everything will be in same place. And one more question if something goes wrong can i boot to recovery or download mode?

New kernel copied itself to mmcblk0p5
and i have new CWM now. So it seems to me recovery is inside mmcblk0p5 as well and my phone never use mmcblk0p6
 
Last edited:

Preet_

Senior Member
Mar 30, 2014
152
54
24
Mumbai
@tobr, I cannot open the archive of boot.img-kernel.gz. When I try to open it with terminal, it says: Not a valid gzip file. What to do?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    Hi, for those interested I wrote following steps (ubuntu 10.10 32b):
    (based on excellent http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images )

    I included compiled tools mkbootfs , mkbootimg and perl scripts unpack-bootimg.pl and repack-bootimg.pl.
    Repack-bootimg.pl is edited and the needed parameters for our folio are included (mem=448M@0M nvmem=64M@448M vmalloc=192M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:122000:a00:800,linux:a0e00:1000:800,loader:300:400:800,mbr:700:200:800,system:900:20000:800,cache:20900:80000:800,misc:a0900:400:800,userdata:a1f00:80000:800 boardtype=PR)

    1) unpack attachement mytools.tgz into your home, in your home the folder ~/mytools is created:
    tar -xzf mytools.tgz

    2) copy existing boot.img into ~/mytools (from foliomod update.zip)

    3) ./unpack-bootimg.pl boot.img
    - old kernel from boot.img is extracted: boot.img-kernel.gz
    - content of contained ramdisk is extracted in folder: boot-img.ramdisk

    4) copy new compiled kernel (zImage) into ~/mytools (from <source>/kernel/arch/arm/boot/zImage , you have to compile yourself with the weeds2000 quide http://xdaforums.com/showthread.php?p=10331797#post10331797)

    5) make all desired changes into ramdisk folder

    6) repack new boot.img with a new kernel and changed ramdisk
    ./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img

    7) new boot image is created as boot-new.img

    8) if you want just to experiment, you can take any full foliomod dexter's update.zip (1.3d), put the new boot image inside instead original one.
    It is possible to remove the other 2 images (recovery and system) if you want just to flash kernel. NOTE! But you have to remove the extrating command for recovery and system from update.zip/meta-inf/com/google/android/update-script.

    p.s. Feel free to correct me, if something wrong with the steps. It's my first attempt to compile kernel :)

    I am on FolioMod 1.3d and I use the kernel built without patches from http://tegramid.com/wiki/Main_Page(Full GPL source bundle including framework) for a day without problems. I had to do a full wipe. It's meant for testing, I don't say that kernel from source is better or worse.

    Many thanks to Dexter because everything is based on his release, weeds2000 because of his kernel compile quide and tsh who placed the sources on the git and to all who try hacking our folio :)