diff --git a/README.md b/README.md index 57931e3..ffe7edb 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,35 @@ Please note that to use 'gradle flash', your host machine must be connectted to +
+ edit device-tree blob(dtb) inside vendor_boot.img + +If you want to edit the device-tree blob in place: + +```bash +cp vendor_boot.img +cp vbmeta.img +./gradlew unpack +==> now you can edit build/unzip_boot/dtb.src directly +./gradlew pack +``` + +During unpack stage, dtb will be dumped to file `build/unzip_boot/dtb`, dts will be decompiled to `build/unzip_boot/dtb.src`. +You can edit `dtb.src` directly, and it will be compiled to dtb duing repack stage. + +If you just want to replace the dtb with the one that is compiled outside this tool, please + +```bash +cp vendor_boot.img +cp vbmeta.img +./gradlew unpack +rm build/unzip_boot/dtb.src +cp build/unzip_boot/dtb +./gradlew pack +``` + +
+
working with system.img diff --git a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt index e95f4ca..da4412f 100644 --- a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt +++ b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt @@ -23,6 +23,7 @@ import cfig.bootimg.Signer import cfig.helper.Helper import cfig.helper.Dumpling import cfig.packable.VBMetaParser +import cfig.utils.DTC import com.fasterxml.jackson.databind.ObjectMapper import de.vandermeer.asciitable.AsciiTable import org.apache.commons.exec.CommandLine @@ -264,6 +265,10 @@ data class VendorBoot( this.ramdisk.size = this.ramdisk_table.ramdidks.sumOf { File(it.file).length() }.toInt() } } + //update dtb + if (File(this.dtb.file + ".src").exists()) { + check(DTC().compile(this.dtb.file + ".src", this.dtb.file)) { "fail to compile dts" } + } this.dtb.size = File(this.dtb.file).length().toInt() //header FileOutputStream(this.info.output + ".clear", false).use { fos -> diff --git a/src/integrationTest/resources_2 b/src/integrationTest/resources_2 index 9204d80..03c9b42 160000 --- a/src/integrationTest/resources_2 +++ b/src/integrationTest/resources_2 @@ -1 +1 @@ -Subproject commit 9204d80a97535f5284f96f7f145edeae7d02cec4 +Subproject commit 03c9b422e4cc418e2484b7bfeef97d8f3e920db9