From: Sean Anderson <seanga2@gmail.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>, u-boot@lists.denx.de
Cc: embedded@vivavis.com
Subject: Re: [PATCH 3/3] tools: mkimage: add cmd-line option '-L' to force legacy images
Date: Mon, 31 Oct 2022 10:21:00 -0400 [thread overview]
Message-ID: <3daa8d43-25e6-4c71-cdaa-6194ee0c043c@gmail.com> (raw)
In-Reply-To: <20221031141344.227865-4-mkl@pengutronix.de>
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 <mkl@pengutronix.de>
> ---
> 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.
--Sean
next prev parent reply other threads:[~2022-10-31 14:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 14:13 [PATCH 0/3] tools: mkimage: cleanups + allow to create legacy image with type flat_dt Marc Kleine-Budde
2022-10-31 14:13 ` [PATCH 1/3] tools: mkimage: don't print error message "Success" in case of failure Marc Kleine-Budde
2022-10-31 14:13 ` [PATCH 2/3] tools: mkimage: pass legacy image option to struct image_type_params::check_image_type handlers Marc Kleine-Budde
2022-10-31 14:20 ` Sean Anderson
2022-10-31 14:13 ` [PATCH 3/3] tools: mkimage: add cmd-line option '-L' to force legacy images Marc Kleine-Budde
2022-10-31 14:21 ` Sean Anderson [this message]
2022-10-31 19:27 ` Simon Glass
2022-11-01 0:16 ` Sean Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3daa8d43-25e6-4c71-cdaa-6194ee0c043c@gmail.com \
--to=seanga2@gmail.com \
--cc=embedded@vivavis.com \
--cc=mkl@pengutronix.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox