Issue #107: accept the new change in dtc 1.6.1

pull/140/head v13
cfig 3 years ago
parent e14887192a
commit d7ea80a5c2
No known key found for this signature in database
GPG Key ID: B104C307F0FDABB7

@ -37,6 +37,9 @@ jobs:
- name: Unit Test
run: ./gradlew check && ./gradlew clean || true
- name: enable gradle native
run: sed -i "s/bHackingMode = false/bHackingMode = true/g" build.gradle.kts
# Runs a set of commands using the runners shell
- name: Integration Test
run: |

@ -182,12 +182,12 @@ If you want to edit the device-tree blob in place:
cp <your_vendor_boot_image> vendor_boot.img
cp <your_vbmeta_image> vbmeta.img
./gradlew unpack
==> now you can edit build/unzip_boot/dtb.src directly
==> now you can edit build/unzip_boot/dtb.dts 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.
During unpack stage, dtb will be dumped to file `build/unzip_boot/dtb`, dts will be decompiled to `build/unzip_boot/dtb.dts`.
You can edit `dtb.dts` 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
@ -195,7 +195,7 @@ If you just want to replace the dtb with the one that is compiled outside this t
cp <your_vendor_boot_image> vendor_boot.img
cp <your_vbmeta_image> vbmeta.img
./gradlew unpack
rm build/unzip_boot/dtb.src
rm build/unzip_boot/dtb.dts
cp <your_dtb> build/unzip_boot/dtb
./gradlew pack
```

@ -182,7 +182,7 @@ class Common {
Helper.extractFile(s.srcFile, s.dumpFile, s.offset.toLong(), s.length)
//extract DTB
if (EnvironmentVerifier().hasDtc) {
DTC().decompile(s.dumpFile, s.dumpFile + ".src")
DTC().decompile(s.dumpFile, s.dumpFile + "." + Helper.prop("config.dts_suffix"))
}
}

@ -80,6 +80,7 @@ data class BootV2(
private val log = LoggerFactory.getLogger(BootV2::class.java)
private val workDir = Helper.prop("workDir")
private val mapper = ObjectMapper()
private val dtsSuffix = Helper.prop("config.dts_suffix")
fun parse(fileName: String): BootV2 {
val ret = BootV2()
@ -305,8 +306,8 @@ data class BootV2(
if (theDtb.size > 0) {
it.addRule()
it.addRow("dtb", theDtb.file)
if (File(theDtb.file + ".src").exists()) {
it.addRow("\\-- decompiled dts", theDtb.file + ".src")
if (File(theDtb.file + ".${dtsSuffix}").exists()) {
it.addRow("\\-- decompiled dts", theDtb.file + ".${dtsSuffix}")
}
}
}
@ -386,8 +387,8 @@ data class BootV2(
}
//refresh dtb size
dtb?.let { theDtb ->
if (File(theDtb.file!! + ".src").exists()) {
check(DTC().compile(theDtb.file!! + ".src", theDtb.file!!)) { "fail to compile dts" }
if (File(theDtb.file!! + ".${dtsSuffix}").exists()) {
check(DTC().compile(theDtb.file!! + ".${dtsSuffix}", theDtb.file!!)) { "fail to compile dts" }
}
theDtb.size = File(theDtb.file!!).length().toInt()
}

@ -78,6 +78,7 @@ data class BootV2Dialects(
companion object {
private val log = LoggerFactory.getLogger(BootV2Dialects::class.java)
private val workDir = Helper.prop("workDir")
private val dtsSuffix = Helper.prop("config.dts_suffix")
fun parse(fileName: String): BootV2Dialects {
val ret = BootV2Dialects()
@ -313,8 +314,8 @@ data class BootV2Dialects(
if (theDtb.size > 0) {
it.addRule()
it.addRow("dtb", theDtb.file)
if (File(theDtb.file + ".src").exists()) {
it.addRow("\\-- decompiled dts", theDtb.file + ".src")
if (File(theDtb.file + ".${dtsSuffix}").exists()) {
it.addRow("\\-- decompiled dts", theDtb.file + ".${dtsSuffix}")
}
}
}

@ -158,6 +158,7 @@ data class VendorBoot(
private val log = LoggerFactory.getLogger(VendorBoot::class.java)
private val workDir = Helper.prop("workDir")
private val mapper = ObjectMapper()
private val dtsSuffix = Helper.prop("config.dts_suffix")
fun parse(fileName: String): VendorBoot {
val ret = VendorBoot()
FileInputStream(fileName).use { fis ->
@ -266,8 +267,8 @@ data class VendorBoot(
}
}
//update dtb
if (File(this.dtb.file + ".src").exists()) {
check(DTC().compile(this.dtb.file + ".src", this.dtb.file)) { "fail to compile dts" }
if (File(this.dtb.file + ".${dtsSuffix}").exists()) {
check(DTC().compile(this.dtb.file + ".${dtsSuffix}", this.dtb.file)) { "fail to compile dts" }
}
this.dtb.size = File(this.dtb.file).length().toInt()
//header
@ -421,8 +422,8 @@ data class VendorBoot(
}
it.addRule()
it.addRow("dtb", this.dtb.file)
if (File(this.dtb.file + ".src").exists()) {
it.addRow("\\-- decompiled dts", dtb.file + ".src")
if (File(this.dtb.file + ".${dtsSuffix}").exists()) {
it.addRow("\\-- decompiled dts", dtb.file + ".${dtsSuffix}")
}
if (this.bootconfig.size > 0) {
it.addRule()

@ -36,6 +36,7 @@ class DtboParser(val workDir: File) : IPackable {
private val log = LoggerFactory.getLogger(DtboParser::class.java)
private val envv = EnvironmentVerifier()
private val dtboMaker = Helper.prop("dtboMaker")
private val dtsSuffix = Helper.prop("config.dts_suffix")
override fun capabilities(): List<String> {
return listOf("^dtbo\\.img$")
@ -139,7 +140,7 @@ class DtboParser(val workDir: File) : IPackable {
if (envv.hasDtc) {
for (i in 0 until Integer.parseInt(props.getProperty("dt_entry_count"))) {
val inputDtb = "$dtbPath.$i"
val outputSrc = File(outDir + "/" + File(inputDtb).name + ".src").path
val outputSrc = File(outDir + "/" + File(inputDtb).name + ".${dtsSuffix}").path
DTC().decompile(inputDtb, outputSrc)
}
} else {

@ -152,6 +152,7 @@ class Dtbo(
private val log = LoggerFactory.getLogger(Dtbo::class.java)
private val outDir = Helper.prop("workDir")
private val dtsSuffix = Helper.prop("config.dts_suffix")
}
fun extractVBMeta(): Dtbo {
@ -186,7 +187,7 @@ class Dtbo(
.toInt()
// Part II - a
for (index in 0 until dtEntries.size) {
DTC().compile("${outDir}dt/dt.${index}.src", "${outDir}dt/dt.${index}")
DTC().compile("${outDir}dt/dt.${index}.${dtsSuffix}", "${outDir}dt/dt.${index}")
}
// Part II - b
var offset = DtboHeader.SIZE + (header.entryCount * DeviceTreeTableEntry.SIZE)
@ -221,7 +222,7 @@ class Dtbo(
it.addRow("image info", outDir + info.output.removeSuffix(".img") + ".json")
it.addRule()
it.addRow("device-tree blob (${this.header.entryCount} blobs)", "${outDir}dt/dt.*")
it.addRow("\\-- device-tree source ", "${outDir}dt/dt.*.src")
it.addRow("\\-- device-tree source ", "${outDir}dt/dt.*.${dtsSuffix}")
it.addRule()
it.addRow("AVB info", Avb.getJsonFileName(info.output))
it.addRule()

@ -11,3 +11,4 @@ mkbootimg = aosp/system/tools/mkbootimg/mkbootimg.py
dtboMaker = aosp/system/libufdt/utils/src/mkdtboimg.py
payloadDir = build/payload/
config.allow_cpio_duplicate = true
config.dts_suffix = dts

@ -78,7 +78,7 @@ def verifySingleJson(jsonFile, func = None):
subprocess.check_call(gradleWrapper + " pack", shell = True)
for k, v in verifyItems["hash"].items():
log.info("%s : %s" % (k, v))
unittest.TestCase().assertEqual(v, hashFile(k))
unittest.TestCase().assertIn(hashFile(k), v.split())
try:
subprocess.check_call(gradleWrapper + " clear", shell = True)
except Exception as e:
@ -161,9 +161,8 @@ def main():
verifySingleJson("%s/issue_59/recovery.json" % resDir2, func = lambda: shutil.rmtree("build/unzip_boot/root", ignore_errors = False))
# Issue 71: dtbo
if platform.system() != "Darwin":
pass
#verifySingleDir(resDir2, "issue_71")
#verifySingleDir(resDir2, "issue_71/redfin")
verifySingleDir(resDir2, "issue_71")
verifySingleDir(resDir2, "issue_71/redfin")
else:
log.info("dtbo not fully supported on MacOS, skip testing")
# Issue 83: init_boot

@ -1 +1 @@
Subproject commit 0f9f57cb3b25ab299acfeb3d2e80b2ad488ff17a
Subproject commit d683034c3e83818b3a1264331b281df650fc2e6b

@ -1 +1 @@
Subproject commit 03c9b422e4cc418e2484b7bfeef97d8f3e920db9
Subproject commit be8c5a2fb19b43ba2b1a8c8d3e29b0d3bbaec958
Loading…
Cancel
Save