From 75af56ad575f084e86022f44e3bfd50712809986 Mon Sep 17 00:00:00 2001 From: cfig Date: Tue, 11 Feb 2020 15:37:49 +0800 Subject: [PATCH] packing of boot.img with avbtool now supports property descriptors now avbtool can pack exactly the same boot.img.signed as our Signer if it has only prop-desc and hash-desc --- bbootimg/src/main/kotlin/Signer.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bbootimg/src/main/kotlin/Signer.kt b/bbootimg/src/main/kotlin/Signer.kt index 33d70d8..e705329 100644 --- a/bbootimg/src/main/kotlin/Signer.kt +++ b/bbootimg/src/main/kotlin/Signer.kt @@ -36,13 +36,14 @@ class Signer { val ai = ObjectMapper().readValue(File(Avb.getJsonFileName(cfg.info.output)), AVBInfo::class.java) val alg = Algorithms.get(ai.header!!.algorithm_type.toInt()) val bootDesc = ai.auxBlob!!.hashDescriptors[0] + val newAvbInfo = ObjectMapper().readValue(File(getJsonFileName(cfg.info.output)), AVBInfo::class.java) //our signer File(cfg.info.output + ".clear").copyTo(File(cfg.info.output + ".signed")) Avb().addHashFooter(cfg.info.output + ".signed", info2.imageSize, partition_name = bootDesc.partition_name, - newAvbInfo = ObjectMapper().readValue(File(getJsonFileName(cfg.info.output)), AVBInfo::class.java)) + newAvbInfo = newAvbInfo) //original signer CommandLine.parse("$avbtool add_hash_footer").apply { addArguments("--image ${cfg.info.output}.signed2") @@ -54,6 +55,11 @@ class Signer { if (alg.defaultKey.isNotBlank()) { addArguments("--key ${alg.defaultKey}") } + newAvbInfo.auxBlob?.let { newAuxblob -> + newAuxblob.propertyDescriptor.forEach { newProp -> + addArguments(arrayOf("--prop", "${newProp.key}:${newProp.value}")) + } + } addArgument("--internal_release_string") addArgument(ai.header!!.release_string, false) log.warn(this.toString())