From 629e93a10c53ac76ed6f4ca78a15a7975b804ab7 Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Sun, 10 Jul 2022 13:17:19 +0200 Subject: [PATCH] lk2nd: scripts: dtbTool: Clean up QCDT entries for Samsung MSM8916 The msm8916 samsung.dts results in a lot of QCDT entries (records) because each qcom,msm-id is combined with each qcom,board-id. However, each board-id is actually only valid for one particular msm-id, so we can save quite some space by cleaning them up here. This is a bit of a hack but since this is a custom copy of dtbTool anyway it's not much of a problem. Also, reverting this (or using the standard dtbTool) would not result in a functional difference, just a larger build result. --- lk2nd/scripts/dtbTool | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lk2nd/scripts/dtbTool b/lk2nd/scripts/dtbTool index 0ff8af85f..d3411e4e7 100755 --- a/lk2nd/scripts/dtbTool +++ b/lk2nd/scripts/dtbTool @@ -409,6 +409,16 @@ def generate_records(f, pagesize): x.pmic_id[2], x.pmic_id[3], 0, size, f, version) for x in ids] + if f.endswith('/lk2nd/device/dts/msm8916/samsung.dtb'): + # The msm8916 samsung.dts results in a lot of QCDT entries (records) + # because each qcom,msm-id is combined with each qcom,board-id. However, + # each board-id is actually only valid for one particular msm-id, + # so we can save quite some space by cleaning them up here. + records = filter(lambda r: + # Workaround for inconsistent qcom,board-id used on MSM8929 + r.plat_id & 0xff == r.variant_id >> 24 if r.variant_id & 0xfffff == 0x1ff01 + else r.plat_id in (r.variant_id >> 24, r.variant_id >> 20), records) + return records def write_padding(f, pagesize):