From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65D35C433F5 for ; Mon, 17 Jan 2022 07:29:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C0E881A03; Mon, 17 Jan 2022 08:28:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=siemens.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=siemens.com header.i=@siemens.com header.b="ZX7Bt0gz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C68681DCC; Mon, 17 Jan 2022 08:28:56 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20605.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::605]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4240D80F78 for ; Mon, 17 Jan 2022 08:28:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=siemens.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jan.kiszka@siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dqFENiZ7zAkg7Q1320SEMbpd8IMzZrCCuCUORgkIf+6nGAUkWPbNZ8/cxwSYhy5ZWKmGCqRdEpET7qujhG9ynv+RhzfKmFp1dfQZ9ISFWVmX9OLRz08Ww1QpXL7+igvjOqwBrTYXuuy1GGTdTtCfRu0TFxuM1ff7V8BUazxg/G/P5Z9bi9jYZEaLx+dSwVi2PI8iG5BXSh4qwhfQTRV67PdjtismEadgimW8me+b/eArOiudKpbRdkNLuVC4m8nImMonjHXTr4MUPn4UiRCpn+hN3wxwZKoxgIvYQBmC1rHKMtGbFae+3HaE8ULc7+QoyqWIe+3+6nHTIAk6Nvn/yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v8WVybUoEMfvBpu1sMqket5Wrw6mjkD4aSxj74AHBTw=; b=l/roCVr4B0tFxA6Je1AflMPvg4qSpI6PUxe59IA0zQ9W3PAplLRqKFdO6g5XtFCDbpS/i4ojtANczBa4g/OiBbP6J6s3uS1qb/2jafeSowo6O9Nn77XiCEhX7K9TLX/+gbx04TVp4IZL64Lhut6Y72UybAn1z3nEqv7Ctx7EFdTMrDIFy79fGHCHUWhlr3N7uhxfY0F0K3zT+0wg3mME3Tpx5x3Os38RPOtuSxq1og8LQsnkfHRtbEalD19u+vXWlV4MWh7C2TsxETE2aul+n9cKnuPORxDy4mRMf4r4zGm9TD2ddTvMai6InXNDqVZu5QFLvnQLLZIyXN7cQSXkNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.72) smtp.rcpttodomain=chromium.org smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v8WVybUoEMfvBpu1sMqket5Wrw6mjkD4aSxj74AHBTw=; b=ZX7Bt0gzF63hrN3ZodI9rqtVd0oBqXxUgLHZvVHfGbU98GEdvEaiwrgb85zfHrqQ0sARDHYOW3SYNErf0K7cd8LnI1zSdDt2752w3/w50dRx6TwwgtP9pgllx8AGklN/7E2Ms4t5L1fhD852Ob1t9UGOOFCnAuRejI8V6Ac5ejEZrgkbYllufWJRQ9cDgvKDAgywO3pAMJDRVsRxHfmaIDyD1GAxikbJ/YSWxH68WFLJOTgeg4ptdkEE+J7JQ+RIjAMUTCoABdfx54TdC8433aKZjodrON/+v3AQIr1mlKtjlLKlZUp/gQI9SBS8FqiXOj3546LN+PnT+Li3p/H55Q== Received: from AM6PR10CA0083.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::24) by AM6PR10MB2791.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:b0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12; Mon, 17 Jan 2022 06:57:03 +0000 Received: from VE1EUR01FT013.eop-EUR01.prod.protection.outlook.com (2603:10a6:209:8c:cafe::76) by AM6PR10CA0083.outlook.office365.com (2603:10a6:209:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10 via Frontend Transport; Mon, 17 Jan 2022 06:57:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.72) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.72 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.72; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.72) by VE1EUR01FT013.mail.protection.outlook.com (10.152.2.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 06:57:03 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC9SMA.ad011.siemens.net (194.138.21.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 17 Jan 2022 07:28:55 +0100 Received: from [167.87.72.46] (167.87.72.46) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 17 Jan 2022 07:28:54 +0100 Message-ID: Date: Mon, 17 Jan 2022 07:28:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 From: Jan Kiszka Subject: [PATCH v2] binman: Skip node generation for images read from files Content-Language: en-US To: Simon Glass , U-Boot Mailing List CC: "Su, Bao Cheng (RC-CN DF FA R&D)" Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [167.87.72.46] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 809b0e84-50e6-4d1c-e161-08d9d98690f7 X-MS-TrafficTypeDiagnostic: AM6PR10MB2791:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:913; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yzzPQL/lNeuG03VguCEA+leP0ZGuqvB+tTnQEn4IOy4OZvGNjlsiFNQ81iNORZVbTCnrso2t7J+cNVgRj+kmCu1NjlESRdx1qJ/NlbS/VoWcypqzMdYDhfa2q+Q/iiA3s0uTMfn3HHzFR5JWeVw7lzaIe86fFVP+ssUyPLsPoydkF2Kg3IaDqVyAslMTJv3/iEvREQ8rqgn4VN3YA4cik02eWTPE8nvuOk2JVsHGKEWKbxfcJl28vhYJ6jlDA7551Yop/n5L3W8Rm/tz5acwlZ5MB/155j3p7Jw+vqER3d3hCnnhix8XANBlKCu/6hIeii/TtKqFsXXlxIuNZDCQcKsNlk3Oq7bMukrh6xH88q2zemIAoFxThzB9y8wPP/fx3QyqaVpRBvO/rSVATd+B0MKzz6u/xHNfGodjI1irbdYLtSUGMcvaC5oJbTz7UbwbVN9MWZGQhE3ba2z/hgEJmlaCqKsTw8OcN0y2hQsj6riO9c5/pix6x72G/88VnrqvsfuN5pHC62lvIPxPiyFjXU9YoiLKWjxICypCcZxdtxfJi/afpZq9/DKf8Hc3ewR2xJAn7Zs4r/wB1wzIH5WK0s0/otzidogXHWPQQzfMAVvdgE5NPiwSnPUiJVZ0Dip4HTp+8pbJz7preU1Sk48fmhR6nyYtjKm75TN5aOxSP+mzu0wJcI77B/9otgt/prEmwHPfU5YXYwgrP3bM1juaa4Al6OlSjdihFju2JYYE2RR3j/d48r6TRdgoeCmvDpCXsDo7ajNOtVYNJwwY+Sc6G037psm3PwEXBDN7udTXe2mePz3z5nlP6wiYcX9DHXT817Tl1nUt6zOzsrSmn/CzgiDcvDCWgjWjCawMzOW231s= X-Forefront-Antispam-Report: CIP:194.138.21.72; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700002)(2616005)(5660300002)(8936002)(16576012)(956004)(4326008)(107886003)(47076005)(82960400001)(336012)(316002)(26005)(36860700001)(31696002)(16526019)(356005)(508600001)(186003)(6706004)(36756003)(70206006)(82310400004)(81166007)(70586007)(40460700001)(31686004)(83380400001)(110136005)(86362001)(2906002)(8676002)(44832011)(3940600001)(43740500002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 06:57:03.0120 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 809b0e84-50e6-4d1c-e161-08d9d98690f7 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.72]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT013.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR10MB2791 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Jan Kiszka We can and should run the node generator only when creating a new image. When we read it back, there is no need to generate nodes - they already exits, and binman does not dive that deep into the image - and there is no way to provide the required fdt-list. So forward the mode from the image to every Entry object it contains so that Entry_fit can simply skip generator nodes when reading them from an fdtmap. This unbreaks all read-backs of images that contain generator nodes in their fdtmap. Signed-off-by: Jan Kiszka --- Changes in v2: - more verbose commit log tools/binman/entry.py | 5 ++++- tools/binman/etype/fit.py | 2 +- tools/binman/etype/section.py | 4 ++-- tools/binman/image.py | 7 ++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/binman/entry.py b/tools/binman/entry.py index bac90bbbcd..fdb9746fda 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -75,7 +75,7 @@ class Entry(object): available. This is mainly used for testing. external: True if this entry contains an external binary blob """ - def __init__(self, section, etype, node, name_prefix=''): + def __init__(self, section, etype, node, name_prefix='', generate=None): # Put this here to allow entry-docs and help to work without libfdt global state from binman import state @@ -105,6 +105,9 @@ class Entry(object): self.external = False self.allow_missing = False self.allow_fake = False + if generate == None: + generate = section.generate if section else True + self.generate = generate @staticmethod def FindEntryClass(etype, expanded): diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py index b41187df80..4e4d2f9c22 100644 --- a/tools/binman/etype/fit.py +++ b/tools/binman/etype/fit.py @@ -193,7 +193,7 @@ class Entry_fit(Entry): # the FIT (e.g. "/images/kernel/u-boot"), so don't call # fsw.add_node() or _AddNode() for it. pass - elif subnode.name.startswith('@'): + elif self.generate and subnode.name.startswith('@'): if self._fdts: # Generate notes for each FDT for seq, fdt_fname in enumerate(self._fdts): diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 7a55d03231..319156a09a 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -154,9 +154,9 @@ class Entry_section(Entry): available. This is set by the `SetAllowMissing()` method, if `--allow-missing` is passed to binman. """ - def __init__(self, section, etype, node, test=False): + def __init__(self, section, etype, node, test=False, generate=None): if not test: - super().__init__(section, etype, node) + super().__init__(section, etype, node, generate=generate) self._entries = OrderedDict() self._pad_byte = 0 self._sort = False diff --git a/tools/binman/image.py b/tools/binman/image.py index f0a7d65299..1ff97e687c 100644 --- a/tools/binman/image.py +++ b/tools/binman/image.py @@ -69,8 +69,9 @@ class Image(section.Entry_section): version which does not support all the entry types. """ def __init__(self, name, node, copy_to_orig=True, test=False, - ignore_missing=False, use_expanded=False, missing_etype=False): - super().__init__(None, 'section', node, test=test) + ignore_missing=False, use_expanded=False, missing_etype=False, + generate=True): + super().__init__(None, 'section', node, test=test, generate=generate) self.copy_to_orig = copy_to_orig self.name = 'main-section' self.image_name = name @@ -130,7 +131,7 @@ class Image(section.Entry_section): # Return an Image with the associated nodes root = dtb.GetRoot() image = Image('image', root, copy_to_orig=False, ignore_missing=True, - missing_etype=True) + missing_etype=True, generate=False) image.image_node = fdt_util.GetString(root, 'image-node', 'image') image.fdtmap_dtb = dtb -- 2.31.1