• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [Without PC] Unpack, Edit, Repack boot.img

hi . i did all the things as u said. but problem is when i try to rebuild then it says --ramdisk not found. is there something wrong ? ramdisk folder permission is rwxrwrwx but inside that folder all permissions are --rwxr-x . is there problem with permission ?? actually my frnd has same device micromax a51 bolt. but his phone boots into revovery and my phone dosnt boot in recovery. so i replaced all files from his recovery.img > ramdisk to mine. can u help me ?
 
Upvote 0
hi . i did all the things as u said. but problem is when i try to rebuild then it says --ramdisk not found. is there something wrong ? ramdisk folder permission is rwxrwrwx but inside that folder all permissions are --rwxr-x . is there problem with permission ?? actually my frnd has same device micromax a51 bolt. but his phone boots into revovery and my phone dosnt boot in recovery. so i replaced all files from his recovery.img > ramdisk to mine. can u help me ?

When you unpack your boot.img you will have 'ramdisk.cpio.gz' and a 'kernel' file.

Create a folder and call it, ramdisk. Then change directories to that ramdisk folder. Run the following:
Code:
gunzip -c ../ramdisk.cpio.gz | cpio -i

That will unpack all the contents inside of your ramdisk over in to your ramdisk folder. When you are ready to rebuild your ramdisk you must back out of your ramdisk folder and be located where your 'kernel' file is. Then run the following:
Code:
mkbootfs ./ramdisk | gzip > ramdisk.gz
This will pull all contents from within your ramdisk folder and pack them all together.

Then in the same directory run and enter mkbootimg as instructed in the op.
 
  • Like
Reactions: pritsgunday
Upvote 0
Hello friends, I'm back again with something I wish to share with you all. I have compiled three files to work flawlessly for ARM devices which will allow users to unpack, edit, and repack their boot.img without the use of a PC and all straight from their device.

---unmkbootimg, mkbootfs, mkbootimg---

If you would like the source then leave a request here and I will PM it to you.​

Note:
-- The mkbootimg binary is based upon the AOSP with some added modifications to work in conjunction with unmkbootimg.
-- The unmkbootimg binary is based on the original mkbootimg source but with reverse engineering to compliment its helpful use in extraction and thus providing the needed command to rebuild properly.
-- The mkbootfs binary is based on the source provided within the dsixda kitchen to insure the proper structural repacking of the ramdisk, etc.


Requirements:
-- BusyBox (cpio, gunzip and gzip is mandatory)
-- /System Write Permissions (Does not need to be a modified kernel)
-- Terminal Emulator
-- ES File Explorer (or similar)
-- Hex Editor (or use of DD)

-- Unzip boot_manipulation.zip on your device and copy the three files over to /system/bin. Those three files inside the .zip will be named unmkbootimg, mkbootfs and mkbootimg.
-- EDIT: I have included a flashable zip for these files.
-- Set permissions to rwxr-xr-x (755) on each binary. Note: The flash zip does this already.

-- Open up your android terminal emulator.

-- Now go ahead and pull your boot.img from your device (or use another one if you wish). Here is an example:
Code:
root@android:/ # [COLOR="Red"]dd if=/dev/block/mmcblk0p20 of=/data/local/tmp/boot.img[/COLOR]
dd if=/dev/block/mmcblk0p20 of=/data/local/tmp/boot.img
32768+0 records in
32768+0 records out
16777216 bytes transferred in 1.496 secs (11214716 bytes/sec)
root@android:/ #

-- Open up your boot.img with the Hex Editor and look for: ANDROID!. Remove everything before it so that the ANDROID! header is the first to be read then save it over top of the boot.img. NOTE: This is only required if you are using a stock boot.img. Here is an example:
Code:
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000  [COLOR="red"]A5 F0 BA B7 B0 43 E3 F8 3C E1 63 55 AE 75 C6 69
 
Upvote 0
hi i am facing another problem :( i followed all steps for recovery.img and after creating modrecovery.img, i mereged this modrecovery.img tp mtdblock10 (my recovery partition) by this command : cat /sdcard/modrecovery.img > /dev/block/mtdblock10 and it was successful. ok now i edited my boot.img and created modboot.img . placed this modboot.img to sdcard and tried to merge this in my boot partition i.e. mtdblock9 by this command : cat /sdcard/modboot.img > /dev/block/mtdblock9 but it says that
write : operation not permitted . what to do now ?

Flash it with fastboot.
Code:
fastboot flash boot boot.img
 
Upvote 0
Then try using the command dd.

Code:
dd if=/sdcard/modboot.img of=/dev/block/mtdblock9

If that fails then you will need to write an updater script which will push the image to your partition by use of a flashable zip.

thanks a lot for your time. i am angry because i bought micromax a51 bolt. worst mobile ever. thanks a lot but anything not supported in this device. flashtype of this device is not recognized. thanks a lot. :) dont waste time on me :thinking::thinking::thinking::thinking: :(
 
Upvote 0
thanks a lot for your time. i am angry because i bought micromax a51 bolt. worst mobile ever. thanks a lot but anything not supported in this device. flashtype of this device is not recognized. thanks a lot. :) dont waste time on me :thinking::thinking::thinking::thinking: :(

Does your device have a custom recovery? If it does, I can make you a flashable zip really quick. All you will need to do is put the modboot.img at the root of the zip and then boot into your custom recovery to write it to your partition. Your device has to be able in some way write the partition. How else would your device even have a Rom to begin with ;-)
 
  • Like
Reactions: pritsgunday
Upvote 0
Does your device have a custom recovery? If it does, I can make you a flashable zip really quick. All you will need to do is put the modboot.img at the root of the zip and then boot into your custom recovery to write it to your partition. Your device has to be able in some way write the partition. How else would your device even have a Rom to begin with ;-)

Hi. Thanks a lot for ur reply and thanks a lot for giving ur precious time to me. 1st of all let me tell u about this shit device. This device is based on broadcom process. No custom recovery is released yet. M also trying to port cwm in this device. This device config is very typical. Only 151 mb ram is the main drawback of this device and kernel dont support swap. Its all waste of time. M going to buy new device. My rating for this is 0 out of 100. Thanks for ur time :(
 
Upvote 0
Hi. Thanks a lot for ur reply and thanks a lot for giving ur precious time to me. 1st of all let me tell u about this shit device. This device is based on broadcom process. No custom recovery is released yet. M also trying to port cwm in this device. This device config is very typical. Only 151 mb ram is the main drawback of this device and kernel dont support swap. Its all waste of time. M going to buy new device. My rating for this is 0 out of 100. Thanks for ur time :(

Ah, well good luck my friend. And yea, would be easier with a custom recovery. As for the situation with you not having permissions to write to the partition... That is due to write protection which can most likely be found in the kernel source. However, waste of time fixing that if you don't even have a custom recovery to work with lol.

However, it is possible to write to your partitions using the stock recovery. You just need to review your devices OTA updater-script to see what exactly it is doing when pushing firmware files, etc. You can use that same method to bypass your write protection theoretically speaking of course. Though, there will be limitations with this method. For example, you can root your device using a stock recovery. Don't even need a custom recovery to do it. Many people think you do, but that is completely false information ;-).

I could restore my device right now to complete stock and still root it :).
 
Upvote 0
:) i will try this too. by the way this process of unpack and repack is awesome. i think there is some problem in my partition. i edited recovery.img and copied it to mtdblock10 . it was successful. but boot.img cant be written to mtdblock9 ok. today i reflashed my device. and rooted it. and again tried to copy recovery.img to mtdblock10 but this it was not successful. i will have to go deeply grrrr :-D lol thanks a lot by the way. the main problem is. there is no forum anywhere for this device :(
 
Upvote 0
my device right now to complete stock and still root it :).

HI friend. I just enabled the write permission for boot and recovery partition by xml editing in firmware file. Ok i just want a little help, why my device dont show recovery menu in recovery mode ? My friend has same device but when he boot his device in recovery mode by pressing volume up power key and home touch then he can access recovery menu. Even we r 5 frnds and only his device shows recovery menu. Any idea ??
 
Upvote 0
HI friend. I just enabled the write permission for boot and recovery partition by xml editing in firmware file. Ok i just want a little help, why my device dont show recovery menu in recovery mode ? My friend has same device but when he boot his device in recovery mode by pressing volume up power key and home touch then he can access recovery menu. Even we r 5 frnds and only his device shows recovery menu. Any idea ??

Use the same recovery he has then if the devices are identical.

I really can't help you there. That comes down to something which is most likely a user error.
 
Upvote 0
Thank you for this ModdingMyMind! May I have help please- I've followed your instructions and having trouble extracting ramdisk.cpio.gz to ramdisk folder, I'm not sure if the commands using are correct. Nothing is extracted, here's what I did;
3ygyqeze.jpg

Can I have commands needed to successfully extract?
 
Upvote 0
Thank you for this ModdingMyMind! May I have help please- I've followed your instructions and having trouble extracting ramdisk.cpio.gz to ramdisk folder, I'm not sure if the commands using are correct. Nothing is extracted, here's what I did;
3ygyqeze.jpg

Can I have commands needed to successfully extract?

You used too many commands when piping them in.

It should be as follows:

Code:
cd ramdisk

Then;

Code:
gunzip -c ../ramdisk.cpio.gz | cpio -i
 
  • Like
Reactions: phan9998
Upvote 0
I'm having trouble again, I thought it would be a good idea to replace the boot.img in a custom rom and flash it. Nope, hung at splash screen. I read that the binaries need to be executed from /system partition, is it okay to do unpacking and rebuilding on sdcard? I only added 2 lines in default.prop, so I didn't make extensive changes. How can I write it straight in, it's at dev/block/mmcblk0p23?
 
Upvote 0
I'm having trouble again, I thought it would be a good idea to replace the boot.img in a custom rom and flash it. Nope, hung at splash screen. I read that the binaries need to be executed from /system partition, is it okay to do unpacking and rebuilding on sdcard? I only added 2 lines in default.prop, so I didn't make extensive changes. How can I write it straight in, it's at dev/block/mmcblk0p23?

You can use dd or cat.

An example for both. The example assumes the boot.img is located in the sdcard.

Code:
dd if=/sdcard/boot.img of=/dev/block/mmcblk0p23

Code:
cat /sdcard/boot.img > /dev/block/mmcblk0p23
 
  • Like
Reactions: phan9998
Upvote 0
Also, the stock cpio applet caused me problems when building the images. The busybox link I provided in the OP uses a cpio applet that is better built and does not cause issues when unpacking the ramdisk and such. Also, if you unpack your twrp recovery you can grab that busybox as well as that cpio works properly too.
 
Upvote 0
Here's couple screenies
aqy8u6y8.jpg

u4asuha9.jpg

You are using a flashable zip that places your boot.img in to your tmp directory, then it unpacks that boot.img and swaps out the original kernel image with another prebuilt kernel image that came packaged inside the flashable zip, also placed in the tmp directory. Then it rebuilds the boot.img using the other kernel and finally writes it to your boot partition.

It's Anykernel that you are using needless to say. I had to debunk that zip for my device because it just did not want to work and decided to write my own called, MyMinds_Kernel_Swap. Uses my own static precompiled binaries and a pretty legit script.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones