cfig / Android_boot_image_editor

Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 15
Apache License 2.0
1.06k stars 234 forks source link

compatibility check: verify as many ROMs and devices as possible #17

Open cfig opened 6 years ago

cfig commented 6 years ago

We want to know how many device ROMs can be edited with this tool, which helps new comers. If you use this tool for your debugging work or hacking, please kindly drop a comment.

Surendrajat commented 5 years ago

Confirmed working with Oppo K3(CPH1955) recovery.img (with some tricks - to get recovery.img out from boot.img using a bsdiff patch under system because didn't work with boot.img)

cfig commented 5 years ago

@Surendrajat Thanks for the kindness! This helps others.

cfig commented 5 years ago

Hi @Surendrajat , could you provide more info such as its Android version details?

Device Model Manufacturer Compatible Android Version Note
Pixel 3 (blueline) Google Y Q preview (qpp2.190228.023,
2019)
Nexus 9 (volantis/flounder) HTC Y(with some tricks) 7.1.1 (N9F27M, Oct 2017) [tricks]
K3 (CPH1955) OPPO Y (recovery.img) ??? [tricks]
Surendrajat commented 5 years ago

Absolutely. Pie it is. I will open a PR for tricks about how to get recovery.img.

Surendrajat commented 5 years ago

@cfig Done #32

eebssk1 commented 3 years ago

Xiaomi Redmi K30 4g(phoenix[n]) (LOS-like ROM android10 )boot.img with vbmeta.img modification works.

cfig commented 3 years ago

Xiaomi Redmi K30 4g(phoenix[n]) (LOS-like ROM)boot.img with vbmeta.img modification works.

Thank you! It would be better if you can provide more info like Android Version, download links of stock images(or 3rd party images).

mariodantas commented 3 years ago

Worked with Topway TS10 firmware (Android10) China car Android headunit

Does not work after image patched with magisk but I think this is out of scope here

eebssk1 commented 3 years ago

Worked with Topway TS10 firmware (Android10) China car Android headunit

Does not work after image patched with magisk but I think this is out of scope here

Magisk directly patch the kernel to force load the ramdisk. It's not very recommended to modify magisk patched image with these tool. Modify the original image and then install magisk if possible.

mariodantas commented 3 years ago

Worked with Topway TS10 firmware (Android10) China car Android headunit Does not work after image patched with magisk but I think this is out of scope here

Magisk directly patch the kernel to force load the ramdisk. It's not very recommended to modify magisk patched image with these tool. Modify the original image and then install magisk if possible.

Thanks for the tip

mariodantas commented 3 years ago

In fact I wasn't trying to modify the patched image, I was trying to understand why I had an error (like the one in the attached PNG below) with the magisk patched image, it seems like Magisk is not doing the job supposed to be done correctly:

The test was done because my unit don't boot with magisk patched image

screenshot-2021-05-28 131120

eebssk1 commented 3 years ago

In fact I wasn't trying to modify the patched image, I was trying to understand why I had an error (like the one in the attached PNG below) with the magisk patched image, it seems like Magisk is not doing the job supposed to be done correctly:

The test was done because my unit don't boot with magisk patched image

screenshot-2021-05-28 131120

Because magisk modifies the content so the signature will no longer match.However this should'nt happen as magisk resign the image with its own key..

Maybe signature in vbmeta is not changed when resigning,whch causes the error.Maybe you can open a issue at magisk repo for this..

mariodantas commented 3 years ago

In fact I wasn't trying to modify the patched image, I was trying to understand why I had an error (like the one in the attached PNG below) with the magisk patched image, it seems like Magisk is not doing the job supposed to be done correctly: The test was done because my unit don't boot with magisk patched image screenshot-2021-05-28 131120

Because magisk modifies the content so the signature will no longer match.However this should'nt happen as magisk resign the image with its own key..

Maybe signature in vbmeta is not changed when resigning,whch causes the error.Maybe you can open a issue at magisk repo for this..

I did, he closed the issue !

mariodantas commented 3 years ago

I know that this is not the right place to post this but, I'd like to get this boot rooted as the unit works very bad with GPS (need to replace some configs in gps.conf / gps_debug.conf) and also need root privileges to user Alpha Backup Pro, and save y 2Gb of music data from deezer app

boot.zip.gz

cfig commented 3 years ago

In fact I wasn't trying to modify the patched image, I was trying to understand why I had an error (like the one in the attached PNG below) with the magisk patched image, it seems like Magisk is not doing the job supposed to be done correctly: The test was done because my unit don't boot with magisk patched image screenshot-2021-05-28 131120

Because magisk modifies the content so the signature will no longer match.However this should'nt happen as magisk resign the image with its own key.. Maybe signature in vbmeta is not changed when resigning,whch causes the error.Maybe you can open a issue at magisk repo for this..

I did, he closed the issue !

you can disable the integrity check by

diff --git a/bbootimg/src/main/kotlin/avb/Avb.kt b/bbootimg/src/main/kotlin/avb/Avb.kt
index 6488c96..5884050 100644
--- a/bbootimg/src/main/kotlin/avb/Avb.kt
+++ b/bbootimg/src/main/kotlin/avb/Avb.kt
@@ -471,7 +471,7 @@ class Avb {
             try {
                 DefaultExecutor().execute(CommandLine.parse(cmdline))
             } catch (e: Exception) {
-                throw IllegalArgumentException("$fileName failed integrity check by \"$cmdline\"")
+                log.error("$fileName failed integrity check by \"$cmdline\"")
             }
         }

magisk patched boot.img can not pass AVB integrity check , but it doesn't matter if bootloader is unlocked, as the bootloader should always load the image for unlocked devices.

mariodantas commented 3 years ago

Oh thanks fellow for that, all I want to do is "understand" whhat's wrong after magisk patch, cause my headunit does not boot with magisk patched boot image

kereng77 commented 2 years ago

I tried to unpack the vendor boot image from Galaxy S22+ and failed -

Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113) at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:108) Caused by: java.lang.OutOfMemoryError: Java heap space at java.base/java.lang.StringCoding.decodeUTF8_0(StringCoding.java:768) at java.base/java.lang.StringCoding.decodeUTF8(StringCoding.java:725) at java.base/java.lang.StringCoding.decode(StringCoding.java:257) at java.base/java.lang.String.(String.java:507) at java.base/java.lang.String.(String.java:561) at cfig.bootimg.cpio.AndroidCpio$Companion.decompressCPIO(AndroidCpio.kt:280) at cfig.bootimg.Common$Companion.unpackRamdisk(Common.kt:355) at cfig.bootimg.Common$Companion.dumpRamdisk(Common.kt:167) at cfig.bootimg.v3.VendorBoot.extractImages(VendorBoot.kt:348) at cfig.packable.VendorBootParser.unpack(VendorBootParser.kt:34) ... 8 more :unpack (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 1.217 secs.

FAILURE: Build failed with an exception.

Can I provide any other useful info?

cfig commented 2 years ago

Hi, can you attach your image here? if it's not confidential .

kereng77 commented 2 years ago

Sure - vendor_boot.tar.gz

cfig commented 2 years ago

Sure - vendor_boot.tar.gz

That's a bug. Just created an issue here: https://github.com/cfig/Android_boot_image_editor/issues/86

arvanasoft commented 1 year ago

Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113) at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:110) Caused by: java.lang.UnknownError: Do not know why hash verification fails, maybe a bug at cfig.helper.Helper$Companion.assertFileEquals(Helper.kt:336) at cfig.bootimg.v3.VendorBoot.pack(VendorBoot.kt:306) at cfig.packable.VendorBootParser.pack(VendorBootParser.kt:44) ... 8 more

repack failed vendor_boot.zip

cfig commented 1 year ago

Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113) at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:110) Caused by: java.lang.UnknownError: Do not know why hash verification fails, maybe a bug at cfig.helper.Helper$Companion.assertFileEquals(Helper.kt:336) at cfig.bootimg.v3.VendorBoot.pack(VendorBoot.kt:306) at cfig.packable.VendorBootParser.pack(VendorBootParser.kt:44) ... 8 more

repack failed vendor_boot.zip

Recorded as: https://github.com/cfig/Android_boot_image_editor/issues/125