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 6EE61C433F5 for ; Tue, 15 Feb 2022 11:53:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6EEC083A3B; Tue, 15 Feb 2022 12:53:36 +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="Wm+OMgbE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BFF4F83A47; Tue, 15 Feb 2022 12:53:30 +0100 (CET) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (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 8EA15839E2 for ; Tue, 15 Feb 2022 12:53:26 +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-ed1-x52a.google.com with SMTP id z22so6183720edd.1 for ; Tue, 15 Feb 2022 03:53:26 -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=puY8JrX+3wFQZocD7NRH7VYS3CRc8SvGcn2kIDI4E1A=; b=Wm+OMgbEk3UVy6hGtLpnbdLSEspLRLxb2K+P1FZIxsYs/d+ZZ51HwO6/zwa2COnDxw FCpMKa0nqDlucbt+6VZ+WMGCEKRlYxUmEs9WElWEKNRFqvM4GcL5b8vhNBvSCUKV9lF8 5tpPh2+eYkjg8+IAHEVne1ovpyNfCAoZNPbnZuHB5DXZD9nlN+2A5Aro3Oigkim4x16o xPNI51qjnpiBVEdQurFELq1MpQdz+HbCvZ6zhx+Uat3F+yKPv9QChDBJoi6+lnRxjbXj n45BmB7BaVgRI3r9fruplMPcOyGcFF2NytNubgrwNJsozUBkIiP0S2oA2adkem8N9l20 P6fw== 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=puY8JrX+3wFQZocD7NRH7VYS3CRc8SvGcn2kIDI4E1A=; b=f9Og/QmWCjYWzklVKqxtBdZRepDTjZjvrOLyGHYTNxknUAd8InrbHMJeY0sSfE2tSv K6AnhFSj9O8uIv0je47QkPL/PYkyPNVGcUIa94W5zJyAfjH8IrlSWZwWUg+s0RMjblJN 9M1ZvvMiF0CSwdFV0Y4dImV9+2lLEXAHehmFsK1I/DSDvCRFWWmUGnSyyGsoIDHmQU9a IOGXIOfqYoxoztoulMqzodZRTRQTgzD/aEHAIS0WL/wq5FaixAjSGIh0BQQCsHTcfq+U nAgUN0I4ETNMdbE1X3FbMmb5QMUQFMgbeiJ9hlU2uSsHJx8Nh8cUi/ZJy3zx68Fv67ej v7GA== X-Gm-Message-State: AOAM533LcCd6F0MRVFljP0sj6HWkpfydxPr7MVGiyuk2/plJzh/1gcEY SomgNf1W/KoUwD3wtFVubfqbMghMJLY= X-Google-Smtp-Source: ABdhPJxRILla3Eeqq0/YfXYK3xCjZ9QovwcRdPs27rsmefvAnFy+Bb/FthdEBo0HTsRCrywO/AeFnA== X-Received: by 2002:aa7:dac5:: with SMTP id x5mr1329005eds.57.1644926006091; Tue, 15 Feb 2022 03:53:26 -0800 (PST) Received: from [192.168.0.74] ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id j9sm1351398ejo.106.2022.02.15.03.53.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Feb 2022 03:53:25 -0800 (PST) Message-ID: <38d9af52-0e96-1025-14a7-c479fd8a17ca@gmail.com> Date: Tue, 15 Feb 2022 14:45:03 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 From: Alper Nebi Yasak Subject: Re: [PATCH 14/24] binman: Support a list of strings with the mkimage etype To: Simon Glass , U-Boot Mailing List Cc: huang lin , Jeffy Chen , Kever Yang , Tom Rini , Philippe Reynes , Ivan Mikhaylov , Heiko Thiery References: <20220208185008.35843-1-sjg@chromium.org> <20220208185008.35843-13-sjg@chromium.org> Content-Language: en-US In-Reply-To: <20220208185008.35843-13-sjg@chromium.org> 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 08/02/2022 21:49, Simon Glass wrote: > At present the 'args' property of the mkimage entry type is a string. This > makes it difficult to include CONFIG options in that property. In > particular, this does not work: > > args = "-n CONFIG_SYS_SOC -E" > > since the preprocessor does not operate within strings, nor does this: > > args = "-n" CONFIG_SYS_SOC" "-E" > > since the device tree compiler does not understand string concatenation. Fun fact, I got something like this roughly working: #define _QUOTE(x) #x #define QUOTE(x) _QUOTE(x) #define MKIMAGE_ARGS QUOTE( \ -A arm -T kernel -C none -O linux -n U-Boot \ -a CONFIG_SYS_TEXT_BASE -e CONFIG_SYS_TEXT_BASE \ ) But obviously a string list is the better choice. > > With this new feature, we can do: > > args = "-n", CONFIG_SYS_SOC, "-E"; > > Signed-off-by: Simon Glass > --- > > tools/binman/entries.rst | 11 +++++++++++ > tools/binman/etype/mkimage.py | 13 ++++++++++++- > 2 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst > index 0fb6d56296..b32dc58933 100644 > --- a/tools/binman/entries.rst > +++ b/tools/binman/entries.rst > @@ -931,6 +931,17 @@ This calls mkimage to create an imximage with u-boot-spl.bin as the input > file. The output from mkimage then becomes part of the image produced by > binman. > > +To use CONFIG options in the arguments, use a string list instead, as in > +this example which also produces four arguments:: > + > + mkimage { > + args = "-n", CONFIG_SYS_SOC, "-T imximage"; > + > + u-boot-spl { > + }; > + }; > + > + > > > Entry: op-tee: Open Portable Trusted Execution Environment (OP-TEE) blob > diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py > index 201ee4b569..9ecd1c2548 100644 > --- a/tools/binman/etype/mkimage.py > +++ b/tools/binman/etype/mkimage.py > @@ -31,10 +31,21 @@ class Entry_mkimage(Entry): > This calls mkimage to create an imximage with u-boot-spl.bin as the input > file. The output from mkimage then becomes part of the image produced by > binman. > + > + To use CONFIG options in the arguments, use a string list instead, as in > + this example which also produces four arguments:: > + > + mkimage { > + args = "-n", CONFIG_SYS_SOC, "-T imximage"; > + > + u-boot-spl { > + }; > + }; > + > """ > def __init__(self, section, etype, node): > super().__init__(section, etype, node) > - self._args = fdt_util.GetString(self._node, 'args').split(' ') > + self._args = fdt_util.GetArgs(self._node, 'args') If you're OK with each string being a single argument, I think you could use GetStringList(default=[]) and shlex.join() here instead. > self._mkimage_entries = OrderedDict() > self.align_default = None > self.ReadEntries()