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 2122BECAAA1 for ; Mon, 31 Oct 2022 14:14:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF01785302; Mon, 31 Oct 2022 15:14:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4181D85220; Mon, 31 Oct 2022 15:13:53 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 01CD48526B for ; Mon, 31 Oct 2022 15:13:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mkl@pengutronix.de Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opVXu-0007CX-HF for u-boot@lists.denx.de; Mon, 31 Oct 2022 15:13:46 +0100 Received: from dspam.blackshift.org (localhost [127.0.0.1]) by bjornoya.blackshift.org (Postfix) with SMTP id F222C10F2A6 for ; Mon, 31 Oct 2022 14:13:45 +0000 (UTC) Received: from hardanger.blackshift.org (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by bjornoya.blackshift.org (Postfix) with ESMTPS id BD6E010F2A2; Mon, 31 Oct 2022 14:13:45 +0000 (UTC) Received: from blackshift.org (localhost [::1]) by hardanger.blackshift.org (OpenSMTPD) with ESMTP id 3be2ca4d; Mon, 31 Oct 2022 14:13:45 +0000 (UTC) From: Marc Kleine-Budde To: u-boot@lists.denx.de Cc: embedded@vivavis.com, Marc Kleine-Budde Subject: [PATCH 3/3] tools: mkimage: add cmd-line option '-L' to force legacy images Date: Mon, 31 Oct 2022 15:13:44 +0100 Message-Id: <20221031141344.227865-4-mkl@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221031141344.227865-1-mkl@pengutronix.de> References: <20221031141344.227865-1-mkl@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: u-boot@lists.denx.de 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 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; -- 2.35.1