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 AC634C433F5 for ; Thu, 3 Mar 2022 21:19:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D106083D91; Thu, 3 Mar 2022 22:18:00 +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="T1o1z6Qx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C69283D29; Thu, 3 Mar 2022 22:17:58 +0100 (CET) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 A869E83D1B for ; Thu, 3 Mar 2022 22:17:54 +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-x629.google.com with SMTP id bi12so259402ejb.3 for ; Thu, 03 Mar 2022 13:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to:cc :references:content-language:in-reply-to:content-transfer-encoding; bh=XlHMdO/MM9Il5lUA7v4VpueUVKDfqlhiW4XjCreB3SY=; b=T1o1z6Qx3IC/7MKBxKMA/NkthULBzV8IO+nkFLNoxW4pMsYeoVOvlg3x4UPO6uJvPH J+0g8D+HVyaUk4y0pQVgrsffnc9m3x/KRn7xZHR3PQX3lng9tHWJFNNhjAluythM3Ott 6IdU39MjdKlIO2A1Z0gAsUmdzHhXb5KLsKlT08839KGgqPzWmmIyt96HI7uTLYC541q/ lgunuNmI0OuTbKVVcAR8KqB4jnWuko93+OmFIQlyQaWm5xpiXyGTnNeguMaTtcGoiCzS H5xsvk1JbFgOXhnv1gLzESFDQEo8fxK1m6wB4ZkYchoxKRwnNyFzM4vi1mD++LNLgBxH pQ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:cc:references:content-language:in-reply-to :content-transfer-encoding; bh=XlHMdO/MM9Il5lUA7v4VpueUVKDfqlhiW4XjCreB3SY=; b=RccSrNhQxm85NCgjUUIyT2Hsh7vUJxlb2jkieG5kuYrryJwWLhJfkGOo7m2mMf10bq 8GBnJo5c6q/GWAXmY/kz66JEzIavWwIVl+y2xT7yY14JwhrfmixDKch4gg58l89ce5Lu 10XV+TPSttGH0we5UZc0TqjZfzBi30vg1prJ8meYkImyQulsp/GT93VWftocZUje7YZp t2BF9B/meXgcyDKNvW0c7RKA7XSxaqTipXB5GeEAX9NZHQn0MQq83vWBQuSBMyDZnNM1 w59grHukqpfduizEPLpejfhXFE8Cl3CztsdHiFDTJZNrbJj6Q82ngSJNLnpj1FeXyk84 ksmw== X-Gm-Message-State: AOAM532KQh1aDTng9C9zMG14zVryj0J4jDteE4NuS7UK0jL16ETcKO0I X++Rxx0xiqSSwEnCAPvz5cM= X-Google-Smtp-Source: ABdhPJwb1SuiPVy9X4nxPThFpQogRPVW44PLadRe/xwEwB4goFhSMOY5p1mZ+NdtNgXbH2b+fLS+Kw== X-Received: by 2002:a17:907:3f20:b0:6da:49dc:d05e with SMTP id hq32-20020a1709073f2000b006da49dcd05emr7886354ejc.478.1646342274171; Thu, 03 Mar 2022 13:17:54 -0800 (PST) Received: from [192.168.0.74] ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id n19-20020a170906165300b006a625c583b9sm1100710ejd.155.2022.03.03.13.17.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 13:17:53 -0800 (PST) Message-ID: <151a4dcc-4ce5-744f-bc33-60b55a7807cf@gmail.com> Date: Fri, 4 Mar 2022 00:11:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: Alper Nebi Yasak Subject: Re: [RFC] [PATCH] binman: support mkimage split files To: Peter Geis , Simon Glass Cc: U-Boot Mailing List References: <20220223230040.159317-1-sjg@chromium.org> <20220301024826.1228290-1-pgwipeout@gmail.com> Content-Language: en-US In-Reply-To: <20220301024826.1228290-1-pgwipeout@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 01/03/2022 05:48, Peter Geis wrote: > Good Evening, > > I successfully tested your v2 patch series to create a bootable sdcard > image out of the box for rockpro64-rk3399. > Unfortunately, rk356x and rk3399-spi modes are broken, due to the > inability to pass multiple images to mkimage at the same time. > rk3399-spi mode is already supported manually, see: > https://elixir.bootlin.com/u-boot/v2022.04-rc3/source/doc/board/rockchip/rockchip.rst#L182 > > rk356x is currently only supported manually, the image built by the old > Makefile method is non functional. (u-boot-rockchip.bin) > > Knowing absolutely nothing about python, I've hacked together something > that works for splitting the image in the way mkimage expects. > The file name passed to mkimage with the -d flag is: > ./mkimage.simple-bin.mkimage.1:./mkimage.simple-bin.mkimage.2 > > I definitely don't expect this to be accepted as is, I just use it as an > example of what we need to fully support this in binman. > Adding the following allows me to build images automatically for rk356x: > > mkimage { > args = "-n", CONFIG_SYS_SOC, "-T", "rksd"; > mkimage,separate_files; Adding a property to toggle this sounds reasonable to me. The prefix might not be necessary, and I think dashes are preferred to underscores in property names. > > ddrl { > type = "blob-ext"; > filename = "rk3568_ddr_1560MHz_v1.12.bin"; > }; > > u-boot-spl { > }; > }; > > This is my first attempt to use in-reply-to, so I hope this works. FYI, I see it as a reply to 00/25 of the series. > > Thanks, > Peter Geis > > Signed-off-by: Peter Geis > --- > tools/binman/entry.py | 43 ++++++++++++++++++++++++++--------- > tools/binman/etype/mkimage.py | 3 ++- > 2 files changed, 34 insertions(+), 12 deletions(-) > > diff --git a/tools/binman/entry.py b/tools/binman/entry.py > index 249f117ace56..48e552fc6af3 100644 > --- a/tools/binman/entry.py > +++ b/tools/binman/entry.py > @@ -114,6 +114,8 @@ class Entry(object): > self.bintools = {} > self.missing_bintools = [] > self.update_hash = True > + self.fname_tmp = str() > + self.index = 0 > > @staticmethod > def FindEntryClass(etype, expanded): > @@ -1134,7 +1136,7 @@ features to produce new behaviours. > """ > self.update_hash = update_hash > > - def collect_contents_to_file(self, entries, prefix, fake_size=0): > + def collect_contents_to_file(self, entries, prefix, fake_size=0, separate=False): > """Put the contents of a list of entries into a file > > Args: > @@ -1152,13 +1154,32 @@ features to produce new behaviours. > str: Unique portion of filename (or None if no data) > """ > data = b'' > - for entry in entries: > - # First get the input data and put it in a file. If not available, > - # try later. > - if not entry.ObtainContents(fake_size=fake_size): > - return None, None, None > - data += entry.GetData() > - uniq = self.GetUniqueName() > - fname = tools.get_output_filename(f'{prefix}.{uniq}') > - tools.write_file(fname, data) > - return data, fname, uniq > + if separate is False: > + for entry in entries: > + # First get the input data and put it in a file. If not available, > + # try later. > + if not entry.ObtainContents(fake_size=fake_size): > + return None, None, None > + data += entry.GetData() > + uniq = self.GetUniqueName() > + fname = tools.get_output_filename(f'{prefix}.{uniq}') > + tools.write_file(fname, data) > + return data, fname, uniq > + else: > + for entry in entries: > + self.index = (self.index + 1) > + if (self.index > 2): > + print('BINMAN Warn: mkimage only supports a maximum of two separate files') > + break > + # First get the input data and put it in a file. If not available, > + # try later. > + if not entry.ObtainContents(fake_size=fake_size): > + return None, None, None > + data = entry.GetData() > + uniq = self.GetUniqueName() > + fname = tools.get_output_filename(f'{prefix}.{uniq}.{self.index}') > + tools.write_file(fname, data) > + self.fname_tmp = [''.join(self.fname_tmp),fname] > + fname = ':'.join(self.fname_tmp) > + uniq = self.GetUniqueName() > + return data, fname, uniq I would keep this function as-is and call it multiple times in the mkimage etype code below (once per subentry), and also do the mkimage-specific checks and 'file1:file2' argument joining there as well. > diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py > index 5f6def2287f6..ce5f6b6b543a 100644 > --- a/tools/binman/etype/mkimage.py > +++ b/tools/binman/etype/mkimage.py > @@ -46,6 +46,7 @@ class Entry_mkimage(Entry): > def __init__(self, section, etype, node): > super().__init__(section, etype, node) > self._args = fdt_util.GetArgs(self._node, 'args') > + self._mkimage_separate = fdt_util.GetBool(self._node, 'mkimage,separate_files') > self._mkimage_entries = OrderedDict() > self.align_default = None > self.ReadEntries() > @@ -53,7 +54,7 @@ class Entry_mkimage(Entry): > 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) > + self._mkimage_entries.values(), 'mkimage', 1024, self._mkimage_separate) > if data is None: > return False > output_fname = tools.get_output_filename('mkimage-out.%s' % uniq)