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 A13B2FA3741 for ; Tue, 1 Nov 2022 00:16:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3185385526; Tue, 1 Nov 2022 01:16:46 +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="IwEhVal7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CF6585565; Tue, 1 Nov 2022 01:16:45 +0100 (CET) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (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 1151185395 for ; Tue, 1 Nov 2022 01:16:42 +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=seanga2@gmail.com Received: by mail-qt1-x832.google.com with SMTP id b22so2853917qtr.12 for ; Mon, 31 Oct 2022 17:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2QWCFg/5vXJGxaQmd360MqeeuyJqJiv2+gjOJYFgqAw=; b=IwEhVal7deTrgkqMAat9WeS3kJzfO09Oj2Tsa44xlG35ID3POTljcjEDzv+p3Ugakf oeQBscsErjDHIbdjgKOLXvPTQVnES/tm8iKNhObUzieZDBeFlgcihSo2sI0obMNMFx9z G464JTxOAp6jZpuxkU631afrnKq5pyk8l77cFpAgrsLlzbO9ex73QbUXLpvVXnm28T7v Cur4RvmxktgxT2I1ZxI4VDYvuO/8+OByCShKyrKegZ81K5f8ei+hvByBEIR2cnGs7bYC z70YdC63zhNoZe78NYEJjtuJNQR+ra9mapiAEBmTy90WlSi3fL8k/PPuV6DjSUAcPoyb 2Ouw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2QWCFg/5vXJGxaQmd360MqeeuyJqJiv2+gjOJYFgqAw=; b=H1MBfk+Z/Zz6wqIKRpX6Ek4YGGANWyw7nG+lB9wPlKyLhY1cFsXzDtb5padYAEIbrO FQzKc3YbYQ/+XgvYHQsrJRSsYp70uCWK039Wp8rSaUzyPiBrY5j7tc26VnZ+nwAdUOsa RL4c1v2L0BC7Yo/fhak4I28Hhec7iFfv8FEQVKbYhOy6eBp4wQSe08qYuKpiHVMtAsN3 8CiMUQeGmmEzs30QmTXEGw5zMay+J3Os/FTyy8NbZG6jkjbvy+rfKKXlwgEAlWhwJ/w3 y6QV9K+CJiGt5e9TPHt33Tljjt/jstQySLl02rf9mVcdZbcwoIJmQOhzfzMfIay7wDW5 /4VQ== X-Gm-Message-State: ACrzQf1482ibsd1EZAleEiG26nYXsY1tf0HW28cz0PB6nGEaeY7+vO9q uYCPvvs7sDcufgZT6Uk0iLs= X-Google-Smtp-Source: AMsMyM7NwHT/bNkbISKArvKjCEvR2ugkazAGuryxmIvdBRRwC8Lk+MIFfH1QZ8nrZFismwQnYEDGaA== X-Received: by 2002:ac8:7f54:0:b0:39c:bb57:a1aa with SMTP id g20-20020ac87f54000000b0039cbb57a1aamr13156588qtk.382.1667261800805; Mon, 31 Oct 2022 17:16:40 -0700 (PDT) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.gmail.com with ESMTPSA id x10-20020ae9e64a000000b006e2d087fd63sm5561709qkl.63.2022.10.31.17.16.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 17:16:40 -0700 (PDT) Message-ID: <5c9c9075-1fcd-63ae-080e-5cde33e9cae9@gmail.com> Date: Mon, 31 Oct 2022 20:16:39 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 3/3] tools: mkimage: add cmd-line option '-L' to force legacy images Content-Language: en-US To: Simon Glass Cc: Marc Kleine-Budde , u-boot@lists.denx.de, embedded@vivavis.com References: <20221031141344.227865-1-mkl@pengutronix.de> <20221031141344.227865-4-mkl@pengutronix.de> <3daa8d43-25e6-4c71-cdaa-6194ee0c043c@gmail.com> From: Sean Anderson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed 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.6 at phobos.denx.de X-Virus-Status: Clean On 10/31/22 15:27, Simon Glass wrote: > Hi, > > On Mon, 31 Oct 2022 at 08:21, Sean Anderson wrote: >> >> On 10/31/22 10:13, Marc Kleine-Budde wrote: >>> If the user select the image type "flat_dt" a FIT image will be build. >>> This breaks the legacy use case of putting a Flat Device Tree into a >>> legacy u-boot image. >>> >>> Add command line options "-L" and "--legacy" to let the user force the >>> creation of a legacy u-boot image, even if "flat_dt" is selected. >>> >>> Link: https://lore.kernel.org/all/20221028155205.ojw6tcso2fofgnhm@pengutronix.de >>> Signed-off-by: Marc Kleine-Budde >>> --- >>> tools/default_image.c | 1 + >>> tools/fit_common.c | 3 +++ >>> tools/mkimage.c | 7 ++++++- >>> 3 files changed, 10 insertions(+), 1 deletion(-) >>> >>> diff --git a/tools/default_image.c b/tools/default_image.c >>> index 9a6b50a946ba..3673eaa63de2 100644 >>> --- a/tools/default_image.c >>> +++ b/tools/default_image.c >>> @@ -27,6 +27,7 @@ static struct legacy_img_hdr header; >>> static int image_check_image_types(uint8_t type, bool legacy) >>> { >>> if (((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT)) || >>> + ((type == IH_TYPE_FLATDT) && legacy) || >>> (type == IH_TYPE_KERNEL_NOLOAD) || (type == IH_TYPE_FIRMWARE_IVT)) >>> return EXIT_SUCCESS; >>> else >>> diff --git a/tools/fit_common.c b/tools/fit_common.c >>> index b4aa89b53577..eba13a789a72 100644 >>> --- a/tools/fit_common.c >>> +++ b/tools/fit_common.c >>> @@ -43,6 +43,9 @@ int fit_verify_header(unsigned char *ptr, int image_size, >>> >>> int fit_check_image_types(uint8_t type, bool legacy) >>> { >>> + if (legacy) >>> + return EXIT_FAILURE; >>> + >>> if (type == IH_TYPE_FLATDT) >>> return EXIT_SUCCESS; >>> else >>> diff --git a/tools/mkimage.c b/tools/mkimage.c >>> index 6d029afab3a8..9e9edd65583e 100644 >>> --- a/tools/mkimage.c >>> +++ b/tools/mkimage.c >>> @@ -91,6 +91,7 @@ static void usage(const char *msg) >>> fprintf(stderr, >>> " %s [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image\n" >>> " -A ==> set architecture to 'arch'\n" >>> + " -L ==> force legacy image\n" >>> " -O ==> set operating system to 'os'\n" >>> " -T ==> set image type to 'type'\n" >>> " -C ==> set compression type 'comp'\n" >>> @@ -159,7 +160,7 @@ static int add_content(int type, const char *fname) >>> } >>> >>> static const char optstring[] = >>> - "a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVx"; >>> + "a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:Lln:N:o:O:p:qrR:stT:vVx"; >>> >>> static const struct option longopts[] = { >>> { "load-address", required_argument, NULL, 'a' }, >>> @@ -181,6 +182,7 @@ static const struct option longopts[] = { >>> { "key-dir", required_argument, NULL, 'k' }, >>> { "key-dest", required_argument, NULL, 'K' }, >>> { "list", no_argument, NULL, 'l' }, >>> + { "legacy", no_argument, NULL, 'L' }, >>> { "config", required_argument, NULL, 'n' }, >>> { "engine", required_argument, NULL, 'N' }, >>> { "algo", required_argument, NULL, 'o' }, >>> @@ -298,6 +300,9 @@ static void process_args(int argc, char **argv) >>> case 'l': >>> params.lflag = 1; >>> break; >>> + case 'L': >>> + params.Lflag = 1; >>> + break; >>> case 'n': >>> params.imagename = optarg; >>> break; >> >> Please add some documentation to the man page (doc/mkimage.1). And also consider not using a short option. > > I like short options :-) So do I, but they are a bit of an endangered species for mkimage :) --Sean