yashsingh1/xdaforums huggingface dataset:
[Android Software Development] ☆KØŁØЯΛĐØ☆:
[MENTION=4544860]osm0sis[/MENTION] Using AIK on PC is halfass working for me. I'm able to unpack my boot.img just fine but when I finishing editing & want to repack, the repackimg.bat script returns with:

Packing ramdisk (as root). . .

Windows sudo required but not found.

*** Reinstall Android Image Kitchen! ***

Error!

Press any key to continue. . .​

I'm confused why the error occured whenever I have both Debain & Ubuntu distros installed..

View attachment 4753077 View attachment 4753076
[Android Software Development] ashyx:
What has debian and ubuntu got to do with AIK on Windows?

Sudo for Windows? :eek:

I use all 3 versions of AIK for Windows, Linux and Android. All work perfectly.

For the Windows version all you need do is double click repackimg.bat

There is something fundamentaly wrong with your methods.
[Android Software Development] ☆KØŁØЯΛĐØ☆:
I'm still learning so I'm inclined to agree that my methods are wrong. There's multiple image extracting tools out there & admittedly, I get confused on which tool requires what in order to function properly.

I double-clicked the repackimg.bat & it gave me the same error message again. The attached screenshot is of the response. Any ideas on what could be wrong?
[Android Software Development] martyfender:
Try this: right click the script and from the drop down menu choose: run as administrator.
[Android Software Development] ☆KØŁØЯΛĐØ☆:
Aha! Very cool. Thank you my man. Didnt think of that
[Android Software Development] osm0sis:
Have you thought about following the instructions it gave you? The (Windows sudo) sudo.exe file was likely gobbled up by Windows Defender on the PC as a false positive, so AIK is saying to reinstall (i.e. unzip again) to get it back. :silly:
[Android Software Development] ashyx:
Ah, the ever so over zealous windows defender. Apparently all my uploads are infected according to WD. :silly: :p
[Android Software Development] ☆KØŁØЯΛĐØ☆:
It's cool. I got it working now. Keep in mind you guys were in my position at one point in time. Not everything comes naturally. Some folks gotta ask questions & when they do, dont act like a pompous jackass
[Android Software Development] twiztidditzwit:
Hello all,

After using dd to make a copy of my boot.img and Android kitchen mobile to unpack it, the default.prop extracted as a symlinked folder with nothing in it? Same 23kb file size but, an empty folder? Also noticed the extracted "/etc" folder symlinked to my native one? Is there a way to extract the contents of my boot partition (on mobile-no pc) isolated from the rest of my system? Or I must be doing something incorrectly.

Anyone please shed some light, I'm sorry if it's a stupid question I'll have everyone know I search search search and read read read and practice/try/learn as much as possible before I commit to asking a question on XDA. Thanks in advance. ?
[Android Software Development] osm0sis:
That's just how it works now as of current system-as-root and/or Treble (so Oreo, I believe). default.prop -> /system/etc/prop.default and that's just what your ramdisk contains. Also important to recognize you're likely digging around in the recovery ramdisk right now, since the actual booted root "/" directory is now in the system partition.
[Android Software Development] twiztidditzwit:
Thank you for explaining that... Glad to know I'm comprehending it somewhat. Building/compiling is my current skill focus and greatly appreciate all the work and tools you've created! Cheers ?

---------- Post added at 09:50 AM ---------- Previous post was at 09:27 AM ----------

Thank you for explaining that... Glad to know I'm comprehending it somewhat. Building/compiling is my current skill focus and greatly appreciate all the work and tools you've created! Cheers ?
[Android Software Development] ahhl:
just want to say AIK work to unpack repack on redmi 6a mtk.
[Android Software Development] fawazahmed0:
Hi,

I am using your tool to unpack and repack, but I see recovery.img truncating the size.

I opened the stock recovery and repacked recovery in Hex, and many things were truncated.

For example: In my stock recovery there are two occurrences of string "pmic_vldo28_ldo_reg", but in repacked recovery, there is only one occurrence.

The main culprit is BootSignature.jar which was truncating the image, just wanted to ask , did you compile BootSignature.jar from latest source

Btw here is my stock recovery(Just extract recovery.img):

https://www.androidfilehost.com/?fid=1395089523397966781
[Android Software Development] fawazahmed0:
I have also compiled twrp using omni 9 source, tried unpacking using AIK, but AVB is not detected, might have to update androidbootimg.magic

Here is the AVB part at end of recovery

https://drive.google.com/file/d/1efsezQ-qJI-a3IgP-yz33D0sgFp2sgT9/view?usp=sharing
[Android Software Development] madbat99:
What device is it?
[Android Software Development] osm0sis:
AVBv2 is not supported since it requires Python to sign and is not enforced on unlocked bootloaders.

The OP clearly only mentions AVBv1.

BootSignature.jar is [MENTION=631273]Chainfire[/MENTION]'s, as linked in the OP.
[Android Software Development] fawazahmed0:
Oppo Realme 3

---------- Post added at 01:39 PM ---------- Previous post was at 01:31 PM ----------

Sorry, didn't read the OP completely
[Android Software Development] fawazahmed0:
Hi,

To make things clear I am talking about my stock recovery signed using AVB v1

The reason BootSignature.jar is not working is because of latest changes in Android 9.

You can see that here: https://source.android.com/devices/bootloader/recovery-image

My device is Non-A/B device and it has dtbo appended to recovery.img, this dtbo was not getting included by BootSignature.jar

Just letting you guys informed about it ;)
[Android Software Development] fawazahmed0:
[MENTION=4544860]osm0sis[/MENTION] I have compiled the BootSignature.jar from latest Omni 9 sources, it does not messes up the dtbo attached to recovery and works perfectly for my stock recovery.

Here is the link to latest BootSignature.jar :

https://www.androidfilehost.com/?fid=1395089523397971252
[Android Software Development] osm0sis:
AVBv1 shouldn't even be in use on new devices with Android 9 and hdr_v1 because of AVBv2, so that's news to me. Weird devices are weird I guess! Can you post your findings in Chainfire's BootSignature thread and I'll see if I can coax him to make new builds, including the ProGuard optimized one for Android on-device execution. :good:

https://xdaforums.com/android/software-hacking/signing-boot-images-android-verified-t3600606
[Android Software Development] shookica:
Can't get the repacked images to boot for my phone (Umidigi S3 Pro). I downloaded the recovery image from the xda umidigi s3 thread. The original recovery image works fine and boots into TWRP.

After unpacking image, making some changes and repacking, img is unbootable.

Then I tried to unpack the original downloaded img and repack it without making any changes, it is unbootable.

Finally I tried to repack original img with the --original parameter, also resulting in a unbootable img.

Not sure if worth mentioning, but the original img and recompiled were different size even if no changes were made.
[Android Software Development] osm0sis:
Link to the image you're trying? Platform you're trying on?
[Android Software Development] shookica:
The file is in this thread "Scatter + Recovery twrp" (I can't post outside links because new user)

https://xdaforums.com/android/general/umidigi-s3-pro-t3910573

I am running Windows 10 Pro build 17134
[Android Software Development] osm0sis:
Well right off the bat I can tell you whoever made that recovery .img doesn't really know what they're doing:

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers

Supplied image: recovery_S3_Pro_test1_twrp_323_material_design.img

Setting up work folders...

Image type: AOSP

Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE bootopt=64S3,32N2,64N2 buildvariant=user veritykeyid=id:7e4333f9bba00adfe0ede979e28ed1920492b40f
BOARD_KERNEL_BASE 40078000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 14f88000
BOARD_SECOND_OFFSET 00f00000
BOARD_TAGS_OFFSET 13f88000
BOARD_HEADER_VERSION 1
BOARD_HEADER_SIZE 0

Unpacking ramdisk to "ramdisk/"...

Compression used: gzip
39201 blocks

Done!

A bootimg hdr_v1 device should never have a header_size of 0.

Edit: The only other thing I notice comparing the untouched image with a --original repack is there is an extra page (2048 bytes on this device) at the end containing only 1 byte of data (hex \xD7). I'd recommend using a hex editor to try adding that extra page from the untouched image back onto the image-new.img after a repack to see if it resolves your booting issue.

Taking both things together it sounds almost like it's using that old Samsung "dt" section, which stores its dt_size in the space in the header where header_version is in the official spec. That would explain both things being 1. What it doesn't explain is why it's there in the first place, since that's not a real dt. If it's some hack to get unofficial images booting then they should use 5 bytes (or more to be future-proof) so it'll get properly recognized as a "dt" section since that's the cut-off both [MENTION=4470081]topjohnwu[/MENTION] and I agreed to detect dt_size vs. header_version for the very reason that there should never be a dt smaller than that.

Again, seems like another case of "weird device is weird."

Edit 2: Try with this one I modified to have a dt_size of 2048 (and added 1 byte of \xFF at the end to make it true). Flash it first to make sure it boots, then try repack --original and see if it boots, then try repack with no changes and see if it boots. Let the developers for your device know about the fix if it works so they can fix their hack to be compatible with Magisk's and my image tools.

Edit 3: I've uploaded just the -dt for you and the devs on your device. Unzip and tell them to use it with mkbootimg when they make their images.

https://basketbuild.com/filedl/devs?dev=osm0sis&dl=osm0sis/odds/s3_pro.img-dt.zip
[Android Software Development] osm0sis:
Looked into this a bit more. You're right that BootSignature.jar as currently provided in Chainfire's thread will truncate the recovery_dtbo (and topjohnwu's bootsigner in Magisk Manager will chop it off entirely), so please do as I suggest in my reply to you (also quoted above).

I also noticed that after the verity keys AVBv1 signature there are 2 more sections that appear to contain AVBv1 signatures from MediaTek, contained in MTK headered areas named certl1 and certl2. Note there is no way to replicate these, mostly because we don't have access to MediaTek's corporate keys, so you'd be out of luck if they ever started enforcing them. That all said, it's a good sign if it's working for you without them, so carry on! :)
[Android Software Development] fawazahmed0:
Thanks for looking into it, I was scratching my head, trying to understand what this cert1 and cert2 thing was. Just one question, if bootloader is unlocked does these keys are enforced by bootloader.

I have not yet flashed the recovery, because I have hard bricked my device three times in last 2 months. Just got it today after third hardbrick.

Only way to recover was through service center and it takes 2-3 weeks to get back the device.

I am not sure, I will be taking the risk again.

Magisk also doesn't work for this phone it causes bootloop, but I figured out getting root shell access by modifying the build.prop by mounting system.img

I guess , chainfire is not into Android anymore. But if you insist I will post about this in his thread.

If you are only interested in Mobile version of BootSignature.jar, I was able to make it, Works perfectly on my phone. And you can use that if you want.

https://www.androidfilehost.com/?fid=3556969557455274196

I also want to let you know that, latest BootSignature.jar will remove the AVBv2 Signatures and Sign using AVBv1, I am not sure if that will be any problem for your tool.

I will share you the steps incase you are interested in compiling from source and also making the mobile version of it. (It's very easy)

Compiling BootSignature.jar

1. Download the source (I was using twrp omni v9 minimal source)

2. We only need to compile BootSignature.jar file, Refer this: https://stackoverflow.com/questions/30654810/building-just-one-tool-from-android-source-aosp

Just search for BootSignature in source folder, you just have to compile that folder.

3. You will get BootSignature.jar file (Output Location will be shown in terminal, in my case it was located at: out/host/linux-x86/framework)

Converting into Dexed (Mobile Version):

1. Download latest Android build tools from here:

https://androidsdkmanager.azurewebsites.net/Buildtools

you can also use SDKManager in Android studio to get buildtools

2. we will be using d8 tool to convert jar into dexed version.

Command: dx --dex --output=BootSignature_Mobileversion.jar BootSignature.jar

This BootSignature_Mobileversion.jar file will work same way as chainfire's worked

Example: dalvikvm -cp BootSignature_Mobileversion.jar com.android.verity.BootSignature /boot boot.img verifiedboot.pk8 verifiedboot.x509.der boot_signed.img

References: https://stackoverflow.com/questions/11574233/android-dx-usage

https://xdaforums.com/android/software-hacking/signing-boot-images-android-verified-t3600606

https://developer.android.com/studio/command-line/d8

http://www.herongyang.com/Android/shell-dalvikvm-Command-to-Run-Java-Application.html
[Android Software Development] osm0sis:
Chainfire did some fancy ProGuard stuff to make his Android version of it much smaller, and he's not entirely out of the game. Follow his Twitter. He's doing some interesting stuff still. Lots of people also still use the builds in his thread so yes you should post your findings there to make people more widely aware, and repost what you just wrote so others in his thread can benefit from it as well. :)

As for the bootloader enforcing the MTK cert sections when unlocked, no clue. This is the first I've seen them. AVBv1 isn't normally enforced when unlocked, but this is something else, so you'll have to test to find out. Please let us know what the case is if/when you do get to it.
[Android Software Development] fawazahmed0:
Reposted:

https://xdaforums.com/showpost.php?p=79578362&postcount=300 :)
[Android Software Development] shookica:
It boots with repack --original but not with repack.
[Android Software Development] osm0sis:
Hmm. Well that's good it works with my changes to the fake "dt" overall, you should definitely tell the developers for your device to fix their hack using the "dt" you get when you split my test image.

As for the repack with no changes, that points to something not getting repacked quite right in the ramdisk, (so a different issue). You're on Windows? Try on AIK-mobile or AIK-Linux to see if that makes a difference.
[Android Software Development] wzsx150:
hello, your tool is great! thank you very much.

I want to know , v3.4 is normal working, but v3.5 need administrator permission for windows.

for example， unpack or repack lzma ramdisk.

can you make new version like v3.4, unpack or repack not needing administrator permission?

my poor English.

thank you!
[Android Software Development] osm0sis:
It needs administrator only if the image being repacked requires it (e.g. if it's a rooted boot.img), same as v3.4.
[Android Software Development] wzsx150:
I tested both v3.4 and v3.5 for the same boot.img as management user , v3.4 is normal even rooted boot.img, but v3.5 will be error for rooted boot.img.

v3.5 must right-click to run as Administrator. v3.4 is not needed.

I think v3.4 and v3.5 is not the same.
[Android Software Development] osm0sis:
Show me the log and upload the boot.img. Try unzipping v3.5 again to your desktop and see if there's any difference; could be you've put it in some directory with weird inherited Windows folder permissions.
[Android Software Development] wzsx150:
Android Image Kitchen - RepackImg Script

by osm0sis @ xda-developers

Packing ramdisk (as root) . . .

Windows sudo required but not found.

*** Reinstall Android Image Kitchen! ***

Error!

----1.boot.img is magisk patched, any patched boot.img, as you say the rooted boot.img. you can test it.

2.v3.4 and v3.5 is in the same dir.

3.even on desktop, the error is the same.
[Android Software Development] osm0sis:
Read the message. "Reinstall Android Image Kitchen!"

Clearly Windows Defender deleted sudo.exe as a false positive. Unzip again and go add sudo.exe to the ignore list.
[Android Software Development] wzsx150:
I'm not a boy who know nothing. and even do not know to see the file.

v3.4 and v3.5 is different no matter what you say. ok, that's all.

at last , thank you for your tools.

maybe next version it will be better.
[Android Software Development] osm0sis:
Yes it's different because now it tells you that your system broke it. Follow my simple instructions to fix it. Enjoy.

The next version will add another message to tell users to add sudo.exe as an exception to Windows Defender.
[Android Software Development] Nekromantik:
im guessing this cant be used to extract boot.img from a phone?
[Android Software Development] jcmm11:
No. Are you rooted? TWRP?

This tool unpacks a boot image to it's component parts, doesn't get the boot image from a phone
[Android Software Development] Nekromantik:
not got twrp or root.

cant get either as I just got a new oneplus 7 pro 5g and there is no firmware file online for me to extract boot img from for magisk

nor can I install TWRP without root as currently fastboot boot command does not work.
[Android Software Development] jcmm11:
Have you seen this thread? https://xdaforums.com/oneplus-7-pro/how-to/guide-root-oneplus-7-pro-patched-boot-t3931205
[Android Software Development] Nekromantik:
yup but thats for non 5g version
[Android Software Development] fawazahmed0:
Hi,

I have tested avbv1 and avbv2 TWRP on my phone, both boots successfully, So my unlocked bootloader is not enforcing the signatures.

Just letting you know.:)
[Android Software Development] Tyakrish:
Does this allow for extraction of system.dat.br images ? Sorry for the noob question, but is there a kitchen which allows for extraction of such files on android device itself ?
[Android Software Development] osm0sis:
No. And no. It's not for system anything. The OP clearly states boot and recovery images and ramdisks.
[Android Software Development] davek17:
Hi there

Sorry to ask such an obvious question, but i'm really struggling today.

So I have a quick obvious question about symlinked default.prop files. So I unpacked my boot.img using v3.3 and the default.prop has the 1 line in it symlinking to system/etc/prop.default.

This file doesn't exist in the unpacked boot. In fact it's nowhere to be seen. It does exist on the device in the main system/etc folder in the OS if I shell into it using ADB but does that mean I have to change it there on a rooted device?

So how do I remove verity and change the ro.secure values like before?
[Android Software Development] osm0sis:
It's in system now, like it suggests. No way to change it without modifying system.
[Android Software Development] davek17:
OK, no problem, and the fstab fiule where you can tweak the dm-verity line is also in there?
[Android Software Development] osm0sis:
It's in dtb or dtbo, and vendor. Welcome to system-as-root devices. ;)
[Android Software Development] navneetasnavi:
I just dragged my boot.img and dropped at unpackimg.bat

and i get two folders

1) Ramdisk

2) split_img

but Ramdisk folder is empty :eek:

and there are some files in split_img as i attached the snapshot
[Android Software Development] osm0sis:
Attach the file you're trying to unpack so I can take a look please. Also written in the OP.
[Android Software Development] aosp:
[MENTION=4544860]osm0sis[/MENTION] [MENTION=4179234]trevd[/MENTION]

Not sure if you guys have used it before but I linked a handy little open source app that you could place in the toolbox or improve ;)

whdghks913/Unpackbootimg · GitHub - http://goo.gl/X5RlRm

Unpack Repack img (이미지 언팩/리팩) - Android Apps on Google Play - http://goo.gl/IYG7S9
[Android Software Development] dimebagdan65:
Heeeeeeyy Ozzy!

As always, when I go searching for some black magic Android f*ckery, osm0sis always shows up in the results lol. Good to see you kicking @$$ and taking names as usual bro! That being said, I do have a quick question... Forgive the newbishness but I can't for the life of me figure out how to proceed... I can unpackage and repackage no problem, but the issue that brought me here in the first place is I'm trying to repackage a TWRP 2.6.3.4 for Hammerhead with the Play themed curtain. As I said, unpacking and repacking is a breeze, but how do I go about inserting the image? I have the Play curtain in 1080x1920 resolution as a .jpg but am clueless (Hey, I'll be the first to admit it lol) as to how to stick it in there... Any and all help would be greatly appreciated and once I know how, I'd be happy to do it for all the popular TWRP themes for the Nexus 5 so they can look as awesome as what's been done on the Razor/Razorg.
[Android Software Development] osm0sis:
Definitely OT but the curtain for TWRP is somewhere in the theme directory under res. Cheers for the kind words bro! :D
[Android Software Development] JRJ442:
[MENTION=4544860]osm0sis[/MENTION] Do you know anything recoveries that use Loki? I trying to repack TWRP and change the splash screen up. I did this a million times on my S3 but I'm running into problems now. I'm trying this on the LG G2 for VZW. The tool looks like its repacking the recovery correctly, but when I try to flash it, and reboot the recovery its like the recovery is just gone, a black screen comes up and says something about fastboot enabled. I'm not sure if the tool is running into a problem with Loki or what. Would you mind taking a look?
[Android Software Development] osm0sis:
Lokifying is usually done by a binary in the zip during the flashing process if you go read in the Loki threads. Problem we discovered like a page ago was that TWRP is pre-lokifying them and I think that's interfering with splitting the image.
[Android Software Development] JRJ442:
Sorry I missed that. Hopefully you can figure something out on the G2 and the pre-lokied TWRP
[Android Software Development] osm0sis:
Android Image Kitchen v1.8

Edit: Reposted due to broken xda attachments.

Looks like as of noon today (Dec. 9) we're back in business. :D
[Android Software Development] garynych:
why ? 404 - not found
[Android Software Development] osm0sis:
Crap. Seems like xda's attachment system is broken. Great day to choose to release I guess. :rolleyes:

404'd downloads from other threads have since gone live so hopefully that happens here shortly as well.

Edit: Confirmed with site moderators there are issues. Attachment removed until I get the all-clear. :(
[Android Software Development] NoobieExtraordinare:
Nooo...

I was just going to ask you for an updated version to support S800 SoCs. Thanks for all your work.
[Android Software Development] JRJ442:
Hopefully it'll work with pre Loki'd recoveries when I get to try out later.
[Android Software Development] osm0sis:
Unfortunately it likely won't. I haven't heard back from anyone regarding "unlokifying" images. It's really stupid of them to pre-lokify them before distribution though, considering the recommended flash procedure for loki images lokifies them itself.

Edit: Here's a thread where someone was planning on building an unloki function into unpackbootimg, so I can check back in the New Year:

http://xdaforums.com/showthread.php?t=2566081
[Android Software Development] JRJ442:
I wonder if anyone would know in the TWRP irc chat? I think Dees Troy is usually in there. [MENTION=4544860]osm0sis[/MENTION] I joined the twrp chat. Let's see if I get an answer on how to de-loki them.