From 05e8e2403c533cc9e7a2a548486e2e41dfd5ce53 Mon Sep 17 00:00:00 2001 From: Nikita Shubin Date: Mon, 19 Dec 2022 11:05:27 +0300 Subject: imxtract: specify max gunzip size Specify max gunzip size from config to override SYS_XIMG_LEN default value wich is 0x800000. In case we have a large portion of FIT image, for example gzipped kernel with decompressed size large than 0x800000 we should enlarge imxract area, otherwise extracting it will fail. It used to be a hardcoded define in cmd/ximg.c and we are moving it to config. Signed-off-by: Nikita Shubin Reviewed-by: Simon Glass --- cmd/Kconfig | 10 ++++++++++ cmd/ximg.c | 7 +------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 24bfbe50572..5a7678f0ac9 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -495,6 +495,16 @@ config CMD_XIMG help Extract a part of a multi-image. +config SYS_XIMG_LEN + hex "imxtract max gunzip size" + default 0x800000 + depends on CMD_XIMG && GZIP + help + This provides the size of the commad-line argument area + used by imxtract for extracting pieces of FIT image. + It should be large enough to fit uncompressed size of + FIT piece we are extracting. + config CMD_SPL bool "spl export - Export boot information for Falcon boot" depends on SPL diff --git a/cmd/ximg.c b/cmd/ximg.c index a50dd20b19a..0e7eead8d19 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -27,11 +27,6 @@ #include #include -#ifndef CFG_SYS_XIMG_LEN -/* use 8MByte as default max gunzip size */ -#define CFG_SYS_XIMG_LEN 0x800000 -#endif - static int do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -52,7 +47,7 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) size_t fit_len; #endif #ifdef CONFIG_GZIP - uint unc_len = CFG_SYS_XIMG_LEN; + uint unc_len = CONFIG_SYS_XIMG_LEN; #endif uint8_t comp; -- cgit v1.3.1 From 785834d62ef3c4121601a4a68a032d96100b7475 Mon Sep 17 00:00:00 2001 From: Robert Catherall Date: Thu, 23 Nov 2023 14:16:01 +0000 Subject: arm: afs: Set the filesize env. var. on load The `afs load` command copies data to RAM. Set the filesize environment variable to record how much data was 'loaded' Signed-off-by: Robert Catherall Reviewed-by: Andre Przywara Tested-by: Andre Przywara --- cmd/armflash.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/armflash.c b/cmd/armflash.c index d1466f73aa4..fdaea5ad811 100644 --- a/cmd/armflash.c +++ b/cmd/armflash.c @@ -180,6 +180,7 @@ static int load_image(const char * const name, const ulong address) { struct afs_image *afi = NULL; int i; + loff_t len_read = 0; parse_flash(); for (i = 0; i < num_afs_images; i++) { @@ -197,6 +198,7 @@ static int load_image(const char * const name, const ulong address) for (i = 0; i < afi->region_count; i++) { ulong from, to; + u32 size; from = afi->flash_mem_start + afi->regions[i].offset; if (address) { @@ -208,14 +210,20 @@ static int load_image(const char * const name, const ulong address) return CMD_RET_FAILURE; } - memcpy((void *)to, (void *)from, afi->regions[i].size); + size = afi->regions[i].size; + memcpy((void *)to, (void *)from, size); printf("loaded region %d from %08lX to %08lX, %08X bytes\n", i, from, to, - afi->regions[i].size); + size); + + len_read += size; } + + env_set_hex("filesize", len_read); + return CMD_RET_SUCCESS; } -- cgit v1.3.1 From 921f63e5723880bbbaf65429564e5638b7bbd002 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 29 Nov 2023 10:31:19 -0700 Subject: bootflow: Allow setting a cmdline arg with no value This is supposed to be supported by the 'bootflow cmd' command, at least according to the help. There is a 'bootflow cmd clear' but it is often more intuitive to use 'bootcmd cmd set' with an empty value. Update the command to pass BOOTFLOWCL_EMPTY in this case. Signed-off-by: Simon Glass --- cmd/bootflow.c | 4 ++-- test/boot/bootflow.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/bootflow.c b/cmd/bootflow.c index 4a47265ebd5..cc6dfae1668 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -543,9 +543,9 @@ static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc, op = argv[1]; arg = argv[2]; if (*op == 's') { - if (argc < 4) + if (argc < 3) return CMD_RET_USAGE; - val = argv[3]; + val = argv[3] ?: (const char *)BOOTFLOWCL_EMPTY; } switch (*op) { diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index f3e5a839da4..a9b555c7794 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -1095,6 +1095,10 @@ static int bootflow_cmdline(struct unit_test_state *uts) ut_asserteq(0, run_command("bootflow cmdline get mary", 0)); ut_assert_nextline_empty(); + ut_asserteq(0, run_command("bootflow cmdline set mary abc", 0)); + ut_asserteq(0, run_command("bootflow cmdline set mary", 0)); + ut_assert_nextline_empty(); + ut_assert_console_end(); return 0; -- cgit v1.3.1 From 97135d9f4220e54b38f69a3f2416b2fd9d8f378c Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 10 Dec 2023 22:25:07 +0100 Subject: cmd: part: Cover both part type entries with GUID ifdef The 'part type' subcommand depends on GUID partition table support. The help text exposes one of two 'part type' subcommand entries, hide both in case GUID partition table support is not enabled to avoid confusing users. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- cmd/part.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/part.c b/cmd/part.c index 0ce190005d3..c75f85acd52 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -308,9 +308,9 @@ U_BOOT_CMD( #ifdef CONFIG_PARTITION_TYPE_GUID "part type :\n" " - print partition type\n" -#endif "part type : \n" " - set environment variable to partition type\n" +#endif "part set type\n" " - set partition type for a device\n" "part types\n" -- cgit v1.3.1