cfig / Android_boot_image_editor

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

Support for vendor_dlkm img #95

Closed hosiet closed 6 months ago

hosiet commented 1 year ago

I am wondering if you would like to add support for vendor_dlkm images, which is becoming increasingly common as described in https://source.android.com/devices/bootloader/partitions/vendor-odm-dlkm-partition . You may find such partition image from current Pixel 6 ROMs.

-> % ls
aosp      build             gradle       helper              README.md            tools
avbImpl   build.gradle.kts  gradlew      integrationTest.py  settings.gradle.kts  uiderrors
bbootimg  doc               gradlew.bat  LICENSE.md          src                  vendor_dlkm.img

-> % ./gradlew unpack

> Task :unpack FAILED
20:24:39.632 [main] WARN  cfig.packable.PackableLauncher - No handler is activated, DO NOTHING!

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':unpack'.
> Process 'command '/usr/lib/jvm/java-18-openjdk-amd64/bin/java'' finished with non-zero exit value 2
cfig commented 1 year ago

image conversion "sparse image -> raw ext4 image " is supported. But image mounting and editing aren't supported.

cfig commented 1 year ago

BTW, what's your ideal work flow on vendor_dlkm.img ? As the output will be raw ext4/erofs image file, we can use some linux tools(eg. udisksctl) to mount/view/unmount it. And such operations aren't integrated in the tool.

hosiet commented 1 year ago

Thanks for your work. Ideally I am looking for an end-to-end solution on unpacking/editing/repacking an existing vendor_dlkm.img file, but seems that it is not available yet.

For workflow: the mount/view/umount operations should not be a major problem; I was even using regular mount(8) on Linux and that works.

hosiet commented 1 year ago

Besides, with current git HEAD 68afa1834e677d6a5ded459fa2bd35145c7f14cd the unpack action cannot give any results. After running ./gradlew unpack, ./build/unzip_boot/ dir is empty. I have set bHackingMode = true in build.gradle.kts file.

I am attaching the file sample here as well.

% file vendor_dlkm.img
vendor_dlkm.img: Linux rev 1.0 ext2 filesystem data, UUID=15718fdd-fd35-585a-a26d-2215dc1f0c1b, volume name "vendor_dlkm" (extents) (large files) (huge files)

vendor_dlkm.zip

cfig commented 6 months ago

7z is required to extract ext4.

19:04:54.694 [main] INFO  Helper - 7z x build/unzip_boot/vendor_dlkm.img -y -obuild/unzip_boot/vendor_dlkm

I just submited a commit to support the "pack" task. Nicely have a try ~