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 22352EB64D7 for ; Wed, 28 Jun 2023 11:43:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 909E986634; Wed, 28 Jun 2023 13:42:51 +0200 (CEST) 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="khAcu6JD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 30FAB86620; Wed, 28 Jun 2023 13:42:24 +0200 (CEST) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 6304886629 for ; Wed, 28 Jun 2023 13:42:18 +0200 (CEST) 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@chromium.org Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-51d8fa4dbf9so4575110a12.1 for ; Wed, 28 Jun 2023 04:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687952538; x=1690544538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2vPVPzftEUN4jMp3HwQbCL4bLrYOEotEe5UbiGh876g=; b=khAcu6JDGUafRCgctd2qOARvDkEFrycBhHu1RgNlA6udod/eag0OYELaY491XsLjXl bwmKO6FxlRsr+cs9R783N1Koyt098Xc8KZpf15OEWMjDfOZxfX0S9FJ9AJs3tfK1Xb84 xw/v4XPPZdNRk0qE05bzhhVKFrzg9EYoFvvME= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687952538; x=1690544538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2vPVPzftEUN4jMp3HwQbCL4bLrYOEotEe5UbiGh876g=; b=PPcv+O23QrjqLDyagy9+0QkeXWB3acFjGqUfMrdIozcPXzjtcQkoHroSxAt3bXKKzE VjNTLn2Zt6FonGM/VfWKt2qKxexTGfc6zjNL5W4VGUDCy43uO2LgTcawvN1+YtBFmGpP 3DEnpU61luBSUYrnDqK15DlRKCBiqCRi+ixqDfCBsa1sDiBPXRRlOs2KtX5uYOOhB73f ZcHU6dXaYdgm/EXRTgPRHXgNFC4816ei1TzrKxPVglgNZeDdP+L5ZDgHYfjcwmaVUKiz 1QaPn6yvX1dkrO8MA3jEtAzUqJo9TWa3RGtDyF0XqL1XXOIm8YbKTqD6NrCC6g9eCXND tCwA== X-Gm-Message-State: AC+VfDyocYQsHKjPn7SOGp1tm273CcBaSsN4NRp+Q6ZD3eswYH8c5Mgn fvnY+lWdrsaWjT6y+lKb9TKOUn4d4ArVcvyK0it8sw== X-Google-Smtp-Source: ACHHUZ5OCap4Oio/RwrdjMfSd9pELvHEnS4gwlezLjDWccCX8ln7X7D2Gu+NabMJYiALhNUuVVa7fw== X-Received: by 2002:aa7:d64b:0:b0:51d:b792:14ad with SMTP id v11-20020aa7d64b000000b0051db79214admr2013557edr.20.1687952537788; Wed, 28 Jun 2023 04:42:17 -0700 (PDT) Received: from sjg1.praguecc.cz ([193.85.242.128]) by smtp.gmail.com with ESMTPSA id r18-20020aa7cb92000000b0051bec856cb4sm4676423edt.50.2023.06.28.04.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 04:42:17 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Jan Kiszka , Simon Glass , Alper Nebi Yasak , Neha Malcom Francis , Peng Fan , Philippe Reynes , Stefan Herbrechtsmeier Subject: [PATCH 04/12] binman: Allow disabling symbol writing Date: Wed, 28 Jun 2023 12:41:37 +0100 Message-ID: <20230628114149.439723-5-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog In-Reply-To: <20230628114149.439723-1-sjg@chromium.org> References: <20230628114149.439723-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean Some boards don't use symbol writing but do access the symbols in SPL. Provide an option to work around this. Signed-off-by: Simon Glass --- tools/binman/binman.rst | 7 ++++++ tools/binman/entry.py | 4 +++- tools/binman/etype/blob_phase.py | 5 ++++ tools/binman/ftest.py | 28 +++++++++++++++++++---- tools/binman/test/282_symbols_disable.dts | 25 ++++++++++++++++++++ 5 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 tools/binman/test/282_symbols_disable.dts diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index 23cbb99b4b0b..a4b31fe5397b 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -831,6 +831,13 @@ write-symbols: binman. This is automatic for certain entry types, e.g. `u-boot-spl`. See binman_syms_ for more information. +no-write-symbols: + Disables symbol writing for this entry. This can be used in entry types + where symbol writing is automatic. For example, if `u-boot-spl` refers to + the `u_boot_any_image_pos` symbol but U-Boot is not available in the image + containing SPL, this can be used to disable the writing. Quite likely this + indicates a bug in your setup. + elf-filename: Sets the file name of a blob's associated ELF file. For example, if the blob is `zephyr.bin` then the ELF file may be `zephyr.elf`. This allows diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 39456906a477..328b5bc568a9 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -158,6 +158,7 @@ class Entry(object): self.offset_from_elf = None self.preserve = False self.build_done = False + self.no_write_symbols = False @staticmethod def FindEntryClass(etype, expanded): @@ -321,6 +322,7 @@ class Entry(object): 'offset-from-elf') self.preserve = fdt_util.GetBool(self._node, 'preserve') + self.no_write_symbols = fdt_util.GetBool(self._node, 'no-write-symbols') def GetDefaultFilename(self): return None @@ -695,7 +697,7 @@ class Entry(object): Args: section: Section containing the entry """ - if self.auto_write_symbols: + if self.auto_write_symbols and not self.no_write_symbols: # Check if we are writing symbols into an ELF file is_elf = self.GetDefaultFilename() == self.elf_fname elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage(), diff --git a/tools/binman/etype/blob_phase.py b/tools/binman/etype/blob_phase.py index b937158756fd..951d9934050e 100644 --- a/tools/binman/etype/blob_phase.py +++ b/tools/binman/etype/blob_phase.py @@ -52,3 +52,8 @@ class Entry_blob_phase(Entry_section): # Read entries again, now that we have some self.ReadEntries() + + # Propagate the no-write-symbols property + if self.no_write_symbols: + for entry in self._entries.values(): + entry.no_write_symbols = True diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 43b4f850a691..dabb3f689fdb 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1452,7 +1452,7 @@ class TestFunctional(unittest.TestCase): self.assertEqual(U_BOOT_SPL_NODTB_DATA, data[:len(U_BOOT_SPL_NODTB_DATA)]) def checkSymbols(self, dts, base_data, u_boot_offset, entry_args=None, - use_expanded=False): + use_expanded=False, no_write_symbols=False): """Check the image contains the expected symbol values Args: @@ -1481,9 +1481,14 @@ class TestFunctional(unittest.TestCase): sym_values = struct.pack('; + #size-cells = <1>; + + binman { + pad-byte = <0xff>; + u-boot-spl { + no-write-symbols; + }; + + u-boot { + offset = <0x38>; + no-expanded; + }; + + u-boot-spl2 { + type = "u-boot-spl"; + no-write-symbols; + }; + }; +}; -- 2.41.0.162.gfafddb0af9-goog