diff --git a/bbootimg/src/main/kotlin/avb/Avb.kt b/bbootimg/src/main/kotlin/avb/Avb.kt index 68d33ef..59a7ed6 100644 --- a/bbootimg/src/main/kotlin/avb/Avb.kt +++ b/bbootimg/src/main/kotlin/avb/Avb.kt @@ -208,7 +208,7 @@ class Avb { when (desc) { HashDescriptor::class -> { val partitionName = readBackInfo.auxBlob!!.hashDescriptors.get(0).partition_name - log.warn("partitionName=$partitionName") + log.info("partitionName=$partitionName") //read hashDescriptor from image check(newHashDesc.auxBlob!!.hashDescriptors.size == 1) var seq = -1 //means not found @@ -238,7 +238,7 @@ class Avb { } HashTreeDescriptor::class -> { val partitionName = readBackInfo.auxBlob!!.hashTreeDescriptors.get(0).partition_name - log.warn("partitionName=$partitionName") + log.info("partitionName=$partitionName") //read hashTreeDescriptor from image check(newHashDesc.auxBlob!!.hashTreeDescriptors.size == 1) var seq = -1 //means not found diff --git a/bbootimg/src/main/kotlin/rom/sparse/ErofsGenerator.kt b/bbootimg/src/main/kotlin/rom/sparse/ErofsGenerator.kt index 06ad5f6..0608745 100644 --- a/bbootimg/src/main/kotlin/rom/sparse/ErofsGenerator.kt +++ b/bbootimg/src/main/kotlin/rom/sparse/ErofsGenerator.kt @@ -18,12 +18,14 @@ class ErofsGenerator(inPartitionName: String) : BaseGenerator(inPartitionName, A ) { log.warn("pack: $mount_point, $productOut, $srcDir") + // update signing args val newArgs = StringBuilder("--hash_algorithm " + ai.auxBlob!!.hashTreeDescriptors.get(0).hash_algorithm) ai.auxBlob!!.propertyDescriptors.forEach { newArgs.append(" ") newArgs.append("--prop ${it.key}:${it.value}") } + salt = Helper.toHexString(ai.auxBlob!!.hashTreeDescriptors.get(0)!!.salt) log.info("newArgs: $newArgs") signingArgs = newArgs.toString() @@ -46,22 +48,23 @@ class ErofsGenerator(inPartitionName: String) : BaseGenerator(inPartitionName, A val ret2 = Helper.powerRun("du -b -k -s $image_file", null) var partition_size = String(ret2.get(0)).split("\\s".toRegex()).get(0).toLong() * 1024 - log.info("partition_size(raw): $partition_size") + log.info("[calc 1/5] partition_size(raw): $partition_size") + partition_size = calculateSizeAndReserved(partition_size) + log.info("[calc 2/5] partition_size(calc reserve): $partition_size") partition_size = Helper.round_to_multiple(partition_size, 4096) - log.info("partition_size(round 4k): $partition_size") - val verityImageBuilder = ErofsGenerator(mount_point) + log.info("[calc 3/5] partition_size(round 4k): $partition_size") - partition_size = verityImageBuilder.calculateSizeAndReserved(partition_size) - log.info("partition_size(calc reserve): $partition_size") - partition_size = verityImageBuilder.calculateDynamicPartitionSize(partition_size) - log.info("partition_size(calc dynamic): $partition_size") + partition_size = super.calculateDynamicPartitionSize(partition_size) + log.info("[calc 4/5] partition_size(calc dynamic): $partition_size") log.info("Allocating $partition_size for $partitionName") - partition_size = verityImageBuilder.calculateMaxImageSize(partition_size) - log.info("partition_size(calc max): $partition_size") + val partitionSize = partition_size + partition_size = super.calculateMaxImageSize(partition_size) + log.info("[calc 5/5] partition_size(calc max): $partition_size") - val image_size = File(image_file).length() - - verityImageBuilder.addFooter(image_file) + val imageSize = File(image_file).length() + log.info("info_dict: imageSize = $imageSize") + log.info("info_dict: partitionSize = $partitionSize") + super.addFooter(image_file) } override fun calculateSizeAndReserved(size: Long): Long { diff --git a/bbootimg/src/main/kotlin/rom/sparse/SparseImage.kt b/bbootimg/src/main/kotlin/rom/sparse/SparseImage.kt index 47fb153..5a58fd6 100644 --- a/bbootimg/src/main/kotlin/rom/sparse/SparseImage.kt +++ b/bbootimg/src/main/kotlin/rom/sparse/SparseImage.kt @@ -44,7 +44,7 @@ data class SparseImage(var info: SparseInfo = SparseInfo()) { partName, workDir, workDir + File(info.output).nameWithoutExtension, - "${info.output}.signed" + workDir + "${info.output}.signed" ) } @@ -117,7 +117,7 @@ data class SparseImage(var info: SparseInfo = SparseInfo()) { fun unwrap(): SparseImage { if (info.outerFsType == "sparse") { - img2simg(workDir + File(info.pulp).name + ".signed", File(info.output).name + ".signed") + img2simg(workDir + File(info.output).name + ".signed", File(info.output).name + ".signed") } else { val s = info.pulp + ".signed" val t = info.output + ".signed" diff --git a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/CpuInfo.kt b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/CpuInfo.kt index 84ea44b..5188d15 100644 --- a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/CpuInfo.kt +++ b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/CpuInfo.kt @@ -38,7 +38,7 @@ class CpuInfo( return CpuInfo(rawCores, policies, onDemand, conservative, sched) } - val getAdbCmdResult: (String, Boolean) -> String? = { cmd, check -> + val getAdbCmdResult: (String, Boolean) -> String? = { cmd, check -> Helper.powerRun2("adb shell $cmd", null).let { if (it[0] as Boolean) { String(it[1] as ByteArray).trim() @@ -59,12 +59,22 @@ class CpuInfo( } data class SchedutilGovernor( - var rate_limit_us: Long = 0, + var capacity_margin: String? = null, + var down_rate_limit_us: String? = null, + var iowait_boost_max: String? = null, + var rate_limit_us: String? = null, + var up_rate_limit_us: String? = null, ) { companion object { fun construct(): SchedutilGovernor { val prefix = "/sys/devices/system/cpu/cpufreq/schedutil" - return SchedutilGovernor(Helper.adbCmd("cat $prefix/rate_limit_us").toLong()) + return SchedutilGovernor( + capacity_margin = getAdbCmdResult("cat $prefix/capacity_margin", false), + down_rate_limit_us = getAdbCmdResult("cat $prefix/down_rate_limit_us", false), + iowait_boost_max = getAdbCmdResult("cat $prefix/iowait_boost_max", false), + rate_limit_us = getAdbCmdResult("cat $prefix/rate_limit_us", false), + up_rate_limit_us = getAdbCmdResult("cat $prefix/up_rate_limit_us", false) + ) } } }