Android boot image editor

Android boot image editor

Обработка (распаковка и сборка) прошивок и образов (*.img, *.bin) строго под WINDOWS

Эта тема создана для продолжения обсуждения и помощи в обработке различных образов под Windows.

Полезное
(Примеры, варианты, утилиты, кухни, скрипты, обработки разных образов)

  1. Multi Image Kitchen — Программа распаковки и упаковки Android образов разделов (в том числе и распаковка super.img)
  2. Распаковка, упаковка super.img
  3. superunpack для распаковки образов super.img + Подробности
  4. Две утилиты для запаковки обычных образов в sparse образ
  5. UnpackerSystemNew
  6. Распаковщик payload.bin
  7. Работа с system.new.dat1
  8. UNIX-атрибуты (права, UID, GID) на файлы и папки в WINDOWS
  9. Форматы образов, утилиты и примеры их обработки
  10. Модификация стокового RECOVERY под CWM своими руками
  11. Извлечение рамдиска из recovery.img от Lenovo K900(x86) посредством WinHex
  12. Извлечение керенел из recovery.img от Lenovo K900(x86) посредством WinHex
  13. Добавление модифицированного рамдиска в recovery.img от Lenovo K900(x86) посредством WinHex
  14. Анализ формата SIN 3 версии образов из прошивки для Sony Xperia
  15. Разбор образа IFWI на блоки (использующиеся при прошивке через MFT(xFSTK) для устройств на базе x86 Android) посредством WinHex
  16. Инструкция по извлечению ядра и recovery из fwu_image.bin
  17. Преобразование system.new.dat.br в system.new.dat и обратно
  18. Как пропатчить system.img на ПК не прошивая ОТА на смарте если файл system.patch.dat > 0
  19. Сборник скриптов для для работы с образами

make_ext4fs — утилита для сборки образов в формате EXT4 и SPARSE EXT4 (добавлен способ сборки system через ‘таскание мышкой’)

AndImgTool (Android Image Tool)

Утилита для распаковки и обратной сборки загрузочных образов типа BOOT и RECOVERY для ARM-платформы, неважно какой проц устройства (рокчип, медиатек и т.д. и т.п.), важно какого стандарта придерживался производитель! На данный момент поддерживаются следующие форматы: Android Boot Image (так же и с оберткой MTK внутренних блоков кернела и рамдиска и с новым блоком DTB), KRNL Image, UBOOT Image (форматы паковки: none, LZMA, GZIP), распаковка\запаковка полных прошивок для RockChip (RKFW\RKAF)
Подробнее про утилиту, список протестированных устройств , инструкция, скрины и логи тут.

AndImgTool версия 1.3.0 Обновлено: 30.12.2014 релиз и подробности тут
— Добавлена поддержка распаковки\запаковки x86 загрузочных образов (функционал перенесен из утилиты xImgTool)

AndImgTool версия 1.2.3 AndImgTool_1_2_3.rar ( 196.69 КБ )
Обновлено: 13.11.2014 — обновление функционала, подробности тут

— основная утилита для распаковки образов файловых систем типа system, userdata, cache, secro (расширение может быть любое, например img или ext4).
Поддерживаются следующие форматы файловых систем: EXT2\EXT3\EXT4\YAFFS2\CRAMFS, форматы структуры образов (обертки) SPARSE\SIN( 1, 2 и 3 версии)\MOTO, поддерживается конвертация образа файловой системы формата EXT4 из обертки SIN или SPARSE непосредственно в EXT4, реализован вывод информации о суперблоке для образов файловых систем, дальше будет развиваться именно эта утилита.

ImgExtractor версия 1.3.7 Обновлено: 13.02.2015 релиз и подробности тут
— добавлена поддержка распаковки образов SPARSE-Marvell для MOTO
— исправлено падение утилиты при распаковке образов содержащих файлы с символами «?»
— добавлена идентификация формата UBIFS и обертки MOTO внутри SPARSE формата
— добавлена конвертация образов из EXT3\EXT4 в SPARSE с разбиением на файлы меньшего размера

— утилита для распаковки\запаковки загрузочных образов (IMG, BIN) и контейнеров (INB, SZB, QSB ) для устройств на базе x86 Android Platform (Lenovo K900, Ramos i9, Asus ZenFone 4,5,6, ZTE Geek)

xImgTool версия 1.3.32xImgTool_1_3_32.rar ( 40.86 КБ )
ОБНОВЛЕНО: 06.11.2014
— поддержка нового размера блока bootstub
— сохранение новых атрибутов в блоке размеров
— при распаковке контейнера QSB части, участвующие при объединении в один файл, сохраняются в отдельной папке в оригинальном виде (особенно касается образов system и userdata)

В связи с тем, что основной функционал кухни перешел в единую утилиту AndImgTool, не требующую для своей работы никаких дополнительных CYGWIN DLL, настоятельно рекомендую использовать для работы с загрузочными образами именно AndImgTool (для образов файловых систем есть единая утилита ImgExtractor), поскольку пересборок кухни больше не планируется.

Мой вариант кухни для распаковки целиковых прошивок под Rockchip, MTK и их содержимого. Изначально делал эту модификацию под себя — для удобства вытаскивания файлов system из разных прошивок, оригинальная версия тут.

24.02.2014 Обновлено
Утилита ImgExtractor

Для облегчения конвертации system от MOTO G и CreateFSimage.bat — для облегчения сборки любого образа в EXT3\EXT4 (ранее был выложен тут)
RKwinToolsMod версия 2.8 RKwinToolsMod_v2_8.rar ( 6.43 МБ )

13.02.2014 ОБНОВЛЕНО
— Обновлена утилита ImgExtractor (текущая версия 1.3.1), использующаяся для распаковки system.img в форматах EXT2\EXT3\EXT4\SPARSE\YAFFS2\CRAMFS
— Исправлена проблема с правами (владельцем и группами) при сборке образов в формате YAFFS2 ( про обнаруженные проблемы и их решение можно прочитать тут и тут)
RKwinToolsMod версия 2.6 RKwinToolsMod_v2_6.rar ( 6.38 МБ )

Источник

Parsing and re-packing Android boot.img/vbmeta.img, supporting Android 12(preview)

Overview

A tool for reverse engineering Android ROM images.

install required packages

Mac: brew install lz4 xz dtc

Linux: sudo apt install git device-tree-compiler lz4 xz-utils zlib1g-dev openjdk-11-jdk gcc g++ python3

Windows Subsystem for Linux(WSL): sudo apt install git device-tree-compiler lz4 xz-utils zlib1g-dev openjdk-11-jdk gcc g++ python

Windows: Make sure you have python3 , JDK9+ and openssl properly installed. An easy way is to install Anaconda and Oracle JDK 11, then run the program under anaconda PowerShell.

Parsing and packing

Put your boot.img to current directory, then start gradle ‘unpack’ task:

Your get the flattened kernel and /root filesystem under ./build/unzip_boot:

Then you can edit the actual file contents, like rootfs or kernel. Now, pack the boot.img again

You get the repacked boot.img at $(CURDIR):

Well done you did it! The last step is to star this repo :smile

Читайте также:  Fitbit app with android

Supported ROM image types

Image Type file names platforms
boot images boot.img, vendor_boot.img all
recovery images recovery.img, recovery-two-step.img all
vbmeta images vbmeta.img, vbmeta_system.img etc. all
dtbo images dtbo.img linux & mac
sparse images system.img, vendor.img, product.img etc. linux & mac

Please note that the boot.img MUST follows AOSP verified boot flow, either Boot image signature in VBoot 1.0 or AVB HASH footer (a.k.a. AVB) in VBoot 2.0.

Device Model Manufacturer Compatible Android Version Note
ADT-3 (adt3) Askey/Google Y 12 (spp2.210219.010) amlogic inside,
Android TV
Pixel 3 (blueline) Google Y 12 (spp2.210219.008,
2021)
Pixel 3 (blueline) Google Y 11 (RP1A.200720.009,
2020)
more .
Pixel 3 (blueline) Google Y Q preview (qpp2.190228.023,
2019)
more .
Redmi K30 4G (phoenix[n]) XiaoMi Y 10 verified by @eebssk1
TS10 Topway Y 10 car headunit, @mariodantas
Pixel XL (marlin) HTC Y 9.0.0 (PPR2.180905.006,
Sep 2018)
more .
K3 (CPH1955) OPPO Y for recovery.img
N for boot.img
Pie more
Z18 (NX606J) ZTE Y 8.1.0 more.
Nexus 9 (volantis/flounder) HTC Y(with some tricks) 7.1.1 (N9F27M, Oct 2017) tricks
Nexus 5x (bullhead) LG Y 6.0.0_r12 (MDA89E)
Moto X (2013) T-Mobile Motorola N
X7 (PD1602_A_3.12.8) VIVO N ? Issue 35

Please remember to clean the work directory first.

If your vbmeta.img contains hash of boot.img, you MUST update vbmeta image together.

Your boot.img.signed and vbmeta.img.signd will be updated together, then you can flash them to your device.

working with vendor_boot.img + vbmeta.img (Pixel 5 etc.) Most devices include hash descriptor of vendor_boot.img in vbmeta.img, so if you need to modify vendor_boot.img, you need to update vbmeta.img together.

Please note that to use ‘gradle flash’, your host machine must be connectted to your DUT with adb, and you already ‘adb root’.

How to disable AVB verification

The idea is to set flag=2 in main vbmeta.

Then flash vbmeta.img.signed to your device.

Read layout of Android boot.img and vendor_boot.img.

References and Acknowledgement

This project is developed with products by Jetbrains.

Issues

gradlew unpack error

system: Ubuntu 20.04 log:

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

need some help using the tool

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.

  • What went wrong: Execution failed for task ‘:unpack’.

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

gradlew unpack error on Ubuntu 20.04.1

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)

Lzma early than lz4.

vbmeta pack FAILED

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.

  • What went wrong: Execution failed for task ‘:pack’.

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

unknown issue caused fail on pack

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.

  • What went wrong: Execution failed for task ‘:pack’.

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

An error was encountered while packaging the boot image.

[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:640×400,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?

how to fix pack boot V3

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

`pack` task not working for dtbo load offset value `0xffffffff80000000`

Getting an error trying to re-pack and unpacked boot.img from stock Motorola Moto X firmware:

The relevant bootimg.json section:

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.

Invalid NativePlatform: linux_aarch64

[email protected]:/home/serval# cd Android_boot_image_editor [email protected]:/home/serval/Android_boot_image_editor# ./gradlew unpack ������������

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ‘:aosp:mkbootfs’.

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

Can you add the clean command of the tool?

Hi,you made a good job for us.Now I can modify the img files of andorid 11 easily.

If I need to modify a new file,I have to delete the old files manual.I think the command id very necessary。

Failed to Unpack Oculus Go Image

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:

I’m using WSL2 Ubuntu if that changes anything.

./gradlew: No such file or directory

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.

打包dtbo.img报错

/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.

  • What went wrong: Execution failed for task ‘:pack’.

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.

BUILD FAILED in 2s 23 actionable tasks: 3 executed, 20 up-to-date [email protected]:

support vendor_boot header version downgrade from 4 to 3

For V4 vendor_boot.img, we should be able to unpack it as V4, and re-pack it as V3.

vbmeta_system.img

copy from redmi note 9 pro global (dotOS rom), 3 files boot.img, vbmeta.img and vbmeta_system.img to

looks like vbmeta_system.img is no-op at all. Do this vbmeta_system.img also need repack?

ubuntu 20.04 and ubuntu 16.04

fail to pack. on ubuntu 16.04 need c11 and on ubuntu nee java. upload ehen in home

on ubuntu 16 with this sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-11-jre openjdk-11-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev gcc-multilib maven tmux screen w3m ncftp

Task :aosp:mkbootfs.10:compileMkbootfsExecutableMkbootfsCpp FAILED In file included from /usr/include/c++/5/cstdint:35:0, from /home/ubuntu/Desktop/stock/aosp/mkbootfs.10/src/mkbootfs/cpp/mkbootfs.c:17: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support
^

In file included from /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp:37:0: /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:11:17: error: ‘string_view’ is not a member of ‘std’ bool StartsWith(std::string_view s, std::string_view prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:11:37: error: ‘string_view’ is not a member of ‘std’ bool StartsWith(std::string_view s, std::string_view prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:11:60: error: expression list treated as compound expression in initializer [-fpermissive] bool StartsWith(std::string_view s, std::string_view prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:12:22: error: redefinition of ‘bool android::base::StartsWith’ bool StartsWith(std::string_view s, char prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:11:6: note: ‘bool android::base::StartsWith’ previously defined here bool StartsWith(std::string_view s, std::string_view prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:12:17: error: ‘string_view’ is not a member of ‘std’ bool StartsWith(std::string_view s, char prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:12:37: error: expected primary-expression before ‘char’ bool StartsWith(std::string_view s, char prefix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:15:15: error: ‘string_view’ is not a member of ‘std’ bool EndsWith(std::string_view s, std::string_view suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:15:35: error: ‘string_view’ is not a member of ‘std’ bool EndsWith(std::string_view s, std::string_view suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:15:58: error: expression list treated as compound expression in initializer [-fpermissive] bool EndsWith(std::string_view s, std::string_view suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:16:20: error: redefinition of ‘bool android::base::EndsWith’ bool EndsWith(std::string_view s, char suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:15:6: note: ‘bool android::base::EndsWith’ previously defined here bool EndsWith(std::string_view s, std::string_view suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:16:15: error: ‘string_view’ is not a member of ‘std’ bool EndsWith(std::string_view s, char suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/headers/android-base/strings.h:16:35: error: expected primary-expression before ‘char’ bool EndsWith(std::string_view s, char suffix); ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp: In function ‘bool is_partition(const string&)’: /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp:259:43: error: ‘android::base::StartsWith’ cannot be used as a function if (StartsWith(path, partitions[i])) return true; ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp: In function ‘bool fs_config_cmp(bool, const char*, size_t, const char*, size_t)’: /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp:273:33: error: ‘android::base::EndsWith’ cannot be used as a function if (!EndsWith(input, «/»)) < ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp:277:36: error: ‘android::base::EndsWith’ cannot be used as a function if (!EndsWith(pattern, "/*")) < ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp:278:38: error: ‘android::base::EndsWith’ cannot be used as a function if (EndsWith(pattern, "/")) < ^ /home/ubuntu/Desktop/stock/aosp/mkbootfs.11/src/mkbootfs/cpp/fs_config.cpp:295:48: error: ‘android::base::StartsWith’ cannot be used as a function if (StartsWith(input, logical_partition)) < ^

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong: Execution failed for task ‘:aosp:mkbootfs.10:compileMkbootfsExecutableMkbootfsCpp’.

A build operation failed. C++ compiler failed while compiling mkbootfs.c. See the complete log at: file:///home/ubuntu/Desktop/stock/aosp/mkbootfs.10/build/tmp/compileMkbootfsExecutableMkbootfsCpp/output.txt C++ compiler failed while compiling mkbootfs.c.

  • 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. ==============================================================================

2: Task failed with an exception.

  • What went wrong: Execution failed for task ‘:aosp:mkbootfs.11:compileMkbootfsExecutableMkbootfsCpp’.

Multiple build operations failed. C++ compiler failed while compiling strings.cpp. C++ compiler failed while compiling fs_config.cpp. See the complete log at: file:///home/ubuntu/Desktop/stock/aosp/mkbootfs.11/build/tmp/compileMkbootfsExecutableMkbootfsCpp/output.txt C++ compiler failed while compiling strings.cpp. C++ compiler failed while compiling fs_config.cpp.

  • 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. ==============================================================================

on ubuntu 20.10 comment: java empty i need to revert stock recovery.img android 11 becouse son of bitches realme has prohibite downgrade for european versions. Downgrade is only allowed for indian versions. I try indian version and it destroy partitions. When try restore stock recovery.img it dont detect hard disk of smartphone include wifi and etc. Now when developers help me i will try move stock recovery.img kernel to twrp android 10 realme x50 pro kernel and try from there.

What is trange: i try flash android 10 stock boot.img and recovery.img and it directly go in fastboot mode.

When try restore stock boot.img and rescovery.img after restart it go stock recovery. So if twrp kernel move work maybe it will run. I have fully twrp backup from android 10 but i need twrp to run it.

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:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) 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:235) at cfig.bootimg.Common$Companion.writePaddedFile(Common.kt:311) at cfig.bootimg.v2.BootV2.pack(BootV2.kt:390) at cfig.packable.BootImgParser.pack(BootImgParser.kt:60) . 8 more

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:pack’.

Process ‘command ‘/usr/lib/jvm/java-15-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 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 9s 23 actionable tasks: 8 executed, 15 up-to-date

compatibility check: verify as many ROMs and devices as possible

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.

Источник

Читайте также:  Где хранятся резервные копии андроида
Оцените статью