yashsingh1/xdaforums huggingface dataset:
[Android Software Development] fawazahmed0:
I tried the latest jar and it doesn't seem to work on the xiaomi_boot.img, if you going to self compile it, you should also consider submitting the patch to AOSP:

https://source.android.com/setup/contribute/submit-patches

But I guess, they will not accept the patch because, the problem looks more like phone manufacturer not following the official standards for boot image. If the patch gets merged in AOSP , then you can download jar from https://ci.android.com without the need to compile again.

Just to make things easier, you don't have to fetch the whole AOSP to compile bootsignature.jar

1. Get the BootSignature.java and Utils.java in eclipse from here:

https://android.googlesource.com/platform/system/extras/+/master/verity

2. Import the bouncyCastle library in eclipse from here (I used provider):

https://www.bouncycastle.org/latest_releases.html

3. Do the modifications in BootSignature.java

4. Export the modified BootSignature.java as runnable jar.

Done.:)
[Android Software Development] osm0sis:
Bug filed, and working .patch to fix included: https://issuetracker.google.com/issues/143810860 :highfive:

Edit: And another one: https://issuetracker.google.com/issues/144111430 :cowboy:
[Android Software Development] DrZener:
Hi [MENTION=4544860]osm0sis[/MENTION],

I would like to report you an issue i had:

XPERIA E5, boot.img dumped w/ dd from a root shell, ELF format

Unpacked

Supplied image: sony-boot.img

Setting up work folders...

Image type: ELF

Splitting image to "split_img/"...
BOARD_KERNEL_BASE="40000000"
BOARD_KERNEL_OFFSET="00008000"
BOARD_RAMDISK_OFFSET="04000000"
BOARD_KERNEL_CMDLINE="bootopt=64S3,32N2,32N2"
BOARD_PAGE_SIZE="4096"

Unpacking ramdisk (as root) to "ramdisk/"...

Compression used: gzip
8659 blocks

Done!

And repacked (w/o changing anything)

Packing ramdisk (as root)...

Using compression: gzip

Getting build information...
kernel = sony-boot.img-zImage
cmdline = bootopt=64S3,32N2,32N2
base = 40000000
pagesize = 4096
kernel_offset = 00008000
ramdisk_offset = 04000000

Warning: ELF format without RPM detected; will be repacked using AOSP format!

Building image...

Using format: AOSP

Done!

Result: bootloop

Apparently fastboot doesn't like ELF boot images (can't flash the dumped file). It flashed successfully the image once repacked in AOSP format but, as said, it can't boot it.

Any suggestions? My goal is to boot a recompiled kernel.

Thank you
[Android Software Development] osm0sis:
[MENTION=8094126]DrZener[/MENTION], will it repack with --forceelf? If so you could dd the new image instead. Otherwise I've got no ideas.. any Sony users in here who can help?
[Android Software Development] yshalsager:
Trying to modfiy old recovery.img file and I got some error.

Here's the full log

Unpacking (which is fine)

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

Supplied image: recovery.img

Setting up work folders...

Image type: AOSP

Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE console=ttyS1,115200n8 mem=239M
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01000000
BOARD_SECOND_OFFSET 00f00000
BOARD_TAGS_OFFSET 00000100

Unpacking ramdisk (as root) to "ramdisk/"...

Compression used: gzip
4248 blocks

Done!

Repacking

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

Packing ramdisk (as root)...

Using compression: gzip
[sudo] password for yshalsager:

Getting build information...
kernel = recovery.img-zImage
cmdline = console=ttyS1,115200n8 mem=239M
board =
base = 00000000
pagesize = 2048
kernel_offset = 00008000
ramdisk_offset = 01000000
second_offset = 00f00000
tags_offset = 00000100
hash = sha1

Building image...

Using format: AOSP

usage: mkbootimg
--kernel <filename>
[ --ramdisk <filename> ]
[ --second <2ndbootloader-filename> ]
[ --cmdline <kernel-commandline> ]
[ --board <boardname> ]
[ --base <address> ]
[ --pagesize <pagesize> ]
[ --dt <filename> ]
[ --kernel_offset <base offset> ]
[ --ramdisk_offset <base offset> ]
[ --second_offset <base offset> ]
[ --tags_offset <base offset> ]
[ --os_version <A.B.C version> ]
[ --os_patch_level <YYYY-MM-DD date> ]
[ --hash <sha1(default)|sha256> ]
[ --id ]
-o|--output <filename>
Error!
[Android Software Development] osm0sis:
Your Drive link points to an empty recovery.img (0.0 kb), please upload again. That error can only happen if there's a necessary file missing or the syntax is somehow incorrect. Which platform are you using AIK on?
[Android Software Development] yshalsager:
My bad. Sorry the upload got derped somehow.

Here's the link https://drive.google.com/file/d/1WtzUP72rul0o172z-xEwqD6QOHAADXc9/view?usp=sharing

I'm using AIK on Linux, tested on Manjaro.
[Android Software Development] osm0sis:
Not seeing that with a fresh untgz of AIK-Linux v3.6 on Ubuntu Server, maybe make sure you've installed all the prerequisite system utilities per the authors.txt?
[Android Software Development] osm0sis:
My GitHub Sponsors profile just went live, so please do take a look at the link below - they're even matching the first year of funding for everyone! :D

As you might know, I work on these projects in my limited time off, so if you like the progress I'm making, or enjoy anything else I've done on xda, please consider sponsoring my ongoing work using my GitHub Sponsors profile. For a one-time donation you can hit the donate link from my profile. Thanks for your support!
[Android Software Development] yshalsager:
That solved it! thanks for your awesome works :D
[Android Software Development] d788873:
Thanks for all your hard work on this!

I'm stuck on trying to repack and boot a boot.img for a rockchip device, trying to follow the procedure in https://github.com/topjohnwu/Magisk/issues/755.

To help debug, I tried unpacking and repacking the stock boot.img from my device with AIK, no changes made. But I can't boot the result, even though I can boot the original boot.img. If I try AOSP format, it just kicks me to recovery. If I try KRNL format, it seems to boot to android, but I don't see any display, I can only access it over adb.

Any ideas what I'm missing? To flash, I'm using:

rkflashtool w < boot.img

I'm also really confused why rkflashtool is giving me an AOSP boot.img when dumping the boot partition, but the AOSP image doesn't boot at all. Is that expected?

Stock boot.img

AIK generated AOSP image (same contents as stock)

AIK generated KRNL image (same contents as stock)

Logs if they help, but I saw no differences:

Logcat from working boot (stock boot.img)

Dmesg from working boot (stock boot.img)

Logcat from failing boot (KRNL image)

[URL="https://files.catbox.moe/17yw6x.log"]Dmesg from failing boot (KRNL image)[/URL]
[Android Software Development] osm0sis:
Your stock boot.img is RockChip's own AOSP variant I don't yet support. See the OPs about it and follow the link and read our discussion for a closed-source tool which may work for you in the meantime.
[Android Software Development] d788873:
Woops I totally missed that, thanks! Sadly not having luck with imgRePackerRK either but will follow up in that thread.
[Android Software Development] starbucks2010:
Hello good people,

I was trying too unpack the latest Android Q kernel for S10+ (G975F) but got an error stating "Unrecognized format. Error!". Using Pie kernel the unpacking is fine.

PS. Using directly the unpackbootimg I get the error "Android boot magic not found."

The attached file is the Q stock kernel zipped.

Would have an idea how can I solve it?

Thanks.
[Android Software Development] osm0sis:
I don't think that's a boot.img at all, if anything it looks like it could just be the literal kernel (zImage or Image.gz in an unpacked boot.img).
[Android Software Development] starbucks2010:
The boot.img inside that archive is taken from the latest Q ota update for S10+. By its size (59 Mb) looks like a legit kernel. It was packed as boot.img.p in the ota zip.

I'm aiming to build a twrp with the zimage from this kernel.

Is there any other option to extract the kernel from a running device without root?

Thanks.
[Android Software Development] osm0sis:
.p means patch, so it's not a full file, just a list of changes.

You need the full boot.img from the device, but there's generally no way without root of some kind.
[Android Software Development] ahhl:
[MENTION=4544860]osm0sis[/MENTION]

i know its already mentioned it wont work on OSIP device

i tried already to unpack, it work

but if gives error when to repack.

any chance to get it work. Asus Zenfone 6

Packing ramdisk . . .

Using compression: gzip

Getting build information . . .

kernel = boot.img-zImage

cmdline = init=/init pci=noearly earlyprintk=nologger loglevel=0 kmemleak=off androidboot.bootmedia=sdcard androidboot.hardware=redhookbay watchdog.watchdog_thresh=60 androidboot.spid=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx androidboot.serialno=01234567890123456789 ip=50.0.0.2:50.0.0.1::255.255.255.0::usb0:on vmalloc=172M slub_max_order=2
[Android Software Development] osm0sis:
OSIP may work, depending on the device. Some may need to remove the *-sig before repack to work.

Post a proper log and the image. This looks like only half a log.
[Android Software Development] ahhl:
thanks for replying

attached the log.txt
[Android Software Development] osm0sis:
There is no error there.
[Android Software Development] ahhl:
ohh.. that means nothing wrong with the repacking?

but after i flash

i cannot start the device. i only add some statement in the init.rc file at the on charger statement.

i have to reflash back stock boot.img
[Android Software Development] jcmm11:
First step is to try to repack with no changes at all. A simple unpack/repack. If that works then you know it's something about your changes that caused the problem
[Android Software Development] osm0sis:
And he seems to have missed what I mentioned about *-sig.

Others with OSIP devices have reported removing it before repacking resulted in a working image: https://xdaforums.com/showthread.php?p=79391662#post79391662

I think this depends on the device, some checking sig and some not.
[Android Software Development] ahhl:
[MENTION=4544860]osm0sis[/MENTION], [MENTION=4487388]jcmm11[/MENTION]

thanks for the advice. i have tested unpack/repack the original boot.img with all the switches and can confirmed it can only work with --original switch WITHOUT deleting the *-sig file/s. this is for Asus Zenfone 6 A600cg running lolipop
[Android Software Development] Droidphilev:
Hello all,

Is there any one here who can tell me where i can find 3.5 for windows?

Since i use Superr with 3.6 i have problems on windows regarding permissions (running as admin doesn't fix this). I'm only trying to remove dm verity from a kernel. I never had this problem with 3.6

Thanks in advance!
[Android Software Development] zputnyq:
On xda labs app, It's on first page of this thread, it needs a scroll down to find it there.
[Android Software Development] Droidphilev:
Thanks for your answer!

Sadly enough, if i open this thread on the labs i get the same as on the forum with pc: release notes for all versions but no link to download older versions.
[Android Software Development] zputnyq:
You're right, I just try it.

iirc, it wasn't like that, since I could download a few months ago.
[Android Software Development] osm0sis:
Instead of asking for older versions, maybe explain your issue better and I can probably fix it. Also logs.
[Android Software Development] Droidphilev:
I'm sorry but i'm not very good at this. Superr Kitchen fails and points me to a post in thsi topic. That posts advices to run things as admin which i always do (right click run as admin)

this is a logfile i found:

Android Image Kitchen - UnpackImg Script

by osm0sis @ xda-developers

Supplied image: boot.img

Setting up work folders . . .

Image type: AOSP

Signature with "AVBv1" type detected.

Splitting image to "split_img/" . . .

BOARD_KERNEL_CMDLINE bootopt=64S3,32N2,32N2

BOARD_KERNEL_BASE 40000000

BOARD_NAME 1555582216

BOARD_PAGE_SIZE 2048

BOARD_HASH_TYPE sha1

BOARD_KERNEL_OFFSET 00008000

BOARD_RAMDISK_OFFSET 04000000

BOARD_SECOND_OFFSET 00f00000

BOARD_TAGS_OFFSET 0e000000

BOARD_HEADER_VERSION 0

Unpacking ramdisk to "ramdisk/" . . .

Compression used: gzip

4409 blocks

Done!

Press any key to continue . . .

PermissionError: [Errno 13] Permission denied: 'C:\\1KITCH\\SuperRs-Kitchen_Win-32_v3.1.9.9\\superr_ker\\bootimg/ramdisk\\fstab.mt6735_new'

[8080] Failed to execute script superr

PermissionError: [Errno 13] Permission denied: 'C:\\1KITCH\\SuperRs-Kitchen_Win-32_v3.1.9.9\\superr_ker\\bootimg/ramdisk\\fstab.mt6735_new'

[6328] Failed to execute script superr
[Android Software Development] awab228:
hello , i was using the tool fine before , but i did a recent system update and i also updated the tool , now even the stock image if i just unpack and repack it doesn't boot and stuck at black screen can you take a look the files here ?

https://mega.nz/#F!21whhCDD!f0Fw0qfCSNdrcDbTfQ3j6Q

when i try to unpack the repacked image i get this error :

Setting up work folders...

Unrecognized format.

Error!

although i think its related to something in the system because i now went and tested the old AIK and also it doesn't work , i am using ARCH , is the cpio binary related in anyway with this ?

thanks.
[Android Software Development] osm0sis:
My unpackimg script is executing fine there, as you can see. Looks like [MENTION=5787964]SuperR.[/MENTION] might have to investigate what's going on with his fstab script with you, however.

Your repacked image-new.img unpacks just fine here. You are probably missing some of the required Linux system utilities as listed in authors.txt, so make sure you've got all of those, especially the file utility (likely the reason it's "unrecognized").
[Android Software Development] mapleshadow:
支持一下，留个脚印
[Android Software Development] digitaller:
Hi osm0sis

Great work.

I unpacked the stock image and immediately repacked it without making any changes. The whole process went ok without a problem. However, the device lost wifi after flashing the repacked boot.img. The wifi mac address became 02:00:00:00:00:00. Flashing the stock image got the wifi back.

Can you point me at the right direction and let me know what I can do about the situation? I tried on both Linux and Windows and got the same result.

Regards

---------- Post added at 02:20 PM ---------- Previous post was at 02:20 PM ----------

Hi osm0sis

Great work.

I unpacked the stock image and immediately repacked it without making any changes. The whole process went ok without a problem. However, the device lost wifi after flashing the repacked boot.img. The wifi mac address became 02:00:00:00:00:00. Flashing the stock image got the wifi back.

Can you point me at the right direction and let me know what I can do about the situation? I tried on both Linux and Windows and got the same result.

Regards
[Android Software Development] osm0sis:
As always the first step is repackimg --original to see if that works better, and if so, narrows it down to something in the ramdisk.
[Android Software Development] digitaller:
Hi osm0sis

That is what I did - I unpacked and repacked the factory boot.img using --original switch. Flashing the newly generated img caused the wifi mac to become 02:00:00:00:00:00 and I was unable to turn wifi on. I flashed the factory one back and wifi is back.

Can you please let me know what I need to do to check the ramdisk? Your help is greatly appreciated.
[Android Software Development] osm0sis:
If --original didn't work then there's something about the image format that isn't working, likely an OEM signature. If you upload it I'll verify and see if there's anything else you can try.
[Android Software Development] awab228:
after i did extended testing i can confirm there is something wrong with the updated binaries on my system , i did check all the required files and nothing is missing , the image did unpack after i changed its name , i think it was conflicting with the cleanup script ,i have doubts that the updated cpio is causing me this , this is the current one i have cpio 2.13-1 , can you confirm that its working on your system ? and what is the current one you have ?

-----------------

i used your AnyKernel3 to push just the Image and it worked.
[Android Software Development] osm0sis:
It's not even getting to cpio if it's detecting it as unrecognized that early. You should update your file binary most likely, the latest is 5.37. And yeah you can't unpack image-new.img directly without renaming it first since it will get removed by cleanup.
[Android Software Development] digitaller:
I really appreciate your help osm0sis.

The link is https://drive.google.com/file/d/1yhKWJaWqFWb8UPBpVyjRz55xzzNpVGlj/view?usp=sharing

The phone is ASUS Zenphone3 Ultra.
[Android Software Development] osm0sis:
The only difference with one repacked with --original from your stock boot.img is the AVBv1 signature, which for stock is the private ASUS OEM key, so no way for us to recreate. So if as you say the repacked one doesn't work then unfortunately ASUS has done some shady **** and tied it to their boot signature in some way.
[Android Software Development] gorei23:
Is there a reason this causes Firefox and VirusTotal to light up like a christmas tree?

https://www.virustotal.com/gui/file...574a16a61884decbb787dc5d5c8c76be86f/detection
[Android Software Development] alecxs:
sudo.exe is required for repacking, you need to disable antivirus when unzipping
[Android Software Development] osm0sis:
Yes. The reason is sh*tty heuristics.
[Android Software Development] digitaller:
Thanks for looking into this quickly. Can you please let me know what my options are if I want to use my own kernel? Will anykernel3 work in this case? Sorry for the noob questions.
[Android Software Development] osm0sis:
AK3 is based on the exact same principles and methods, so there shouldn't be any difference.

If you are compiling your own kernel from source then maybe you need to compile a new WiFi module to go with it that won't screw up with a non-OEM signature.

Are there other kernel developers for your device? Any further discussion is off topic for this thread, so maybe try to find one for your device and ask how they got it working.

One last thing you could try is patching the stock boot.img with Magisk Manager before you unpack it in AIK, in case verity state is somehow involved.
[Android Software Development] digitaller:
Yes I am compiling my own Kernel from source and unfortunately there is no other developers for that device.

I will give the Magsik patched boot.img a go. Thanks again for your help.
[Android Software Development] Nazihma:
Hi, I have tablet tabA-2019-T510 with android 9. I have tried to unpack its boot.img in Linux with MKbootimg_tools-master but I get this message: "ramdisk is unknown format, can't unpack ramdisk". any advice please?
[Android Software Development] osm0sis:
How do you expect advice without uploading the boot.img? And why are you asking in this thread if you aren't trying AIK to unpack?
[Android Software Development] Nazihma:
boot.img

Thank you for your repy and this is the boot.img. please unzinp it and try to unpack. thank you in advance.
[Android Software Development] osm0sis:
Easy. Works fine. There is no ramdisk since your device is using the old A-only SAR format.

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

Supplied image: boot-tabA-2019-T510.img

Setting up work folders...

Image type: AOSP

Signature with "AVBv2" type detected.

Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE androidboot.selinux=permissive androidboot.selinux=permissive
BOARD_KERNEL_BASE 10000000
BOARD_NAME SRPSA25A002KU
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01000000
BOARD_SECOND_OFFSET 00f00000
BOARD_TAGS_OFFSET 00000100
BOARD_OS_VERSION 9.0.0
BOARD_OS_PATCH_LEVEL 2019-08
BOARD_HEADER_VERSION 1
BOARD_HEADER_SIZE 1648

Warning: No ramdisk found to be unpacked!

Done!
[Android Software Development] Nazihma:
New a-only sar format

What do you mean : 'old A-only SAR format'. and is there 'new A-only SAR formet' for t510?

I have used t580 for a while, it contains ramdisk although its model is 2016.

Thank you in advance.
[Android Software Development] osm0sis:
I've explained it a few times, either search the thread or look it up on Google.
[Android Software Development] Nazihma:
Thank you

Ok, thank you for your help
[Android Software Development] osm0sis:
SAR info is under the keyword "system-as-root" in this thread. :good:

Android 10 uses 2-step init (2SI), so there is no "new SAR" format; system remains system-as-root, but now we also have a ramdisk again for 2SI to be able to boot up with logical partitions.
[Android Software Development] CeRaT:
It worked fine for me thanks. :iyi:
[Android Software Development] gokart2:
For the life of me, can't get it to repack anywhere near the original size, and the way it seems......it's not repacking with all the files. Stock img is ~67 MB. Repacked ones are ~26 MB no matter what I try. All I'm doing is splitting it to inject a new Image.gz-dtb, then repacking without ramdisk mods. My Image.gz-dtb is within ~0.5 MB of the original Image.gz-dtb? So I'd assume it would be closer to the original boot.img's size, not ~40 MB smaller? Any help is greatly appreciated, and thank you for ALL your work! :good::good:

Attached link to related files, used Linux AIK version.

https://drive.google.com/file/d/1bvwsx1I3ey3civwmNiRFo8rt2n1l9CG-/view?usp=sharing
[Android Software Development] jcmm11:
They can easily be much smaller. The original images are packed with nulls to fill out the space so the size matches the partition size. The repacked images don't have the extra padding.
[Android Software Development] alecxs:
[MENTION=4267845]gokart2[/MENTION] open the original file with hex editor and you will see ;)
[Android Software Development] gokart2:
Seriously? LOL. I kept thinking it was either not repacking everything, or it was getting compressed more then the partition/system liked? 40MB of 10char....lol. Amazing.

Will try that and see.

Thanks guys, looks like my problem is a compiling error somewhere....:good::good::highfive:
[Android Software Development] jahidinbedod:
aik mobile can't sign on repack img process

wait next release for fix this problem :good:
[Android Software Development] osm0sis:
Depends on Android version: https://android.googlesource.com/platform/art/+/3d8a78a79aaa47be68162cb3e3fb2544f9b624a3

Android 10 removed -Xnodex2oat on some devices, so yes a fix will be in the next release, and in the meantime you can remove -Xnodex2oat from the signing command in repackimg.sh and it'll work again. :good:
[Android Software Development] jahidinbedod:
yes i'm fail on android 10

thanks for the info sir, youre best :good:
[Android Software Development] ErbDroid:
Hello [MENTION=4544860]osm0sis[/MENTION]

Firstly, thank you so much for all your hard work! from this to ADB to BusyBox to AnyKernel etc etc etc (you must be busy!)

I was in Ubuntu via Termux to see how much can actually be done via this method, and it seems... quite a lot!!!

To test it, I got SuperR's kitchen and even AiK-Linux, and all necessary dependencies. It seems with devices like the Raspberry Pi, there are alot of ARM64 ports now.

I found something and it got me thinking... i wonder if.... ???

(it it an ARM64 version of android-libsparse)

(it would include simg2img, img2simg etc which is needed for system modifications)

https://packages.ubuntu.com/bionic-updates/arm64/android-sdk-libsparse-utils

Just got me thinking, if it is even possible, that perhaps AiK could actually be more than a boot.img kitchen and possibly a full ROM kitchen?!?!

Again, thank you so much for all your time and efforts.
[Android Software Development] osm0sis:
I appreciate your enthusiasm, but [MENTION=5787964]SuperR.[/MENTION] Kitchen already exists for modding ROMs, and AIK is an important part of it. No need to reinvent the wheel. :)