FORUMS

[TOOL] Android Image Kitchen - Unpack/Repack Kernel Ramdisk [Win/Android/Linux/Mac]

14,178 posts
Thanks Meter: 31,653
 
By osm0sis, Senior Recognized Developer / Recognized Contributor on 30th December 2012, 03:55 PM
Post Reply Email Thread
12th March 2014, 10:52 PM |#271  
bgcngm's Avatar
Recognized Developer
Flag Lisbon
Thanks Meter: 20,283
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

Apparently MTK has their own special splitter tool which is required for it. Deviates too much from the standard. Case closed.

If you want you can update the first post with a solution for MT65xx/MT83xx images unpacking/repacking.
The Following User Says Thank You to bgcngm For This Useful Post: [ View ]
24th March 2014, 02:58 AM |#272  
osm0sis's Avatar
OP Senior Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,653
 
Donate to Me
More
Android ARM/ARM64, x86/x86_64 + MIPS/MIPS64 version of Android Image Kitchen! Now you can easily modify ramdisks on the go!

AIK-mobile:
- Almost complete feature parity with the Windows/Linux version, including compression support, --original to repack with the original ramdisk, --origsize to pad the repacked image to the size of the original, --level to change the compression level of the repacked ramdisk, --avbkey to change the key used for Android Verified Boot (AVBv1) signing of the repacked image, and --forceelf to make an older unpacked Sony ELF file repack as an ELF. The only thing missing is --local since AIK-mobile's ability to unpack/repack while booted in Android is too complex to easily allow moving the unpack/repack directory around.
- The flashable zip installs AIK for your Android architecture (ARM/ARM64, x86/x86_64, MIPS/MIPS64) to /data/local/AIK-mobile/ and a helper script created at /system/xbin/aik (alternately /su/bin/aik or /sbin/supersu/bin/aik if SuperSU systemless root is detected, or, /sbin/.magisk/img/aik-mobile/bin/aik or /data/adb/modules/aik-mobile/bin/aik if Magisk is detected).
- Type "aik" in Terminal Emulator to automatically go to the install directory and get a root prompt, then use, eg. "unpackimg.sh boot.img" to get started.
- Running su -c "/data/local/AIK-mobile/bin/aik --restore" will recreate the aik helper script in the appropriate place (see above), e.g. after a ROM flash with su.img SuperSU or magisk.img Magisk removed.
- "aik --uninstall" should be self-explanatory, and "--help" is also available for all included scripts.

Now also possible to run entirely from a file explorer app, see this post for details!

To run from TWRP (recovery shell), follow the instructions in this post.

mkbootimg, unpackbootimg: https://github.com/osm0sis/mkbootimg
pxa-mkbootimg, pxa-unpackbootimg: https://github.com/osm0sis/pxa-mkbootimg
elftool: https://github.com/osm0sis/elftool
unpackelf: https://github.com/osm0sis/unpackelf
mboot: https://github.com/osm0sis/mboot
dumpimage, mkimage: https://www.denx.de/wiki/U-Boot/WebHome
mkmtkhdr: https://github.com/osm0sis/mkmtkhdr
loki_tool: https://github.com/djrbliss/loki
futility: https://github.com/osm0sis/futility
boot_signer-dexed.jar: https://forum.xda-developers.com/and...ified-t3600606
blobpack, blobunpack: https://github.com/AndroidRoot/BlobTools
dhtbsign: https://github.com/osm0sis/dhtbsign
rkcrc: https://github.com/rockchip-linux/rkflashtool
sony_dump: https://forum.xda-developers.com/cro...image-t3530077
busybox: https://busybox.net/; https://github.com/osm0sis/android-busybox-ndk
file, magic: https://www.darwinsys.com/file/
xz: https://tukaani.org/xz/
lz4: https://lz4.github.io/lz4/

GitHub: https://github.com/osm0sis/Android-I...its/AIK-mobile

Originally all but busybox were compiled natively on my Nexus 7 2013 using a KBox2 build environment, now cross-compiled with the NDK on my PC and my own AIK Build Farm.

Notes: You may delete /data/local/AIK-mobile/bin/busybox if you want to use your ROM's busybox instead.


Linux will be next on the list, and should be pretty easy since I did all of the shell script leg work with the Android version.


If you are reporting a problem with your device, please clearly state your device name and model/variant as well as provide a link to the image file.
The Following 61 Users Say Thank You to osm0sis For This Useful Post: [ View ]
24th March 2014, 04:00 AM |#273  
aosp's Avatar
Inactive Recognized Developer
Thanks Meter: 5,028
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

New ARM version of Android Image Kitchen up in the OP! Now you can easily modify ramdisks on the go!

AIK-mobile v1.8:
- Complete feature parity with the Windows version, including compression support, and -o for original.
- The flashable zip installs AIK to /data/local/AIK-mobile/ and a helper script to /system/xbin/aik
- Type "aik" in Terminal Emulator to automatically go to the install directory and get a root prompt, then use, eg. "./unpackimg.sh boot.img" to get started.

unpackbootimg, mkbootimg:
https://github.com/osm0sis/mkbootimg/
busybox: https://play.google.com/store/apps/d...ybox.installer
file: http://www.astron.com/
xz: http://tukaani.org/xz/
lz4: http://code.google.com/p/lz4/

Notes: Move the file into the working directory with a file explorer and make sure it has no spaces in its name to avoid any possible issues.

Linux will be next on the list, and should be pretty easy since I did all of the shell script leg work with the ARM version.

Ridiculousness thanks for continuing awesome dude can't believe you still using windows 😜 OTG FTW!
The Following User Says Thank You to aosp For This Useful Post: [ View ] Gift aosp Ad-Free
24th March 2014, 09:26 PM |#274  
osm0sis's Avatar
OP Senior Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,653
 
Donate to Me
More
Pulling the DL for now. A bug must have crept in last minute and the images don't boot. Apologies, and I'll figure it out shortly. I'll probably name it 1.0 when I do since that makes more sense than keeping it the same as the Windows version.

Edit: Remaking the image with the original ramdisk produces an identical sha1 sum to the before image, so it's something to do with the repacked ramdisk. I'm guessing permissions or busybox binary not cooperating. Narrowing it down now.
The Following 4 Users Say Thank You to osm0sis For This Useful Post: [ View ]
25th March 2014, 06:37 AM |#275  
osm0sis's Avatar
OP Senior Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,653
 
Donate to Me
More
Turns out booted Android FS permissions just don't appear to cooperate with a cpio repack of the ramdisk. This is confusing since cpio works fine in recovery where I was testing everything, so that's why I didn't pick up on the issue.

Anyway, much like for the obvious permissions limitations of Windows, mkbootfs is the answer; it's find, cpio and fix_perms all rolled into one. So I made a native Android compile of it and it's all tested and working perfectly now.

Release notes updated and the new AIK-mobile v1.0 is up in the OP. If you downloaded the previous version just flash this one over top. Have fun!

@aosp This is probably why those guys didn't support repacking the ramdisk in their app. Let them know they're free to use my binaries.
The Following 3 Users Say Thank You to osm0sis For This Useful Post: [ View ]
25th March 2014, 06:43 AM |#276  
Senior Member
Thanks Meter: 121
 
More
Quote:
Originally Posted by osm0sis

All but busybox were compiled natively on my Nexus 7 2013 using a kbox2 build environment.


Fantastic
The Following User Says Thank You to nk7 For This Useful Post: [ View ] Gift nk7 Ad-Free
4th April 2014, 06:08 PM |#277  
MrMarkEdward's Avatar
Senior Member
Flag New Llano, Louisiana
Thanks Meter: 416
 
More
I have the AT&T Samsung Galaxy S4 when unpacking the TWRP recovery for the AT&T S4 get an error when it gets to

Unpacking ramdisk to "/ramdisk/" . . .

Compression used: empty
Error!

Press any key to continue . . .


I am just trying to add an image and repack it.
6th April 2014, 05:14 AM |#278  
Scott's Avatar
Retired Recognized Developer
Flag Fargo
Thanks Meter: 66,541
 
Donate to Me
More
Tool works great on Samsung Galaxy Tab Pro 8.4!

Thank you for this!
The Following User Says Thank You to Scott For This Useful Post: [ View ] Gift Scott Ad-Free
7th April 2014, 11:02 PM |#279  
osm0sis's Avatar
OP Senior Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,653
 
Donate to Me
More
Quote:
Originally Posted by MrMarkEdward

I have the AT&T Samsung Galaxy S4 when unpacking the TWRP recovery for the AT&T S4 get an error when it gets to

Unpacking ramdisk to "/ramdisk/" . . .

Compression used: empty
Error!

Press any key to continue . . .


I am just trying to add an image and repack it.

TWRP pre-Loki's their images on devices which require it. See the OP for the addon to unpack, and links to info on how to flash the repacked image.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
7th April 2014, 11:05 PM |#280  
osm0sis's Avatar
OP Senior Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,653
 
Donate to Me
More
Quote:
Originally Posted by nk7

Fantastic

I also just finished getting a crosstool-ng cross-compiler from Cygwin to Linux build working which I'll detail soon.

Anyone willing to test out the AIK-Linux version I just made? PM me please. I've got dynamically linked binaries in there but if those don't work, then I'll make some static binaries.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
8th April 2014, 06:05 AM |#281  
MrMarkEdward's Avatar
Senior Member
Flag New Llano, Louisiana
Thanks Meter: 416
 
More
Quote:
Originally Posted by osm0sis

TWRP pre-Loki's their images. See the OP for the addon to unpack, and links to info on how to flash the repacked image.

TY so much worked awesome TY again
The Following User Says Thank You to MrMarkEdward For This Useful Post: [ View ] Gift MrMarkEdward Ad-Free
Post Reply Subscribe to Thread

Tags
kernel, ramdisk, recovery, repack, unpack

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes