yashsingh1/xdaforums huggingface dataset:
[Android Software Development] nicesoni_ash:
I tried this app to play with my recovery image file and put the image in the same directory where .bat files are, however it shows me error that no image file supplied. Can anyone suggest what am I doing wrong?

Edit:

got it working, was running batch file directly, now command line command worked. Thanks z31s1g
[Android Software Development] JRJ442:
[MENTION=4544860]osm0sis[/MENTION] Thanks for this awesome tool! Works excellent. :)
[Android Software Development] osm0sis:
[MENTION=4179234]trevd[/MENTION] brought this to my attention the other day :eek:: https://android-review.googlesource.com/#/c/64440/

We'll cross that bridge when we come to it. ;)

I also finally found a kernel that uses LZ4 compression on the ramdisk, and it's for a device I own, so I'm currently testing out support for that. :D

The Win32 binaries for LZ4 are waaaay behind (e.g. don't even support pipes correctly), but I've just now got things unpacking and repacking with some workarounds. Testing tomorrow. :good:

Edit: Sorry about the delay.. It wasn't booting with my previous workaround, but I got a newer binary from the LZ4 blog/site, and worked out a way to pipe them correctly now. Tested and fully working using the old M-Kernel builds for grouper 4.2.2 where Metallice experimented with it; I had to downgrade my device to make sure I knew it would boot in the first place and then repack to test.

Edit 2: I still haven't been able to find lzma, lzo or bz2 ramdisks for any devices I own, but I'm now satisfied lzma compression repacking should work on most if not all devices that use it, since I unpacked and repacked official TWRP for the Galaxy Note 2 (T-Mobile), which uses lzma, and the checksums of the unpacked image, split original ramdisk, were identical to those of the repacked image and repacked ramdisk, respectively. :)
[Android Software Development] osm0sis:
Android Image Kitchen v1.6

Uploaded the new version to the OP. Hard to believe that 4718 people have downloaded AIK (v1.5) since May! :D

v1.6 Changelog:

Fix for image filenames with brackets in them.

Workaround for the Cygwin warnings on Windows 8.1. If you are seeing this issue, just edit the unpackimg.bat and repackimg.bat files and change hideErrors=n to hideErrors=y (near the top).

Add the "magic" file entries and binary to support lz4 ramdisk compression. Again, gzip is the standard and most common, but some developers use others in an attempt to improve boot times. The type of compression is determined and written out to file (ramdiskcomp), then used to unpack appropriately. Repacking is done with the same compression used by the original image.

Note:

It is not recommended you attempt to change the type of compression used for the ramdisk, since the kernel itself must be compiled to handle this as well. More often than not, kernel developers only enable support for the specific compression in use and disable all others.

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.
[Android Software Development] osm0sis:
The problem here may be your image somehow giving a weird BOARD_KERNEL_BASE 00000000. The offset in the file it gets the base from IS 0000, but then it continues for a possible base of 00008000. unpackbootimg.exe only reads the first two characters to determine the base as that's usually all that's needed so this might be the reason.

Checked a few other images, and the f.K GN image has a reported base of 80000000 and in the file it's 80008000, another reported 10000000 and is 10008000. So it seems the last half is always 8000 and is generally unused? Perhaps [MENTION=4179234]trevd[/MENTION] can tell us a bit more.

Haha well taking that line out means it doesn't even try to unpack. ;)

Looking at your files it's immediately obvious why they don't work. There is no ANDROID! magic header. Sorry, your device isn't using the standard Android image format so this tool isn't intended for it. :( On the upside, I don't notice an obvious ramdisk in it either, so there's a good chance there wouldn't be much you could do anyway.
[Android Software Development] trevd:
Ohh Must of missed that one.. I'll have a look when I get chance but i'll tell you now from looking at the file name that it' probably a uboot image ( uImage ) which require different tools.

I would be surprise that a ramdisk came out ( well kind of surprised ) It's that unexpected feature of your tool probably were if I does find the magic it goes "f**k we'll try and unpack it anyway" LOL :D

Like I say I'll properly when I get chance, I''m just involved in a battle of wits at the moment with some stupid instruction from samsung
[Android Software Development] osm0sis:
hkfriends' boot.zip has a proper Android standard image in it. That's the one I'm curious about since we should be able to support it but the BASE is weird. :)

Edit: Just checked out the repacked file and the base/kernel offset is still 00008000, so it can't be that even though it seems odd. There must be something else bizarre going on.
[Android Software Development] trevd:
Ahh right.,... That'll teach me :)
[Android Software Development] hkfriends:
guys, thanks so much.... I manage to find a way

https://github.com/xiaolu/mkbootimg_tools

this is new to snapdragon 800 cpu, it supports dtb right now

---------- Post added at 08:07 AM ---------- Previous post was at 08:06 AM ----------

yep, new dtb need to handle... use this tool to repack will fix... thanks

https://github.com/xiaolu/mkbootimg_tools
[Android Software Development] trevd:
[MENTION=581992]hkfriends[/MENTION] Nice, Thanks for sharing

[MENTION=4544860]osm0sis[/MENTION] Another thing to add to the list then, I'm going have to show how to compile these things yourself, I'm pretty sure gcc in cygwin will do it, and more often than not it is literally a case of grabbing the sources and typing "make". Not that I mind doing it, it's just am I a unreliable lazy b*stard at times and easily distract as you know ;)
[Android Software Development] shoey63:
This tool unpacks and repacks non-stock boot.img's perfectly on Xperia z. The generation of the new-ramdisk.cpio is particularly useful :)
[Android Software Development] danieljamie:
This tool seemed to work for my Samsung Galaxy Note 3 SM-N9005, however when repacked the boot.img won't let me past the bootloader, so I'm not sure what is wrong there.

This is a snapdragon 800 phone if that helps..
[Android Software Development] osm0sis:
Link to the image please. Might be the same dtb issue reported above. When I get some time I'm going to try and set up a build environment to make the new mkbootimg binary required.
[Android Software Development] ankitrocks:
Why is it throwing me a blank ramdisk-new.cpio (0 bytes) and no repacked boot.img after running repackimg ?

my need is small. I am a doctor and don't know linux. then again I am trying since 2 days and nights. was able to deodex my stock, dump the rom, make a sp flash tool flashable file, did a nandroid backup. I have boot.img and recovery and all the rom things. I am very disappointed now. Loosing my sleep. I know this dont bother you much as I am a noob but I tried.

I just wish to port the LewaOs 5 already made rom for a phone (celkon a119q) very very similar to my phone celkon a118.

The original lewaos5 porting gyu told me that all I have to do is replace the ramdisk from port rom to my stock and use the same zimage as stock one.

Also I was not able to find Meta-Inf for my phone, but it seems (according to the guy) that the port rom ones will work.

But how to compile boot.img again? This tool is giving me blank ramdisk_new.cpio and no boot.img . Also error comes in cmd that android_win_tools\ is not a recognised command or batch etc.

My head hurts. :( Of the two folders I get, I replaced the ramdisk folder (which is empty) with the port rom one. but then it is not packing. tried replacing split_img folder too.

And now I tried placing original folders back to get initial boot.img, still 0 byte file.

why!!!!!!

P.S. if this all sound stupid to the mods, please delete this post!
[Android Software Development] osm0sis:
Looks like you did something weird. Download and unpack the zip again and make sure you've got your folders straight. If all you need is the ramdisk from one attached to the zImage of the other then you shouldn't use my tool to repack. You should unpack to split then mkbootimg manually, with the files you need from each split image, from the command line; there are lots of good tutorials for mkbootimg around.
[Android Software Development] ankitrocks:
Thank you!
[Android Software Development] Wolfcity:
Am I having a typo somewhere?

Edit; There's a space between c and # I think...
[Android Software Development] osm0sis:
Yeah it's su -c "<commands>" with a space
[Android Software Development] Wolfcity:
Should have known that...;) Thanks,worked now.
[Android Software Development] ashyx:
Superb work as usual. Your tireless work is much appreciated. :svetius:
[Android Software Development] shoey63:
Excellent! Unpacks Sony kernel.sin and repacks as AOSP boot.img perfectly on Windows 10:good:

Edit: And flashing repacked image boots fine without any issues. (Unlocked bootloader obviously)
[Android Software Development] Alxoom33:
Tried to use for repacking modified TWRP 3.2.0-1 boot image with custom splash on Pixel 2XL. Did not boot. Any suggestions?
[Android Software Development] martyfender:
I had a similar issue with AIK 2.9 on Linux Mint, when unpacking the custom TWRP 3.0.2 for my Intel x86 tablet. I don't recall what I modified in the ramdisk, but it would not boot for me either. I did not, at the time, pursue it any further as I assumed AIK didn't work with TWRP.

Now I recall. I have 4 different Nextbook Ares 8As. I have V1.1.1, 1.2.0, V2.1.5 and V3.0.4. They all have the same Android 6.0.1 version with the same kernel version: 3.14.64-x86_64. One thing that is different on each device is the build number. In default properties I had changed the build fingerprint to match the current version of that tablet. [MENTION=2472806]vampirefo[/MENTION] had built the TWRP on a V1.0.8 version of the tablet. I don't recall if I modified anything else. Each tablet also has a different IFWI (Intel Firmware Interface) version.
[Android Software Development] osm0sis:
Tried via the Materialised theme in recovery, or while booted?

I tested for 4 hours with [MENTION=6842057]nathanchance[/MENTION] and his Pixel 2 to work out all the weird Pixel 2 kinks so it should definitely work booted. I'll investigate the setup commands for using it in recovery again.

With v3.0 ditching mkbootfs TWRP and any .img should all repack perfectly in AIK-mobile as it would directly with AK2 in recovery or with straight Linux.
[Android Software Development] Alxoom33:
Thanks for the quick reply. Did you test on the P2XL, as it has its own quirks? I did the repacking in the new TWRP 3.2.0-1 I used the Adapt a Splash in the Black play theme v. 320Xv1. Flashed the modified image using TWRP in Boot. Rebooted and froze.

Tried again with updated AIK 3.0 Mobile signed.zip. Didn't boot, wound up on the G.

Perhaps I am doing something wrong? Should the modified Twrp image be extracted and flashed in

fastboot instad of Twrp.

Thank you for your kind efforts.
[Android Software Development] osm0sis:
It'll work if you do it manually while booted to Android (i.e. not recovery). I'm positive we tested the hell out of the Pixel 2 gremlins. There must just be something to fix up in the setup script for recovery execution. Can you upload me dumps of both the working (before) and broken (after) boot.img? The /tmp/recovery.log from directly after adapt splash was run will also be helpful.

Also worth mentioning it's going to be a losing battle on the Pixels since Magisk is going to start compressing the recovery parts into recovery.cpio.xz and the boot parts into boot.cpio.xz as files within the ramdisk on them or when it detects there's less than 500kb free, so there'll be more hoops to get through to modify the theme other than just unpacking the ramdisk going forward..
[Android Software Development] Alxoom33:
May I send it to you in an email attachment. Having a terrible time attaching files in taptalk.
[Android Software Development] osm0sis:
You can also just open xda in Chrome, I upload from Chrome on my devices all the time. :good:
[Android Software Development] Alxoom33:
I tried and got a message: This community does not support attachments of this type.

Can I provide them to you on Telegram or by email?

I got the same message in chrome and on Taptalk on my phone.
[Android Software Development] osm0sis:
Nah no need, there basically shouldn't be a resulting image because the script didn't execute. See the TWRP Materialised theme thread. The fix that's needed will be on the theme side.
[Android Software Development] Alxoom33:
So, I need to wait for an updated theme. Thank you! Sorry I couldn't be more of a help. PM me if there is anything I can test for you. I just have a hard time exchanging files on Taptalk, even on chrome.
[Android Software Development] G.M.L:
Until my friend and my mentor [MENTION=2719389]z31s1g[/MENTION] will update his perfect theme and because I don't want to provide here link with downloads from my theme if anyone want can go to my theme with the last fixes for Recovery Splash Picture from [MENTION=4544860]osm0sis[/MENTION] and I'm thanks him a lot for this!!!
[Android Software Development] Alxoom33:
Do you know if that fix works on the Pixel 2 XL? I tried it on my device and had difficulties... see my posts above. Basically I booted into a black screen.
[Android Software Development] G.M.L:
Really I don't know if work with this fix only [MENTION=4544860]osm0sis[/MENTION] can tell you. Did you test it with the fixes in my theme?
[Android Software Development] Alxoom33:
No, I tested it with your friend and Mentor's latest Black Play theme.
[Android Software Development] osm0sis:
It should work, AIK does for sure, but I don't have a Pixel of any kind so it's all theoretical whether the TWRP Materialised stuff works on it. This conversation really needs to stop being split between these threads however, please direct it to the theme thread from now on. :good:
[Android Software Development] Alxoom33:
Thanks, will do!
[Android Software Development] osm0sis:
On further testing/thought it will be a cleaner fix if I do it on my side, so please see the TWRP Materialised theme thread for an AIK-mobile v3.1 Beta for those that use it with a theme. There aren't any other fixes, so don't sweat it if you don't. :good:

I'm waiting on macOS compiles of [MENTION=4120742]munjeni[/MENTION]'s excellent SIN unpacking tool before I do a final release for all platforms. Hopefully today or tomorrow before I leave on holiday. :fingers-crossed::highfive:
[Android Software Development] DodoGTA:
Or remove all proprietary/closed-source stuff, build all binaries from source, make a script to automate the process of making this tool, put it into one Git repository and one branch (with submodules, of course) and relicense it to GPLv3 (or some other open-source license) :p

#OpenSourceFTW
[Android Software Development] osm0sis:
Have you looked at the posted "AIK Build Farm" script and my GitHub? The SIN tool is the only thing missing for anyone wanting to build AIK at home, and I've never been entirely happy about it being the only closed-source component in AIK since, case in point, I would have had it included for macOS with AIK v3.0, but I respect [MENTION=4120742]munjeni[/MENTION]'s choice to keep it closed and all the hard work he's put into reverse engineering Sony's bull****.
[Android Software Development] djb77:
Hey [MENTION=4544860]osm0sis[/MENTION]

Having some trouble with the new 3.0 Linux release with Samsung Ramdisks.

Up until 2.9 it worked perfectly, but however 3.0 doesn't seem to unpack it the same way, meaning it can't be edited.

Also in 3.0 it asks for root to unpack the ramdisk, which is very weird.

I've attached some logs and screenshots of the ramdisk so you can see what I mean.

Staying on 2.9 for now...
[Android Software Development] osm0sis:
Not weird, totally normal. Most people used unpackimg.sh --sudo to unpack as root to maintain OEM ownership/permissions anyway since mkbootfs would break things, so now it's the only way, and we needed badly to get rid of mkbootfs, which was working less and less anyway due to fragmentation.

It unpacks as root, so just edit as root, and make sure the ownership of edited/added files is correct before you repack because it'll pack it up exactly as you have it. While this may take a little getting used to for people who have been relying on the mkbootfs way, it's the best way to do things. Full control.
[Android Software Development] djb77:
I understand what you're saying...

However, for me personally, mkbootfs is better just for the fact its not forcing root. Because basically this means whatever I use to edit the ramdisk must be running as root. My usual compare app (Beyond Compare) would now be unusable, and would be less git-friendly due to all the files been binaries instead of scripts.

What would be nice, if you could, add a --old switch to use the old mkbootfs method. If people don't want to use it, they don't have to, and this newer method still stays as default. I just don't see this new method being practical for me unfortuntaely
[Android Software Development] jahidinbedod:
hello [MENTION=4544860]osm0sis[/MENTION]

how much space it takes to run aik_mobile v3.0

I have space left 500 mb didnt work
[Android Software Development] osm0sis:
Upload the image? Give some info?
[Android Software Development] jahidinbedod:
my space left
[Android Software Development] jahidinbedod:
[MENTION=4544860]osm0sis[/MENTION]

work if using v2.9

why?
[Android Software Development] osm0sis:
No. Upload this "TWRP_recovery.img" you used and information about your device, like all the posts in this thread request.

Might be too big for the make ext4 .img, though 32mb should be plenty for a ramdisk.
[Android Software Development] jahidinbedod:
oh sorry

here

https://androidfilehost.com/?fid=962021903579500442
[Android Software Development] osm0sis:
Wow, I stand corrected. That's a huge ramdisk. I'll bump the max up to 64mb for 3.1 after I get back from holiday. Merry Christmas by the way! :)

In the meantime, from Terminal Emulator, you can fix it with this:

su -c "make_ext4fs -l 64M /data/local/AIK-mobile/bin/ramdisk.img";

Then attempt to unpack again. You'll want to delete lost+found from it until I prepare a clean one however. :good:
[Android Software Development] jahidinbedod:
ok i will wait v3.1 release :good:

Merry Christmas ;)
[Android Software Development] osm0sis:
I'll answer this here since I think the information will benefit others. :good:

I'll take a look at your changes when I get back from holiday, but unpacking as user is generally not a good idea, it'll break many devices that require root ownership since the user ownership of files/directories will remain when repacked.
[Android Software Development] djb77:
You maybe right, i had problems with the last kernels i built using this method. Reverted back to 2.9 again.
[Android Software Development] osm0sis:
You should really just start using your diff and editing tools with sudo.. that's the correct way to do things. mkbootfs is crap, so v2.9 won't save you, not over time, only changing to use the best practice will. :(

Since I did make a similar concession for Windows by having cpio repack all with root ownership I'll look into making --nosudo do that on AIK-Linux for v3.1. Best of both worlds, but sudo will remain the default since it's the correct way to do it to avoid issues with any possible non-root:root ownership an OEM might use and how it works on-device with AIK-mobile, AnyKernel2 and anything else that unpacks/repacks ramdisks in recovery. :good:
[Android Software Development] RahulTheVirus:
Hi

Confirming new device ..

Xiaomi Mi Pad1

It's working like magic.

Thanks for creating awsome tool.

==============

Done !
[Android Software Development] osm0sis:
Thanks. Please edit to remove the quote from your post, however; one should never quote the OPs. :good:
[Android Software Development] hsbadr:
Sorry for the late reply! I've just returned home after a ~long international trip.

Please let me know if you're still interested in prebuilt macOS binaries. I think that MacPorts is enough though; the file port is already at FILE5_32 tag. You may need to install and switch to GNU utils including sed, instead of using the preinstalled BSD/older versions.
[Android Software Development] osm0sis:
Already all done sir, check out AIK-Linux v3.0 :D
[Android Software Development] hsbadr:
Everything works as expected! Well done :good:

I'd suggest to let the shell scripts print AIK version number (e.g., AIK v3.0) or at least add it the headers with the author.
[Android Software Development] osm0sis:
[MENTION=2247733]ante0[/MENTION]

I've just learned about the empty kernel.img ramdisk (and empty zImage in the ramdisk.img) thing with Treble Huawei devices. The tools can handle it but the script gets confused during repack by the empty ramdisk directory.

v3.1 will allow these to repack correctly (I've already tested with --original and they come out with identical header hashes to the original files). Manually with the mkbootimg binary/executable should work for now but you'll need to pass the empty (0-byte) ramdisk file back in or omit the --ramdisk argument.
[Android Software Development] ante0:
Thanks! Looking forward to it :)

And will try with mkbootimg

Edit: make sure to update your mkbootimg if you're in my situation, mine was too old and wouldn't pack without ramdisk.
[Android Software Development] shoey63:
Hi osm0sis.

I have attached a zip containing Oreo kernel.sin for Sony XZ premium. Running it through the kitchen produces the "unknown format" error. So I used kernel_dump on it and instead of getting a kernel.elf I got kernel.000 and kernel.crt. I then used the kitchen to unpack kernel.000 and it succeeded. Turns out to be an AOSP boot image with AVB signature.

It seems Sony have changed the way they do things with sin V4. Can you modify the kitchen to accommodate it?

View attachment 4382108

Edit: Made sure I was in the right thread this time :p
[Android Software Development] osm0sis:
SINv4 is just a .tar.gz, then it contains a full AOSP format image. So, just as with Samsung's Odin .tar a user just needs to unpack it manually first before using it in AIK. I mentioned it originally in the release post for v2.9: https://xdaforums.com/showpost.php?p=73793822&postcount=1459
[Android Software Development] PiggyFlooper:
I'm using AIK-mobile 3.0, I'm SuperSu rooted, Samung Galaxy J7 Perx (V.M.) 7.0Nougat

Can't get it to unpack
[Android Software Development] osm0sis:
Install v3.1? If there is no ramdisk.img in AIK-mobile/bin/ then your installation is broken somehow since that's a file in the flashable zip. Also try running it from FX File Explorer, your shell/app is looking a little broken.
[Android Software Development] levone1:
Don't know much about this stuff, so maybe dumb question, but maybe not...

I had the idea of a hack to eliminate the warning screen that shows up on boot for Xperia devices with unlocked bl, (screen shot). The message comes from an image in /initrd/res/images. I used unpack bootimg, (tried a few versions, not just this one), and no errors. Then I replaced the images with edited ones. However, every time I repack bootimg, the new bootimg is half the size, and won't boot. So, not sure if I should be using a different command, or if it won't compile correctly because of my edit, or...?

My phone is Xperia Xc, stock 7.1.1.

Thanks

Edit - the image attached is actually not the right one, but same idea. The message is 'your device is unlocked and cannot be trusted'.

Edit2 - I think I might be realizing that the images I was looking for are not where I thought, so maybe my plan won't work. Anyway, still curious about getting the tool to work...