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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14EF8C433EF for ; Tue, 16 Nov 2021 10:47:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 13F1C61BE6 for ; Tue, 16 Nov 2021 10:47:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 13F1C61BE6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C528E8374E; Tue, 16 Nov 2021 11:47:30 +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="mBxnWJDO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BD57837B9; Tue, 16 Nov 2021 11:47:27 +0100 (CET) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 CC1838374E for ; Tue, 16 Nov 2021 11:47:23 +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=heiko.thiery@gmail.com Received: by mail-wm1-x32d.google.com with SMTP id y196so16459097wmc.3 for ; Tue, 16 Nov 2021 02:47:23 -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:mime-version :content-transfer-encoding; bh=ImFQsqOuSGt5fB/jonaREstmWQodT3avDTM5npDXWu8=; b=mBxnWJDOGT4i45RHe/mq8mT7ALx4Ah3h1PXOKybie5bPqw49NNa8ft2IcNu+gv2Zzk fQ5aDsszqd/ZX4kfbaaXQa4NAFukNkbjWxXRrE7vz1sO4hMMSbl/A2tgluQ0OTYvT68j Xh8zYgDA4xux44qhgkZmWAWZBnqb0t6knFLOq/bArXjBXM2mdXUPRaYMVEFPDdKkJVW+ XuH3TbkSQDS6+Zg8WcbzUjbYgFTPPlQqPYu8LD/trUUFalqJsPXafu3ZZ+UORdxVEba8 p7ZJtStF4NglkBMTFx0wj3iZ9RzryOQg3w3B1Qj9MsGwwGDs3zdbDMTj5OWyR+/wWvdO lgQw== 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:mime-version :content-transfer-encoding; bh=ImFQsqOuSGt5fB/jonaREstmWQodT3avDTM5npDXWu8=; b=PwGfaPUUiG+lUCNjX9pfVP5sABI5sqd536wRmkSFL/+Jjxi85N3s7S65CnQJLzS/1Q CMiXjyK47ymunR+ngdRY5XKnltMlvvNNaj7MUER25CgmmBbyH6pQjVyCamVZiMgDtjJA 1DsZUbMfk0Gc8g7MnEJr2ezy9iIrgl5UcoxuiKbyJ0mOW+MsSne4F9XhSkd3w3vyRFPx KkOUjc9vvvV2HnCEGAkLsCGlwzymjrKe5a0fRBEko+hgN/vgioFeLUEcm9wEd0fNgiWn ORPB0GsFpUt6lapE2s53TcQPkS2BWZmw79eL3OixKcbS8P+3a1GOS3OI+x5gney1Kf0Y HmiA== X-Gm-Message-State: AOAM53331K86KpgCXoKjBkHA0U5tkm2lLB0fYrueh3xKvv9IG+uaTbHr S6bIy/en15nPT4oo7yKxrnsTXlczrDI= X-Google-Smtp-Source: ABdhPJw8O0/APmm/ieiBwdHzaQC4wXupNrFbtFlQ/vQrf10i6jLCbsVW713fzPuFs2zdV+WmMwtD2A== X-Received: by 2002:a1c:1b48:: with SMTP id b69mr6421539wmb.103.1637059643225; Tue, 16 Nov 2021 02:47:23 -0800 (PST) Received: from hthiery.kontron.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id t4sm1945528wmi.48.2021.11.16.02.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 02:47:22 -0800 (PST) From: Heiko Thiery To: u-boot@lists.denx.de Cc: Stefano Babic , Fabio Estevam , Michael Walle , Simon Glass , Tom Rini , Wolfgang Denk , Heiko Thiery Subject: [RFC] binman: add support for creating dummy files for external blobs Date: Tue, 16 Nov 2021 11:47:10 +0100 Message-Id: <20211116104709.571149-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 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 While converting to binman for an imx8mq board, it has been found that building in the u-boot CI fails. This is because an imx8mq requires an external binary (signed_hdmi_imx8m.bin). If this file cannot be found mkimage fails. To be able to build this board in the u-boot CI a binman option (--fake-ext-blobs) is introduced that can be switched on via the u-boot makefile option BINMAN_FAKE_EXT_BLOBS. With that the needed dummy files are created. Signed-off-by: Heiko Thiery --- Makefile | 1 + tools/binman/cmdline.py | 2 ++ tools/binman/control.py | 16 ++++++++++++++++ tools/binman/entry.py | 1 + tools/binman/etype/blob_ext.py | 1 + 5 files changed, 21 insertions(+) diff --git a/Makefile b/Makefile index f911f70344..1a833a1637 100644 --- a/Makefile +++ b/Makefile @@ -1307,6 +1307,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \ -a spl-dtb=$(CONFIG_SPL_OF_REAL) \ -a tpl-dtb=$(CONFIG_SPL_OF_REAL) \ + $(if $(BINMAN_FAKE_EXT_BLOBS),--fake-ext-blobs) \ $(BINMAN_$(@F)) OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index d6156df408..2b29981cb4 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -52,6 +52,8 @@ controlled by a description in the board device tree.''' help='Configuration file (.dtb) to use') build_parser.add_argument('--fake-dtb', action='store_true', help='Use fake device tree contents (for testing only)') + build_parser.add_argument('--fake-ext-blobs', action='store_true', + help='Create fake ext blobs with dummy content (for testing only)') build_parser.add_argument('-i', '--image', type=str, action='append', help='Image filename to build (if not specified, build all)') build_parser.add_argument('-I', '--indir', action='append', diff --git a/tools/binman/control.py b/tools/binman/control.py index 0dbcbc28e9..f95aadd1f3 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -8,6 +8,7 @@ from collections import OrderedDict import glob import os +import pathlib import pkg_resources import re @@ -401,6 +402,17 @@ def ReplaceEntries(image_fname, input_fname, indir, entry_paths, return image +def PrepareFakeExtBlobs(images): + for (_, image) in images.items(): + for entry in image._entries.values(): + if entry.allow_dummy: + if not pathlib.Path(entry._filename).is_file(): + tout.Warning("Missing external blob '%s', fake it" % + entry._filename) + with open(entry._filename, "wb") as out: + out.truncate(1024) + + def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded): """Prepare the images to be processed and select the device tree @@ -629,6 +641,10 @@ def Binman(args): images = PrepareImagesAndDtbs(dtb_fname, args.image, args.update_fdt, use_expanded) + + if args.fake_ext_blobs: + PrepareFakeExtBlobs(images) + if args.test_section_timeout: # Set the first image to timeout, used in testThreadTimeout() images[list(images.keys())[0]].test_section_timeout = True diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 70222718ea..2f5c38d15a 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -100,6 +100,7 @@ class Entry(object): self.missing = False self.external = False self.allow_missing = False + self.allow_dummy = False @staticmethod def Lookup(node_path, etype, expanded): diff --git a/tools/binman/etype/blob_ext.py b/tools/binman/etype/blob_ext.py index d6b0ca17c3..85bc9fe6b8 100644 --- a/tools/binman/etype/blob_ext.py +++ b/tools/binman/etype/blob_ext.py @@ -26,3 +26,4 @@ class Entry_blob_ext(Entry_blob): def __init__(self, section, etype, node): Entry_blob.__init__(self, section, etype, node) self.external = True + self.allow_dummy = True -- 2.30.2