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 47C95C433F5 for ; Mon, 7 Feb 2022 22:08:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32A8283BCD; Mon, 7 Feb 2022 23:08:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="V+QJ38ub"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2FA3183BDC; Mon, 7 Feb 2022 23:08:32 +0100 (CET) Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 2DE4E83BBF for ; Mon, 7 Feb 2022 23:08:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-ej1-x635.google.com with SMTP id a8so46222393ejc.8 for ; Mon, 07 Feb 2022 14:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V+GtqI6dhCU07W9oi83gzLWSPbOcxK3bAP3/WEiHGtk=; b=V+QJ38ubaefxn4Qn9hEEZvC1LKEglTj7e1DsSMJR6ovJOg8Awhb+Pmg0d0ZBlj4sOT y50e+hXuSsTWgnxDCUfmO5bo9pGHHHeVEkC5gYIiEZmA8YH8B2jtzCNpsq/mi4k4U7cy JUgK9Dk8Ce+XM1sFVJsYC2n4wtNBs3yySjl5xSVQ6LlVlymzrqtWgYlTwcEneR0H2Ilw mWJAaHFboY++ljB6xsGTG2CcrTyYrsxvd9S519Q2Lg3XV1AjuHr2R031zE0xs6dFcmdF ZhauAxRDMVGPI6Amn9I31z2TL3byNVtbo1T3AA4J1Rl3JAcnU+EvG4eFsrgLNv0fADc+ nMLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V+GtqI6dhCU07W9oi83gzLWSPbOcxK3bAP3/WEiHGtk=; b=YjvBWAzAKcSL6T10oWMis/3SiA8HUcuSvz1S7OWiOyKdFc8F2KO0FoD29Sr5qILw0g gxjMhPQcqcFB/zThfIo5UwiUHeNmaL0xduE0jom++ExUPmGfl6caxXrxnmFHjBx/F1E2 rGNZmvmGrWFUci07779qEXQDD8RXSIYAcYSs/m4LyJ4N6L2asMzKy0zePTA7/3QpujPt jUCcCBGs/8RBIRqzseH0pjncJlliM09VpNoILhAfsS+MQ8BwvirvsAEzTIX5Bd2ryDJc ISImZQ9B06JUp7ppXWomv8U/Zwe+4lM84b6soMJviqbRpfPYYpNjF/jbMvpq/kKz98Vy 7oOg== X-Gm-Message-State: AOAM533a78LUXuvUzl6vz1XHtyp0sAgZeAT6bQaFF1FEMzi+6gk1TGt1 hDoEREAaJMYhju5ySP7m+Qd3nAMJKbo= X-Google-Smtp-Source: ABdhPJyO2NJ73jJJlAwsZga02aM2+0bzXssrNSvZZolr+eSh4S/yvfFwlf2zvn4D2tUmg0RqghuvfQ== X-Received: by 2002:a17:906:564c:: with SMTP id v12mr1307004ejr.255.1644271706744; Mon, 07 Feb 2022 14:08:26 -0800 (PST) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id v16sm4081300ejo.156.2022.02.07.14.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 14:08:26 -0800 (PST) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Heiko Thiery , Jan Kiszka , Simon Glass , Alper Nebi Yasak Subject: [PATCH v2 2/5] binman: Register and check bintools from FIT subentries Date: Tue, 8 Feb 2022 01:08:05 +0300 Message-Id: <20220207220809.4497-3-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220207220809.4497-1-alpernebiyasak@gmail.com> References: <20220207220809.4497-1-alpernebiyasak@gmail.com> 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.5 at phobos.denx.de X-Virus-Status: Clean Binman keeps track of binary tools each entry wants to use. The implementation of this for the FIT entry only adds "mkimage", but not the tools that would be used by its subentries. Register the binary tools that FIT subentries will use in addition to the one FIT itself uses, and check their existence by copying the appropriate method from Section entry type. Also add tests that check if these subentries can use and warn about binary tools. Signed-off-by: Alper Nebi Yasak Reviewed-by: Simon Glass --- Changes in v2: - Add tag: "Reviewed-by: Simon Glass " tools/binman/etype/fit.py | 14 +++++++ tools/binman/ftest.py | 25 ++++++++++++ .../binman/test/220_fit_subentry_bintool.dts | 39 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 tools/binman/test/220_fit_subentry_bintool.dts diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py index 38bc2a2d784e..9dffcd5adbd6 100644 --- a/tools/binman/etype/fit.py +++ b/tools/binman/etype/fit.py @@ -311,4 +311,18 @@ def SetAllowMissing(self, allow_missing): section.SetAllowMissing(allow_missing) def AddBintools(self, tools): + for section in self._fit_sections.values(): + section.AddBintools(tools) self.mkimage = self.AddBintool(tools, 'mkimage') + + def check_missing_bintools(self, missing_list): + """Check if any entries in this section have missing bintools + + If there are missing bintools, these are added to the list + + Args: + missing_list: List of Bintool objects to be added to + """ + super().check_missing_bintools(missing_list) + for entry in self._fit_sections.values(): + entry.check_missing_bintools(missing_list) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 626df786c8c9..bc073587cc07 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -5133,6 +5133,31 @@ def testListWithGenNode(self): finally: shutil.rmtree(tmpdir) + def testFitSubentryUsesBintool(self): + """Test that binman FIT subentries can use bintools""" + command.test_result = self._HandleGbbCommand + entry_args = { + 'keydir': 'devkeys', + 'bmpblk': 'bmpblk.bin', + } + data, _, _, _ = self._DoReadFileDtb('220_fit_subentry_bintool.dts', + entry_args=entry_args) + + expected = (GBB_DATA + GBB_DATA + tools.GetBytes(0, 8) + + tools.GetBytes(0, 0x2180 - 16)) + self.assertIn(expected, data) + + def testFitSubentryMissingBintool(self): + """Test that binman reports missing bintools for FIT subentries""" + entry_args = { + 'keydir': 'devkeys', + } + with test_util.capture_sys_output() as (_, stderr): + self._DoTestFile('220_fit_subentry_bintool.dts', + force_missing_bintools='futility', entry_args=entry_args) + err = stderr.getvalue() + self.assertRegex(err, + "Image 'main-section'.*missing bintools.*: futility") if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/220_fit_subentry_bintool.dts b/tools/binman/test/220_fit_subentry_bintool.dts new file mode 100644 index 000000000000..6e29d41eeb33 --- /dev/null +++ b/tools/binman/test/220_fit_subentry_bintool.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + fit { + description = "test-desc"; + #address-cells = <1>; + + images { + test { + description = "Something using a bintool"; + type = "kernel"; + arch = "arm"; + os = "linux"; + compression = "gzip"; + load = <00000000>; + entry = <00000000>; + + gbb { + size = <0x2180>; + }; + }; + }; + + configurations { + default = "conf-1"; + conf-1 { + description = "Boot bintool output"; + kernel = "kernel"; + }; + }; + }; + }; +}; -- 2.34.1