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 D72CCC28CF5 for ; Wed, 26 Jan 2022 15:57:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5CC6810EC; Wed, 26 Jan 2022 16:57:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Zl3Wwt6V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C1DC8313B; Wed, 26 Jan 2022 16:57:31 +0100 (CET) Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7C72E8083E for ; Wed, 26 Jan 2022 16:57:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa29.google.com with SMTP id d189so66604vkg.3 for ; Wed, 26 Jan 2022 07:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NyvSlKgjtEgJDwENLakQCPCF0zytznq+haNtZpSjoGo=; b=Zl3Wwt6V9pIZm1pQsv5/1dqadpPZfUGhqfXD545vIR+lrVOO5KPnihYVrXREXuZPFl Ml5MGzczg0T3GtJrByd1hxHo/fM7DdsUbyeTN4iZideMvr3WnZ2Cq+kG/4STg/ngUxbT JK1QWa7/SI53yDd/1UEjQFEcNNa53wWUsWljo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NyvSlKgjtEgJDwENLakQCPCF0zytznq+haNtZpSjoGo=; b=ezPvhWS4Mk449H7HAF9BKbqcM1eUK/29PkNvHvoaAA+aTHxY4cNENG1OPzqyp+x9DW OYW43TjPC6P4iOArbsn3osJr08301nD6B5FEkvEhBrs2qFKVZ3sTmwElvomUwItKDQ+S hbuVemFK38Z7ZSQOMFdsIh6uDtnJPFPF2TntPrcB49QLPUh1jzJG1Z+tB/FfSZftCCIf cjiYgvOiM5A6tlhJyMe13eo/s6Tn9wHjR0A9pT57fXCdnuTmRLAaUkRsxgvlPQSRKSJI 5WLHbUSPk86El6fejY7E0LvdYgta48QTfTP/Lb0RqxGgOWkPUlP//MDBeuvCwiW+I4S/ fclA== X-Gm-Message-State: AOAM531M0m48KjR5HRgxut17JyNzSxDLMTxB/csYVnwCnDysUbyWrkwQ OtE1o33dg55RCa9bbpzfyxCttTcxPZT3xW7QVaJZQg== X-Google-Smtp-Source: ABdhPJygR4u4tTKGbYi8hn67hNX+K7Y2wWcuUe27M/LzWyZ0cKsT82idQGNbyP1j6Ht3p1t+i66BTYQDLK4WyMeFWDU= X-Received: by 2002:ac5:c965:: with SMTP id t5mr2304337vkm.3.1643212647036; Wed, 26 Jan 2022 07:57:27 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Simon Glass Date: Wed, 26 Jan 2022 08:57:15 -0700 Message-ID: Subject: Re: [PATCH v2] binman: Skip node generation for images read from files To: Jan Kiszka Cc: U-Boot Mailing List , "Su, Bao Cheng (RC-CN DF FA R&D)" Content-Type: text/plain; charset="UTF-8" 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.5 at phobos.denx.de X-Virus-Status: Clean Hi Jan, On Mon, 17 Jan 2022 at 00:28, Jan Kiszka wrote: > > 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(-) Did you miss my other comments and a test? > > 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 Regards, Simon