From b701884df2321bcebee936456c9737abbad51041 Mon Sep 17 00:00:00 2001 From: cfig Date: Wed, 20 Apr 2022 00:20:54 +0800 Subject: [PATCH] Issue #86: fix vrt vendor_boot issues - support vendor_boot "board" filed - fix unpack problem when vrt is enabled - add test case - upgrade to kotlin 1.6.21 --- bbootimg/build.gradle.kts | 2 +- bbootimg/src/main/kotlin/bootimg/Common.kt | 6 ++++-- bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt | 6 +++++- helper/build.gradle.kts | 2 +- integrationTest.py | 2 ++ src/integrationTest/resources_2 | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bbootimg/build.gradle.kts b/bbootimg/build.gradle.kts index 7e0caa5..8a6810d 100644 --- a/bbootimg/build.gradle.kts +++ b/bbootimg/build.gradle.kts @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.6.20" + kotlin("jvm") version "1.6.21" application } diff --git a/bbootimg/src/main/kotlin/bootimg/Common.kt b/bbootimg/src/main/kotlin/bootimg/Common.kt index 6d48d1c..a240100 100644 --- a/bbootimg/src/main/kotlin/bootimg/Common.kt +++ b/bbootimg/src/main/kotlin/bootimg/Common.kt @@ -122,7 +122,7 @@ class Common { parseKernelInfo(s.dumpFile) } - fun dumpRamdisk(s: Helper.Slice, root: String): String { + fun dumpRamdisk(s: Helper.Slice, root: String, unpackCpio: Boolean = true): String { var ret = "gz" Helper.extractFile(s.srcFile, s.dumpFile, s.offset.toLong(), s.length) when { @@ -164,7 +164,9 @@ class Common { throw IllegalArgumentException("ramdisk is in unknown format") } } - unpackRamdisk(s.dumpFile, root) + if (unpackCpio) { + unpackRamdisk(s.dumpFile, root) + } return ret } diff --git a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt index d39aad0..ddeb5dd 100644 --- a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt +++ b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt @@ -346,7 +346,8 @@ data class VendorBoot( //ramdisk //@formatter:off val fmt = C.dumpRamdisk( - Helper.Slice(info.output, ramdisk.position.toInt(), ramdisk.size, ramdisk.file), "${workDir}root") + Helper.Slice(info.output, ramdisk.position.toInt(), ramdisk.size, ramdisk.file), "${workDir}root", + this.ramdisk_table.ramdidks.isEmpty()) //@formatter:on this.ramdisk.file = this.ramdisk.file + ".$fmt" //dtb @@ -458,6 +459,9 @@ data class VendorBoot( } } } + if (info.product.isNotBlank()) { + addArgument("--board").addArgument(info.product) + } addArgument("--dtb").addArgument(dtb.file) addArgument("--vendor_cmdline").addArgument(info.cmdline, false) addArgument("--header_version").addArgument(info.headerVersion.toString()) diff --git a/helper/build.gradle.kts b/helper/build.gradle.kts index d953c19..8feb1bb 100644 --- a/helper/build.gradle.kts +++ b/helper/build.gradle.kts @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id("org.jetbrains.kotlin.jvm") version "1.6.20" + id("org.jetbrains.kotlin.jvm") version "1.6.21" `java-library` application } diff --git a/integrationTest.py b/integrationTest.py index 84f6774..6db1659 100755 --- a/integrationTest.py +++ b/integrationTest.py @@ -163,6 +163,8 @@ def main(): log.info("dtbo not fully supported on MacOS, skip testing") # Issue 83: init_boot verifySingleDir(resDir2, "issue_83") + # Issue 86: vendor_boot with vrt and board name + verifySingleDir(resDir2, "issue_86") log.info(successLogo) diff --git a/src/integrationTest/resources_2 b/src/integrationTest/resources_2 index dc7e1b6..b4c46ec 160000 --- a/src/integrationTest/resources_2 +++ b/src/integrationTest/resources_2 @@ -1 +1 @@ -Subproject commit dc7e1b693d328e2abbe3158ff98f971f3bcae917 +Subproject commit b4c46ec5b4e9da09a1142058d63b054e9fd2cddc