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 38D85C433EF for ; Fri, 4 Mar 2022 19:57:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 61E388365D; Fri, 4 Mar 2022 20:57:04 +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="XEXgMB+E"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B04A883A93; Fri, 4 Mar 2022 20:57:02 +0100 (CET) Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) (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 10B7C83108 for ; Fri, 4 Mar 2022 20:56:59 +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=pgwipeout@gmail.com Received: by mail-qv1-xf2d.google.com with SMTP id b12so7458950qvk.1 for ; Fri, 04 Mar 2022 11:56:59 -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=rXYogm/rpnuDJ2uoxV65Yc/yl0oFVCBl39Fq2L9Wor8=; b=XEXgMB+EDwiLiZkbV6oUElWGv5eAAuyZLzPzQqPiT+e9X45RmQmHqbz4cZwcNZfj33 T+7FjGP8KI7lK4Rdu6YBcplCmo4KDSnRAO2dTAbNexk7+aN52RyWvV+JZlEo1++FdBpc bCqZXiEA+MfBfF9LBbZQX2XzKbH4IN3biOIfnio4S9/UNf72c9aAxbU2/1uvH3KPIznj 7rpa14EKFo+pVTyrYRN4z8GbeMRVSq0RhhTvTn0P4I1RVCxnTLQZo/any2N1oIlha6o8 3mj8kMG1LzPgu/M3pEzEnGdKqXu6fYIj4FM6Dblg5cBrUAmvPdWT5N7B8pkNyF+3vJLm sONQ== 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=rXYogm/rpnuDJ2uoxV65Yc/yl0oFVCBl39Fq2L9Wor8=; b=5N29wLpWwzfk4kD8+B6z3ve2KECN4E0gn2Ea1E+X8q9PPEfyP+l606YQDDkb1yHoDY TR+LyHrvAQ6TPcH7xMI+Ijc/kZjFe90CIp1I3shFb/RyhWDEnNcorfNndta5AdaibBe7 /WOQxahmT3Z8TyDFihIvjduNDAK383f9zKGTfg1gxc72sWs2kzS45hL3t4cNE9Xp3lZn xW7jDcabagVe69SizHu5K/l0y/nsgihKnSUieLpSSC7jtSKtKGs5c3XGdAlvUVQXZGmJ X6SBItLP5tY/XsdUQSB1JRfi7n6Dbvk+oL6PrJuG4CHPOKUREWcfqkrziaUrgBWgqaBN omVA== X-Gm-Message-State: AOAM53091qdOzEoZw8C/LUq6TE46s6gCThRTVfDMgIUptva61R9UrKhm KVJEKUkrYWUXuQZHCMmuL40= X-Google-Smtp-Source: ABdhPJwLHkE8ExIlk3oaCqqujPu07O5jx+z+zqvp1ieOHkTuXIYh2RB/vF9y61HBim+vyCW6R4HcrQ== X-Received: by 2002:a05:6214:5008:b0:435:19da:3c53 with SMTP id jo8-20020a056214500800b0043519da3c53mr7852qvb.69.1646423817821; Fri, 04 Mar 2022 11:56:57 -0800 (PST) Received: from master-x64.sparksnet ([2601:153:980:85b1::10]) by smtp.gmail.com with ESMTPSA id p4-20020a05622a00c400b002de0b744039sm4084628qtw.43.2022.03.04.11.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 11:56:57 -0800 (PST) From: Peter Geis To: pgwipeout@gmail.com Cc: alpernebiyasak@gmail.com, sjg@chromium.org, u-boot@lists.denx.de Subject: [PATCH v2] binman: support mkimage separate files Date: Fri, 4 Mar 2022 14:56:41 -0500 Message-Id: <20220304195641.1993688-1-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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 mkimage has the ability to process two files at the same time. This is necessary for rk356x support as both TPL and SPL need to be hashed individually in the resulting header. It also eases support for rkspi as mkimage handles everything for making the requisite file for maskrom loading. Add a new flag "separate_files" for mkimage handling to gather the files separately rather than combining them before passing them to mkimage. Signed-off-by: Peter Geis --- Changelog: v2: I've managed to move this all into mkimage.py as per Alper's suggestion. I've added an example to the readme portion of the function. mkimage,separate_files is now separate-files. tools/binman/etype/mkimage.py | 41 ++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index 5f6def2287f6..0a86f904a2b7 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -17,6 +17,7 @@ class Entry_mkimage(Entry): Properties / Entry arguments: - datafile: Filename for -d argument - args: Other arguments to pass + - separate-files: Boolean flag for passing files individually. The data passed to mkimage is collected from subnodes of the mkimage node, e.g.:: @@ -42,20 +43,54 @@ class Entry_mkimage(Entry): }; }; + This calls mkimage to create a rksd image with a standalone ram init + binary file and u-boot-spl.bin as individual input files. The output from + mkimage then becomes part of the image produced by binman. + + mkimage { + args = "-n", CONFIG_SYS_SOC, "-T", "rksd"; + separate-files; + + ddrl { + type = "blob-ext"; + filename = "rk3568_ddr_1560MHz_v1.12.bin"; + }; + + u-boot-spl { + }; + }; + """ def __init__(self, section, etype, node): super().__init__(section, etype, node) self._args = fdt_util.GetArgs(self._node, 'args') + self._separate = fdt_util.GetBool(self._node, 'separate-files') self._mkimage_entries = OrderedDict() self.align_default = None self.ReadEntries() + self.index = 0 + self.fname_tmp = str() def ObtainContents(self): # Use a non-zero size for any fake files to keep mkimage happy - data, input_fname, uniq = self.collect_contents_to_file( - self._mkimage_entries.values(), 'mkimage', 1024) - if data is None: + if self._separate is False: + data, input_fname, uniq = self.collect_contents_to_file( + self._mkimage_entries.values(), 'mkimage', 1024) + if data is None: return False + else: + for entry in self._mkimage_entries.values(): + self.index = (self.index + 1) + if (self.index > 2): + print('BINMAN Warn: mkimage only supports a maximum of two separate files') + return False + input_fname = ['mkimage', str(self.index)] + data, input_fname, uniq = self.collect_contents_to_file( + [entry], ".".join(input_fname), 1024) + if data is None: + return False + self.fname_tmp = [''.join(self.fname_tmp),input_fname] + input_fname = ":".join(self.fname_tmp) output_fname = tools.get_output_filename('mkimage-out.%s' % uniq) if self.mkimage.run_cmd('-d', input_fname, *self._args, output_fname) is not None: -- 2.25.1