cfig / android_boot_image_editor Goto Github PK
View Code? Open in Web Editor NEWParsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 15
License: Apache License 2.0
Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 15
License: Apache License 2.0
Command and output:
> ./gradlew unpack
> Task :unpack FAILED
[main] WARN cfig.packable.PackableLauncher - [dtbo.img] will be handled by [DtboParser]
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence initialized
[main] INFO cfig.packable.DtboParser - [external/mkdtboimg.py, dump, dtbo.img, --dtb, build/unzip_boot/dtb, --output, build/unzip_boot/dtbo.header]
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:106)
at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:92)
Caused by: java.io.IOException: Cannot run program "external/mkdtboimg.py" (in directory "."): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:621)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
at cfig.packable.DtboParser.execInDirectory(DtboParser.kt:76)
at cfig.packable.DtboParser.unpack(DtboParser.kt:36)
... 8 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 16 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unpack'.
> Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
17 actionable tasks: 1 executed, 16 up-to-date
>
Using this version:
> git log
commit 125418c99de218b17855fb69733c0b6a986c6a7f (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: cfig <[email protected]>
Date: Tue Jun 23 11:08:43 2020 +0800
Squashed commit of the following:
Where to get this tool ? external/mkdtboimg.py
Thank you.
I cant unpack boot.img file, it writes this error: ./gradlew: No such file or directory.
I've checked if everything is installed:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
device-tree-compiler is already the newest version (1.6.0-1).
g++ is already the newest version (4:10.2.1-1).
gcc is already the newest version (4:10.2.1-1).
git is already the newest version (1:2.33.0-1).
lz4 is already the newest version (1.9.3-2).
openjdk-11-jdk is already the newest version (11.0.12+7-2).
python3 is already the newest version (3.9.2-3).
xz-utils is already the newest version (5.2.5-2).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
What's wrong?
I cant unpack boot.img file, it writes this error: ./gradlew: No such file or directory.
I've checked if everything is installed:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
device-tree-compiler is already the newest version (1.6.0-1).
g++ is already the newest version (4:10.2.1-1).
gcc is already the newest version (4:10.2.1-1).
git is already the newest version (1:2.33.0-1).
lz4 is already the newest version (1.9.3-2).
openjdk-11-jdk is already the newest version (11.0.12+7-2).
python3 is already the newest version (3.9.2-3).
xz-utils is already the newest version (5.2.5-2).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
What's wrong?
Task :unpack FAILED
[main] WARN cfig.packable.PackableLauncher - [boot.img] will be handled by [BootImgParser]
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence initialized
[main] INFO cfig.packable.BootImgParser - header version 3
[main] WARN cfig.bootimg.v3.BootHeaderV3 - BootImgHeaderV3 constructor
[main] INFO KernelExtractor - [aosp/build/tools/extract_kernel.py, --input, build/unzip_boot/kernel, --output-configs, build/unzip_boot/kernel_configs.txt, --output-version, build/unzip_boot/kernel_version.txt]
[main] INFO KernelExtractor - kernel version: [5.9.0]
[main] INFO KernelExtractor - kernel config dumped to : build/unzip_boot/kernel_configs.txt
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:106)
at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:92)
Caused by: java.util.zip.ZipException: Not in GZIP format
at java.base/java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:166)
at java.base/java.util.zip.GZIPInputStream.(GZIPInputStream.java:80)
at java.base/java.util.zip.GZIPInputStream.(GZIPInputStream.java:92)
at cfig.Helper$Companion.unGnuzipFile(Helper.kt:116)
at cfig.bootimg.Common$Companion.dumpRamdisk(Common.kt:113)
at cfig.bootimg.v3.BootV3.extractImages(BootV3.kt:150)
at cfig.packable.BootImgParser.unpack(BootImgParser.kt:33)
... 8 more
ERROR LOG :
Downloading https://services.gradle.org/distributions/gradle-6.4.1-bin.zip
.........10%..........20%..........30%..........40%.........50%..........60%..........70%..........80%.........90%..........100%
Welcome to Gradle 6.4.1!
Here are the highlights of this release:
For more details see https://docs.gradle.org/6.4.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
Task :bbootimg:compileKotlin
w: /home/ubuntu/12334/Android_boot_image_editor/bbootimg/src/main/kotlin/avb/Avb.kt: (199, 27): Variable 'descriptors' initializer is redundant
w: /home/ubuntu/12334/Android_boot_image_editor/bbootimg/src/main/kotlin/avb/desc/HashDescriptor.kt: (78, 13): Variable 'digest' is never used
w: /home/ubuntu/12334/Android_boot_image_editor/bbootimg/src/main/kotlin/init/Reboot.kt: (21, 30): Parameter 'cmd' is never used
w: /home/ubuntu/12334/Android_boot_image_editor/bbootimg/src/main/kotlin/init/Reboot.kt: (21, 60): Parameter 'rebootTarget' is never used
Task :aosp:mkbootfs.10:compileMkbootfsExecutableMkbootfsCpp FAILED
FAILURE: Build failed with an exception.
No tool chain is available to build for platform 'linux_x86-64':
- Tool chain 'visualCpp' (Visual Studio):
- Visual Studio is not available on this operating system.
- Tool chain 'gcc' (GNU GCC):
- Could not find C compiler 'gcc' in system path.
- Tool chain 'clang' (Clang):
- Could not find C compiler 'clang' in system path.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5m 58s
5 actionable tasks: 5 executed
It seems that it doesn't work for arm64 hosts. There seems to be an issue about this #33, but the files that fixed the issue was removed.
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.
我使用Windows的Linux子系统解包dtbo.img时,报以下错误是因为python的版本太高了,改用python 2.7.18即可正常解包了。
我创建了拉取请求,如有必要你可以合入:https://github.com/scarlet-glass/Android_boot_image_editor/tree/patch-1
log:
`scarlet-glass@DESKTOP-VK785N8:~/Android_boot_image_editor$ ./gradlew unpack
Task :unpack FAILED
17:20:58:185 WARN PackableLauncher - [dtbo.img] will be handled by [DtboParser]
17:20:58:251 WARN PackableLauncher - 'unpack' sequence initialized
17:20:58:255 INFO DtboParser - [aosp/system/libufdt/utils/src/mkdtboimg.py, dump, dtbo.img, --dtb, build/unzip_boot/dtb, --output, build/unzip_boot/dtbo.header]
/usr/bin/env: “python”: 没有那个文件或目录
17:20:58:288 ERROR DtboParser - can not exec command
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:92)
Caused by: java.io.FileNotFoundException: build/unzip_boot/dtbo.header (没有那个文件或目录)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.(FileInputStream.java:157)
at cfig.packable.DtboParser.unpack(DtboParser.kt:43)
... 8 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
20 actionable tasks: 1 executed, 19 up-to-date`
root@localhost:/home/serval# cd Android_boot_image_editor
root@localhost:/home/serval/Android_boot_image_editor# ./gradlew unpack ������������
FAILURE: Build failed with an exception.
Exception thrown while executing model rule: NativeComponentModelPlugin.Rules#createBinaries(Targete
dNativeComponentInternal, PlatformResolvers, BuildTypeContainer, FlavorContainer, ServiceRegistry)
Invalid NativePlatform: linux_aarch64
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log
output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 4s
pls help me pack boot.img.v3 (android11)
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:92)
Caused by: java.nio.BufferOverflowException
at java.base/java.nio.HeapByteBuffer.put(HeapByteBuffer.java:221)
at cfig.bootimg.Common$Companion.writePaddedFile(Common.kt:287)
at cfig.bootimg.v3.BootV3.pack(BootV3.kt:104)
at cfig.packable.BootImgParser.pack(BootImgParser.kt:57)
... 8 more
unpack is success, but pack fail.
Task :pack FAILED
[main] WARN cfig.packable.PackableLauncher - [boot.img] will be handled by [BootImgParser]
[main] WARN cfig.packable.PackableLauncher - 'pack' sequence initialized
[main] INFO cfig.packable.BootImgParser - Loading config from build/unzip_boot/boot.json
[main] INFO cfig.bootimg.Common - Deleting build/unzip_boot/ramdisk.img.gz ...
[main] INFO cfig.bootimg.Common - Deleting build/unzip_boot/ramdisk.img ...
[main] INFO cfig.bootimg.v2.BootV2 - OS Major: 16
[main] INFO cfig.bootimg.Common - Packing rootfs build/unzip_boot//root ...
[main] INFO cfig.bootimg.Common - CMD: aosp/mkbootfs.16/build/exe/mkbootfs/mkbootfs build/unzip_boot//root -> PIPE -> build/unzip_boot/ramdisk.img.gz
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:92)
Caused by: java.io.IOException: Cannot run program "aosp/mkbootfs.16/build/exe/mkbootfs/mkbootfs" (in directory "."): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at java.base/java.lang.Runtime.exec(Runtime.java:592)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
at cfig.bootimg.Common$Companion.packRootfs(Common.kt:186)
at cfig.bootimg.v2.BootV2.pack(BootV2.kt:329)
at cfig.packable.BootImgParser.pack(BootImgParser.kt:62)
... 8 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 18 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
20 actionable tasks: 3 executed, 17 up-to-date
Starting a Gradle Daemon (subsequent builds will be faster)
Task :bbootimg:compileKotlin FAILED
e: /Users/maps-pc/Downloads/Android_boot_image_editor-master/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (251, 33): Unresolved reference: readAllBytes
e: /Users/maps-pc/Downloads/Android_boot_image_editor-master/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (252, 30): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
e: /Users/maps-pc/Downloads/Android_boot_image_editor-master/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (259, 44): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
e: /Users/maps-pc/Downloads/Android_boot_image_editor-master/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (260, 56): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
FAILURE: Build failed with an exception.
Compilation error. See log for more details
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 23s
1 actionable task: 1 executed
kiyoi@kiyoi-PC:~/Android_boot_image_editor$ ./gradlew unpack
Task :bbootimg:compileKotlin FAILED
e: /home/kiyoi/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (234, 33): Unresolved reference: readAllBytes
e: /home/kiyoi/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (235, 30): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
e: /home/kiyoi/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (242, 44): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
e: /home/kiyoi/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (243, 56): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
FAILURE: Build failed with an exception.
Compilation error. See log for more details
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 9s
1 actionable task: 1 executed
Hi, I use this tool to unpack factory boot.img pulled from the Nexus 6P, and use fastboot to flash the modified boot.img(I only changed ro.secure=0 and ro.debuggable=1
in build/unzip_boot/root/default.prop). Then when I reboot Nexus, it loops boot between the unlocked warning page and Google logo page.
After flashing the built boot img with modified kernel, it stops booting on the google logo. The kernel compiled without errors, so the problem is in these tools. It isn't working even with known working(newest elementalx for nexus5x) kernel image, because it can't pack correctly the boot img.
./gradlew pack
Task :pack FAILED
[main] WARN cfig.packable.PackableLauncher - [vbmeta_a.img] will be handled by [VBMetaParser]
[main] WARN cfig.packable.PackableLauncher - 'pack' sequence initialized
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:92)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "flags-pVg5ArA" (class avb.desc.KernelCmdlineDescriptor), not marked as ignorable (7 known properties: "sequence", "num_bytes_following", "tag", "cmdline", "flagsInterpretation", "cmdlineLength-WZ4Q5Ns", "flags-WZ4Q5Ns"])
at [Source: (File); line: 238, column: 26] (through reference chain: avb.AVBInfo["auxBlob"]->avb.blob.AuxBlob["kernelCmdlineDescriptor"]->java.util.ArrayList[0]->avb.desc.KernelCmdlineDescriptor["flags-pVg5ArA"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:855)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1212)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1604)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1582)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:299)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:291)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:250)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4524)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3331)
at cfig.Avb.packVbMeta(Avb.kt:273)
at cfig.Avb.packVbMetaWithPadding(Avb.kt:309)
at cfig.Avb.packVbMetaWithPadding$default(Avb.kt:308)
at cfig.packable.VBMetaParser.pack(VBMetaParser.kt:26)
... 8 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 16s
20 actionable tasks: 3 executed, 17 up-to-date
04:18:52:690 WARN PackableLauncher - [boot.img] will be handled by [BootImgParser]
04:18:52:774 WARN PackableLauncher - 'unpack' sequence initialized
04:18:52:782 INFO BootImgParser - header version 2
04:18:52:793 WARN BootHeaderV2 - BootImgHeader constructor
04:18:52:797 INFO Avb - python aosp/avb/avbtool.v1.2.py verify_image --image boot.img
sha256 digest of recovery.img does not match digest in descriptor
aosp/avb/avbtool.v1.2.py: Error verifying descriptor.
Verifying image boot.img using embedded public key
vbmeta: Successfully verified footer and SHA256_RSA2048 vbmeta struct in boot.img
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:106)
Caused by: java.lang.IllegalArgumentException: boot.img failed integrity check by "python aosp/avb/avbtool.v1.2.py verify_image --image boot.img"
at cfig.Avb$Companion.verifyAVBIntegrity(Avb.kt:474)
at cfig.bootimg.v2.BootV2$Companion.parse(BootV2.kt:98)
at cfig.packable.BootImgParser.unpack(BootImgParser.kt:45)
... 8 more
FAILURE: Build failed with an exception.
https://www.mediafire.com/file/xkg9srlaxe0s7bi/recovery.zip/file
boot.zip
google wants to add DTBO section in recovery.img, see:
https://android.googlesource.com/platform/system/core/+/147b355bb34cbd457a260c585be93193cef43b8e
so i proceeded as per readme stuck while unpacking
here is the log
creator54 Android_boot_image_editor master l
total 23M
drwxr-xr-x 10 creator54 creator54 4.0K May 19 08:18 aosp/
drwxr-xr-x 3 creator54 creator54 4.0K May 19 08:18 avbImpl/
drwxr-xr-x 4 creator54 creator54 4.0K May 19 08:31 bbootimg/
-rw-r--r-- 1 creator54 creator54 23M May 19 08:21 boot.img
drwxr-xr-x 4 creator54 creator54 4.0K May 19 08:58 build/
-rw-r--r-- 1 creator54 creator54 3.0K May 19 08:18 build.gradle.kts
drwxr-xr-x 2 creator54 creator54 4.0K May 19 08:18 doc/
drwxr-xr-x 3 creator54 creator54 4.0K May 19 08:18 gradle/
-rwxr-xr-x 1 creator54 creator54 5.7K May 19 08:18 gradlew*
-rw-r--r-- 1 creator54 creator54 2.9K May 19 08:18 gradlew.bat
-rwxr-xr-x 1 creator54 creator54 4.0K May 19 08:18 integrationTest.py*
-rw-r--r-- 1 creator54 creator54 12K May 19 08:18 LICENSE.md
-rw-r--r-- 1 creator54 creator54 389 May 19 08:18 Makefile
-rw-r--r-- 1 creator54 creator54 4.9K May 19 08:18 README.md
-rw-r--r-- 1 creator54 creator54 323 May 19 08:18 settings.gradle.kts
drwxr-xr-x 5 creator54 creator54 4.0K May 19 08:18 src/
drwxr-xr-x 2 creator54 creator54 4.0K May 19 08:18 tools/
creator54 Android_boot_image_editor master ./gradlew unpack
Task :unpack FAILED
[main] WARN cfig.packable.PackableLauncher - [boot.img] will be handled by [BootImgParser]
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence initialized
[main] WARN cfig.bootimg.BootImgInfo - BootImgHeader constructor
[main] INFO Parser - image info written to build/unzip_boot/bootimg.json
[main] INFO Parser - kernel dumped to: build/unzip_boot/kernel, size=21.15538787841797MB
[main] INFO KernelExtractor - [aosp/build/tools/extract_kernel.py, --input, build/unzip_boot/kernel, --output-configs, build/unzip_boot/kernel_configs.txt, --output-version, build/unzip_boot/kernel_version.txt]
[main] INFO KernelExtractor - kernel version: [3.10.108]
[main] INFO KernelExtractor - kernel config dumped to : build/unzip_boot/kernel_configs.txt
[main] INFO Parser - ramdisk dumped to: build/unzip_boot/ramdisk.img.gz
[main] INFO Helper - decompress(gz) done: build/unzip_boot/ramdisk.img.gz -> build/unzip_boot/ramdisk.img
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:567)
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:106)
at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:92)
Caused by: java.io.IOException: Cannot run program "cpio" (in directory "build/unzip_boot/root"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at java.base/java.lang.Runtime.exec(Runtime.java:589)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
at cfig.Parser.unpackRamdisk(Parser.kt:31)
at cfig.Parser.extractBootImg(Parser.kt:86)
at cfig.packable.BootImgParser.unpack(BootImgParser.kt:46)
... 8 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:319)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:250)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 18 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-13-openjdk/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
15 actionable tasks: 1 executed, 14 up-to-date
The img like is at bottom.
log:
Task :unpack FAILED
23:32:01:945 WARN PackableLauncher - [boot.img] will be handled by [BootImgParser]
23:32:02:041 WARN PackableLauncher - 'unpack' sequence initialized
23:32:02:045 INFO BootImgParser - header version 1
23:32:02:057 WARN BootHeaderV2 - BootImgHeader constructor
23:32:02:061 INFO Avb - python aosp/avb/avbtool.v1.2.py verify_image --image boot.img
sha256 digest of recovery.img does not match digest in descriptor
aosp/avb/avbtool.v1.2.py: Error verifying descriptor.
Verifying image boot.img using embedded public key
vbmeta: Successfully verified footer and NONE vbmeta struct in boot.img
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:106)
Caused by: java.lang.IllegalArgumentException: boot.img failed integrity check by "python aosp/avb/avbtool.v1.2.py verify_image --image boot.img"
at cfig.Avb$Companion.verifyAVBIntegrity(Avb.kt:474)
at cfig.bootimg.v2.BootV2$Companion.parse(BootV2.kt:98)
at cfig.packable.BootImgParser.unpack(BootImgParser.kt:45)
... 8 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
20 actionable tasks: 1 executed, 19 up-to-date
root@LAPTOP-VDEV89N4:/source/Android_boot_image_editor# cp /mnt/c/d_drive/aosp/lineage-17.1-20210526-recovery-davinci.img boot.img/source/Android_boot_image_editor# ./gradlew unpack
root@LAPTOP-VDEV89N4:
Task :unpack FAILED
23:32:27:693 WARN PackableLauncher - [boot.img] will be handled by [BootImgParser]
23:32:27:786 WARN PackableLauncher - 'unpack' sequence initialized
23:32:27:793 INFO BootImgParser - header version 1
23:32:27:805 WARN BootHeaderV2 - BootImgHeader constructor
23:32:27:810 INFO Avb - python aosp/avb/avbtool.v1.2.py verify_image --image boot.img
sha256 digest of recovery.img does not match digest in descriptor
aosp/avb/avbtool.v1.2.py: Error verifying descriptor.
Verifying image boot.img using embedded public key
vbmeta: Successfully verified footer and NONE vbmeta struct in boot.img
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:106)
Caused by: java.lang.IllegalArgumentException: boot.img failed integrity check by "python aosp/avb/avbtool.v1.2.py verify_image --image boot.img"
at cfig.Avb$Companion.verifyAVBIntegrity(Avb.kt:474)
at cfig.bootimg.v2.BootV2$Companion.parse(BootV2.kt:98)
at cfig.packable.BootImgParser.unpack(BootImgParser.kt:45)
... 8 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
Is there any way to specify your private key for avb siging? If so i dint see one. or what key files should be replaced
Task :unpack
[main] WARN cfig.packable.PackableLauncher - [boot.img] will be handled by [BootImgParser]
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence initialized
[main] INFO cfig.packable.BootImgParser - header version 2
[main] WARN cfig.bootimg.v2.BootHeaderV2 - BootImgHeader constructor
[main] INFO cfig.Avb - python aosp/avb/avbtool.v1.2.py verify_image --image boot.img
Verifying image boot.img using embedded public key
vbmeta: Successfully verified footer and NONE vbmeta struct in boot.img
boot: Successfully verified sha256 hash of boot.img for image of 37031936 bytes
[main] INFO KernelExtractor - [python, aosp/build/tools/extract_kernel.py, --input, build/unzip_boot/kernel, --output-configs, build/unzip_boot/kernel_configs.txt, --output-version, build/unzip_boot/kernel_version.txt]
[main] INFO KernelExtractor - kernel version: [4.14.191]
[main] INFO KernelExtractor - kernel config dumped to : build/unzip_boot/kernel_configs.txt
[main] INFO Helper - CMD: [lz4, -t, build/unzip_boot/ramdisk.img], workDir: null
Error 44 : Unrecognized header : file cannot be decoded
[main] ERROR Helper - org.apache.commons.exec.ExecuteException: Process exited with an error: 44 (Exit value: 44): can not exec command
[main] ERROR cfig.packable.BootImgParser - ramdisk is in unknown format
[main] ERROR cfig.packable.BootImgParser - Parser can not continue
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence completed
git latest
commit 50273a9 (HEAD -> master, tag: android-11, origin/master, origin/HEAD)
Author: cfig [email protected]
Date: Sun Feb 21 23:32:42 2021 +0800
use mavenCentral in light of JCenter shutdown
img file: https://eu.dl.twrp.me/coral/twrp-3.5.0_10-1-coral.img
Hello, is there a Windows version? Looking forward to the Windows version
currently only 'unpack' is supported for boot/vendor_boot V4.
[main] WARN cfig.packable.PackableLauncher - [boot.img] will be handled by [BootImgParser]
[main] WARN cfig.packable.PackableLauncher - 'pack' sequence initialized
[main] INFO Packer - Loading config from build/unzip_boot/bootimg.json
[main] INFO Packer - Deleting boot.img.google ...
[main] INFO Packer - Deleting boot.img.clear ...
[main] INFO Packer - Writing data ...
[main] INFO Packer - [./aosp/system/tools/mkbootimg/mkbootimg.py, --header_version, 1, --base, 0x0, --kernel, build/unzip_boot/kernel, --kernel_offset, 0x8000, --ramdisk_offset, 0x1000000, --pagesize, 4096, --cmdline, console=ttyMSM0,115200n8 earlycon=msm_geni_serial,0xa90000 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=2048 firmware_class.path=/vendor/firmware_mnt/image loop.max_part=7 androidboot.usbcontroller=a600000.dwc3 buildvariant=user, --os_version, 9.0.0, --os_patch_level, 2019-06-00, --tags_offset, 0x100, --id, --output, boot.img.google]
0xcb57d6c13883d5502180dc12992c4033224f97e1000000000000000000000000
[main] INFO Packer - ours hash b9fa59f6d31da829780b142e6070823548eeac39, google's hash 7aae740b6dbd08cc5ace9efea8d98131669964ec
[main] ERROR Packer - Hash verification 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:106)
at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:92)
Caused by: java.lang.UnknownError: Do not know why hash verification fails, maybe a bug
at cfig.Packer.pack(Packer.kt:169)
at cfig.packable.BootImgParser.pack(BootImgParser.kt:72)
... 8 more
FAILURE: Build failed with an exception.
Hello. This tool tells me that my boot image hash is different from google, and then returns a non-zero exit value. How can I skip this error?
我把这里的日志打开,并移动到正则判断前面, 可以看到如下日志
[main] INFO cfig.packable.PackableLauncher - Found: integrationTest.py, ^dtbo\.img$
[main] INFO cfig.packable.PackableLauncher - Found: integrationTest.py, ^vbmeta\.img$
[main] INFO cfig.packable.PackableLauncher - Found: integrationTest.py, ^vbmeta\_[a-z]+.img$
[main] INFO cfig.packable.PackableLauncher - Found: integrationTest.py, ^boot\.img$
[main] INFO cfig.packable.PackableLauncher - Found: integrationTest.py, ^recovery\.img$
[main] INFO cfig.packable.PackableLauncher - Found: integrationTest.py, ^recovery-two-step\.img$
[main] INFO cfig.packable.PackableLauncher - Found: boot.img, ^dtbo\.img$
[main] INFO cfig.packable.PackableLauncher - Found: boot.img, ^vbmeta\.img$
[main] INFO cfig.packable.PackableLauncher - Found: boot.img, ^vbmeta\_[a-z]+.img$
[main] INFO cfig.packable.PackableLauncher - Found: boot.img, ^boot\.img$
[main] WARN cfig.packable.PackableLauncher - Active image target: boot.img
看起来像是判断到了boot.img之后就去跑解包了,并没有继续去匹配其他的文件,这块本来我想改来着,但是我能想到的改动修改略大, 推的PR可能会破坏整体风格,就暂时提了个issue哈
unpacking my Amlogic S905L-2-B based boot.img faild
./gradlew unpack
got this
> Task :unpack FAILED
08:40:29:636 WARN PackableLauncher - [boot.img] will be handled by [BootImgParser]
08:40:29:704 WARN PackableLauncher - 'unpack' sequence initialized
08:40:29:710 INFO BootImgParser - header version 0
08:40:29:719 WARN BootHeaderV2 - BootImgHeader constructor
Cannot extract kernel configs in build/unzip_boot/kernelCannot extract kernel version in build/unzip_boot/kernel08:40:29:918 WARN KernelExtractor - can not parse kernel info
08:40:29:929 INFO Helper - CMD: [lz4, -t, build/unzip_boot/ramdisk.img], workDir: null
Error 44 : Unrecognized header : file cannot be decoded
08:40:29:931 ERROR Helper - org.apache.commons.exec.ExecuteException: Process exited with an error: 44 (Exit value: 44): can not exec command
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:105)
Caused by: java.lang.IllegalArgumentException: ramdisk is in unknown format
at cfig.bootimg.Common$Companion.dumpRamdisk(Common.kt:163)
at cfig.bootimg.v2.BootV2.extractImages(BootV2.kt:192)
at cfig.packable.BootImgParser.unpack(BootImgParser.kt:45)
... 8 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unpack'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
20 actionable tasks: 1 executed, 19 up-to-date
Is Amlogic rom supported?
boot.img.gz
$ ./gradlew unpack
> Task :bbootimg:compileKotlin FAILED
e: /tmp/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (251, 33): Unresolved reference: readAllBytes
e: /tmp/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (252, 30): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
e: /tmp/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (259, 44): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
e: /tmp/Android_boot_image_editor/bbootimg/src/main/kotlin/bootimg/cpio/AndroidCpio.kt: (260, 56): Overload resolution ambiguity:
public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text
public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text
public inline fun String(bytes: ByteArray): String defined in kotlin.text
public inline fun String(chars: CharArray): String defined in kotlin.text
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bbootimg:compileKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
1 actionable task: 1 executed
cat /etc/issue
Ubuntu 20.04.1 LTS
java --version
openjdk 11.0.9.1 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode)
老哥,能不能支持一下 dtbo解包呢, 我现在只能是编译内核,把带dtb的zImage塞进去
vendor boot may have duplicated entries in Android 11, need to root cause it.
copy from redmi note 9 pro global (dotOS rom), 3 files boot.img, vbmeta.img and vbmeta_system.img to
~/Android_boot_image_editor#
result below:
01:54:10:373 INFO BootV2 -
Unpack Summary of boot.img
┌───────────────────────────────────────┬──────────────────────────────────────┐
│What │Where │
└───────────────────────────────────────┴──────────────────────────────────────┘
┌───────────────────────────────────────┬──────────────────────────────────────┐
│image info │build/unzip_boot/boot.json │
├───────────────────────────────────────┼──────────────────────────────────────┤
│AVB info [verified] │build/unzip_boot/boot.avb.json │
├───────────────────────────────────────┼──────────────────────────────────────┤
│kernel │build/unzip_boot/kernel │
│-- version [4.14.234] │build/unzip_boot/kernel_version.txt │
│-- config │build/unzip_boot/kernel_configs.txt │
├───────────────────────────────────────┼──────────────────────────────────────┤
│ramdisk │build/unzip_boot/ramdisk.img.gz │
│-- extracted ramdisk rootfs │build/unzip_boot/root │
├───────────────────────────────────────┼──────────────────────────────────────┤
│dtb │build/unzip_boot/dtb │
└───────────────────────────────────────┴──────────────────────────────────────┘
┌───────────────────────────────────────┬──────────────────────────────────────┐
│vbmeta.img │build/unzip_boot/vbmeta.avb.json │
└───────────────────────────────────────┴──────────────────────────────────────┘
01:54:10:401 WARN PackableLauncher - 'unpack' sequence completed
looks like vbmeta_system.img is no-op at all. Do this vbmeta_system.img also need repack?
When unpacking the attached twrp recovery image, the kernel size is 0.
(Unzip the file first to extract recovery.img)
twrp-3.3.1.img.zip
我clone源代码后,在Windows PowerShell下解包boot.img,遇到如下错误。
`PS E:\linux\boot_editor_r11> .\gradlew.bat pack
Starting a Gradle Daemon (subsequent builds will be faster)
Task :pack
14:53:03:965 WARN PackableLauncher - [boot.img] will be handled by [BootImgParser]
14:53:04:315 WARN PackableLauncher - 'pack' sequence initialized
14:53:04:319 INFO BootImgParser - Loading config from build/unzip_boot/boot.json
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:92)
Caused by: java.io.FileNotFoundException: build\unzip_boot\boot.json (系统找不到指定的路径。)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.(FileInputStream.java:157)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:1029)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3413)
at cfig.packable.BootImgParser.pack(BootImgParser.kt:55)
... 8 more
Task :pack FAILED
FAILURE: Build failed with an exception.
Process 'command 'C:\Program Files\Java\jdk-11.0.10\bin\java.exe'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 50s
11 actionable tasks: 3 executed, 8 up-to-date
PS E:\linux\boot_editor_r11>`
我使用你封装的那个R11包就不会有这个问题。是在线编译的东西出错了吗?
I have recovery.img, which Android_boot_image_editor can unpack, but can't repack back without manual interaction.
In bootimg.json there is such values:
{
"bootimg": {
"args": {
"base": "0x0",
"kernel_offset": "0x80008000",
"ramdisk_offset": "0x81000000",
"second_offset": "0x80f00000",
"tags_offset": "0x80000100",
"pagesize": 2048,
"board": null,
"cmdline": "console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78af000 buildvariant=userdebug",
"os_version": "7.1.2",
"os_patch_level": "2017-11-00",
"id": false
},
"img": {
"kernel_pos": "0x800",
"kernel_len": "0xa6c647",
"ramdisk_pos": "0xa6d000",
"ramdisk_len": "0x4ad065",
"second_pos": "0xf1a800",
"second_len": "0x0",
"hash": "d2309ac6a8538e1b56c6a799c87ee602a9754f19000000000000000000000000"
}
}
}
And ./gradlew pack fails with following error:
> Task :abootimg:pack_clear FAILED
Exception in thread "main" java.lang.NumberFormatException: For input string: "80008000"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:583)
at java.lang.Integer.valueOf(Integer.java:740)
at java.lang.Integer.decode(Integer.java:1197)
at java_lang_Integer$decode.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at cfig.bootimg.CImgInfo.fromJson(CImgInfo.groovy:36)
at cfig.bootimg.CImgInfo$fromJson.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at cfig.bootimg.repack_with_cmd.run(repack_with_cmd.groovy:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:923)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:906)
at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:410)
at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at cfig.bootimg.repack_with_cmd.main(repack_with_cmd.groovy)
FAILURE: Build failed with an exception.
If i change bootimg.json as followed, ./gradlew pack finishes successfully:
{
"bootimg": {
"args": {
"base": "0x70000000",
"kernel_offset": "0x10008000",
"ramdisk_offset": "0x11000000",
"second_offset": "0x10f00000",
"tags_offset": "0x10000100",
"pagesize": 2048,
"board": null,
"cmdline": "console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78af000 buildvariant=userdebug",
"os_version": "7.1.2",
"os_patch_level": "2017-11-00",
"id": false
},
"img": {
"kernel_pos": "0x800",
"kernel_len": "0xa6c647",
"ramdisk_pos": "0xa6d000",
"ramdisk_len": "0x4ad065",
"second_pos": "0xf1a800",
"second_len": "0x0",
"hash": "d2309ac6a8538e1b56c6a799c87ee602a9754f19000000000000000000000000"
}
}
}
Both master and dev branches affected.
scarlet-glass@scarlet-glass-PC:~/Android_boot_image_editor-master$ ./gradlew pack
Task :pack FAILED
09:08:36:540 WARN PackableLauncher - [dtbo.img] will be handled by [DtboParser]
09:08:36:616 WARN PackableLauncher - 'pack' sequence initialized
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:105)
Caused by: java.io.FileNotFoundException: build/unzip_boot/dtbo.header (没有那个文件或目录)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.(FileInputStream.java:157)
at cfig.packable.DtboParser.pack(DtboParser.kt:79)
... 8 more
FAILURE: Build failed with an exception.
Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
23 actionable tasks: 3 executed, 20 up-to-date
scarlet-glass@scarlet-glass-PC:~/Android_boot_image_editor-master$
This is a problem with Google's own unpackbootimg
, so I don't know how much of this can be solved. I want to extract the Android kernel from boot.img of the Pixel 5A (found here ), but for some reason, after extraction, the kernel won't work in QEMU.
Android Verified Boot has 2 versions till now
(1) dm-verity, (verified boot 1.0)
https://source.android.com/security/verifiedboot/
(2) AVB (verified boot 2.0)
https://android.googlesource.com/platform/external/avb/
We need to distinguish the versions from some metadata, and support parsing and packing of AVB.
Getting an error trying to re-pack and unpacked boot.img
from stock Motorola Moto X firmware:
java.lang.NumberFormatException: For input string: "ffffffff80000000"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:592)
at cfig.UnifiedConfig.toArgs(UnifiedConfig.kt:64)
at cfig.Packer.pack(Packer.kt:238)
at cfig.RKt.main(R.kt:10)
The relevantbootimg.json
section:
"recoveryDtbo" : {
"file" : null,
"position" : "0x680800",
"size" : "0x0",
"loadOffset" : "0xffffffff80000000"
}
Not sure if this is due to the phone/firmware (and thus not possible) or fixable with a code enhancement. Happy to help if I can! Just don't really know anything about the boot.img
format.
system: Ubuntu 20.04
log:
./gradlew unpack
Task :unpack
[main] WARN cfig.packable.PackableLauncher - [boot.img] will be handled by [BootImgParser]
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence initialized
[main] INFO cfig.packable.BootImgParser - header version 2
[main] WARN cfig.bootimg.v2.BootHeaderV2 - BootImgHeader constructor
[main] INFO cfig.Avb - python aosp/avb/avbtool.v1.2.py verify_image --image boot.img
[main] ERROR cfig.packable.BootImgParser - boot.img failed integrity check by "python aosp/avb/avbtool.v1.2.py verify_image --image boot.img"
[main] ERROR cfig.packable.BootImgParser - Parser can not continue
[main] WARN cfig.packable.PackableLauncher - 'unpack' sequence completed
BUILD SUCCESSFUL in 3s
13 actionable tasks: 1 executed, 12 up-to-date
Using the unlocked_build.zip available at https://developer.oculus.com/blog/unlocking-oculus-go/ , I was not able to proceed past the unpacking step. Here's my output:
https://paste.debian.net/1218100
I'm using WSL2 Ubuntu if that changes anything.
as title, any chance to do so?
我提取了ROM中的boot-gki.img文件,使用win下的工具解包时报错:
PS E:\linux\boot_editor_r11> .\gradlew unpack [main] WARN cfig.packable.PackableLauncher - No handler is activated, DO NOTHING! PS E:\linux\boot_editor_r11>
大神可以支持解包这个文件吗?
Hey :)
I've successfully unpacked my vbmeta.img and also repacked it. But one thing doesn't work:
As soon as you set algorithm_type = 0 you'll get this issue:
> Task :packClear FAILED
Exception in thread "main" java.io.IOException: Is a directory
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:46)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:159)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at java.nio.file.Files.read(Files.java:3105)
at java.nio.file.Files.readAllBytes(Files.java:3158)
at cfig.Avb.packVbMeta(Avb.kt:324)
at cfig.Avb.packVbMetaWithPadding(Avb.kt:374)
at cfig.Avb.packVbMetaWithPadding$default(Avb.kt:373)
at cfig.RKt.main(R.kt:19)
* What went wrong:
Execution failed for task ':packClear'.
> Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Everything else works perfectly fine
[main] WARN cfig.packable.PackableLauncher - Active image target: boot.img
[main] INFO Packer - Loading config from build/unzip_boot/bootimg.json
[main] INFO Packer - Deleting build/unzip_boot/ramdisk.img.gz ...
[main] INFO Packer - Packing rootfs build/unzip_boot/root ...
[main] INFO Packer - ./aosp/mkbootfs/build/exe/mkbootfs/mkbootfs build/unzip_boot/root
[main] INFO Helper - compress(gz) done: build/unzip_boot/ramdisk.img.gz
[main] INFO Packer - build/unzip_boot/ramdisk.img.gz is ready
Exception in thread "main" java.lang.IllegalArgumentException: headerVersion 23169024 illegal
at cfig.bootimg.BootImgHeader.refresh(BootImgHeader.kt:237)
at cfig.bootimg.BootImgHeader.encode(BootImgHeader.kt:244)
at cfig.Packer.pack(Packer.kt:149)
at cfig.packable.BootImgParser.pack(BootImgParser.kt:71)
at cfig.packable.PackableLauncherKt.main(PackableLauncher.kt:67)
> Task :pack FAILED
:pack (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 4.087 secs.
For V4 vendor_boot.img, we should be able to unpack it as V4, and re-pack it as V3.
RSA public key的生成
除了这些 descriptor 之外,auxiliary data block 中还有一个重要的信息,就是 RSA public key。这个 public key 将被用来校验 authentication data block 中的 signature data。
在 avbtool make_vbmeta_image 时,必须用--key参数来指定生成 signature data 的 RSA private key,AOSP external/avb/test/data 目录下有各种供测试使用 RSA private key,格式为 PEM。avbtool 会根据 RSA private key 提取 public key 并加上 RSA key 的 header 打包进 auxiliary data block。
可以通过avbtool extract_public_key --key ***.pem --output ***.avbpubkey 来生成的 public key。
有办法从vbmeta.img里提取到xxx.avbpubkey,能否通过xxx.avbpubkey计算出私钥xxx.pem?
'SHA256_RSA2048': Algorithm(
algorithm_type=1, # AVB_ALGORITHM_TYPE_SHA256_RSA2048
hash_num_bytes=32,
signature_num_bytes=256,
public_key_num_bytes=8 + 2*2048/8,
padding=[
# PKCS1-v1_5 padding
0x00, 0x01] + [0xff]*202 + [0x00] + [
# ASN.1 header
0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
0x00, 0x04, 0x20,
]),
在添加--algorithm SHA256_RSA2048后他也会直接把--key xxx.pem生成为
public_key_num_bytes=8 + 2*2048/8
一个520bytes的xxx.avbpubkey
或者在生成vbmeta.img不使用--algorithm SHA256_RSA***、--key ***.pem而是直接使用xxx.avbpubkey呢?
这是vivo NEX,使用私钥生成的vbmeta.img,提取出的vivo.avbpubkey
NEX.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.