Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000-2004 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 5 | * |
| 6 | * (C) Copyright 2003 |
| 7 | * Kai-Uwe Bloem, Auerswald GmbH & Co KG, <linux-development@auerswald.de> |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 10 | |
| 11 | /* |
| 12 | * Multi Image extract |
| 13 | */ |
| 14 | #include <common.h> |
| 15 | #include <command.h> |
Simon Glass | 1eb69ae | 2019-11-14 12:57:39 -0700 | [diff] [blame] | 16 | #include <cpu_func.h> |
Simon Glass | c7694dd | 2019-08-01 09:46:46 -0600 | [diff] [blame] | 17 | #include <env.h> |
Simon Glass | 0c670fc | 2019-08-01 09:46:36 -0600 | [diff] [blame] | 18 | #include <gzip.h> |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 19 | #include <image.h> |
Simon Glass | 336d461 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 20 | #include <malloc.h> |
Joe Hershberger | 0eb25b6 | 2015-03-22 17:08:59 -0500 | [diff] [blame] | 21 | #include <mapmem.h> |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 22 | #include <watchdog.h> |
| 23 | #if defined(CONFIG_BZIP2) |
| 24 | #include <bzlib.h> |
| 25 | #endif |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 26 | #include <asm/byteorder.h> |
Simon Glass | 90526e9 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 27 | #include <asm/cache.h> |
Simon Glass | 628af17 | 2013-08-30 11:00:09 -0600 | [diff] [blame] | 28 | #include <asm/io.h> |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 29 | |
Tom Rini | 6e7df1d | 2023-01-10 11:19:45 -0500 | [diff] [blame] | 30 | #ifndef CFG_SYS_XIMG_LEN |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 31 | /* use 8MByte as default max gunzip size */ |
Tom Rini | 6e7df1d | 2023-01-10 11:19:45 -0500 | [diff] [blame] | 32 | #define CFG_SYS_XIMG_LEN 0x800000 |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 33 | #endif |
| 34 | |
Kim Phillips | 088f1b1 | 2012-10-29 13:34:31 +0000 | [diff] [blame] | 35 | static int |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 36 | do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 37 | { |
Simon Glass | bb872dd | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 38 | ulong addr = image_load_addr; |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 39 | ulong dest = 0; |
Heiko Schocher | 21d29f7 | 2014-05-28 11:33:33 +0200 | [diff] [blame] | 40 | ulong data, len; |
Bartlomiej Sieka | fbe7a15 | 2008-03-20 19:38:45 +0100 | [diff] [blame] | 41 | int verify; |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 42 | int part = 0; |
Tom Rini | c76c93a | 2019-05-23 07:14:07 -0400 | [diff] [blame] | 43 | #if defined(CONFIG_LEGACY_IMAGE_FORMAT) |
Heiko Schocher | 21d29f7 | 2014-05-28 11:33:33 +0200 | [diff] [blame] | 44 | ulong count; |
Simon Glass | f3543e6 | 2022-09-06 20:26:52 -0600 | [diff] [blame] | 45 | struct legacy_img_hdr *hdr = NULL; |
Heiko Schocher | 21d29f7 | 2014-05-28 11:33:33 +0200 | [diff] [blame] | 46 | #endif |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 47 | #if defined(CONFIG_FIT) |
Bartlomiej Sieka | fbe7a15 | 2008-03-20 19:38:45 +0100 | [diff] [blame] | 48 | const char *uname = NULL; |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 49 | const void* fit_hdr; |
| 50 | int noffset; |
| 51 | const void *fit_data; |
| 52 | size_t fit_len; |
| 53 | #endif |
Simon Glass | a92181b | 2013-04-17 16:13:45 +0000 | [diff] [blame] | 54 | #ifdef CONFIG_GZIP |
Tom Rini | 6e7df1d | 2023-01-10 11:19:45 -0500 | [diff] [blame] | 55 | uint unc_len = CFG_SYS_XIMG_LEN; |
Simon Glass | a92181b | 2013-04-17 16:13:45 +0000 | [diff] [blame] | 56 | #endif |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 57 | uint8_t comp; |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 58 | |
Simon Glass | bfebc8c | 2017-08-03 12:22:13 -0600 | [diff] [blame] | 59 | verify = env_get_yesno("verify"); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 60 | |
| 61 | if (argc > 1) { |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 62 | addr = hextoul(argv[1], NULL); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 63 | } |
| 64 | if (argc > 2) { |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 65 | part = hextoul(argv[2], NULL); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 66 | #if defined(CONFIG_FIT) |
| 67 | uname = argv[2]; |
| 68 | #endif |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 69 | } |
| 70 | if (argc > 3) { |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 71 | dest = hextoul(argv[3], NULL); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 72 | } |
| 73 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 74 | switch (genimg_get_format((void *)addr)) { |
Tom Rini | c76c93a | 2019-05-23 07:14:07 -0400 | [diff] [blame] | 75 | #if defined(CONFIG_LEGACY_IMAGE_FORMAT) |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 76 | case IMAGE_FORMAT_LEGACY: |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 77 | |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 78 | printf("## Copying part %d from legacy image " |
| 79 | "at %08lx ...\n", part, addr); |
| 80 | |
Simon Glass | f3543e6 | 2022-09-06 20:26:52 -0600 | [diff] [blame] | 81 | hdr = (struct legacy_img_hdr *)addr; |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 82 | if (!image_check_magic(hdr)) { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 83 | printf("Bad Magic Number\n"); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 84 | return 1; |
| 85 | } |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 86 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 87 | if (!image_check_hcrc(hdr)) { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 88 | printf("Bad Header Checksum\n"); |
| 89 | return 1; |
| 90 | } |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 91 | #ifdef DEBUG |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 92 | image_print_contents(hdr); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 93 | #endif |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 94 | |
Pierre Aubert | 83636fa | 2015-09-16 08:29:11 +0200 | [diff] [blame] | 95 | if (!image_check_type(hdr, IH_TYPE_MULTI) && |
| 96 | !image_check_type(hdr, IH_TYPE_SCRIPT)) { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 97 | printf("Wrong Image Type for %s command\n", |
| 98 | cmdtp->name); |
| 99 | return 1; |
| 100 | } |
| 101 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 102 | comp = image_get_comp(hdr); |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 103 | if ((comp != IH_COMP_NONE) && (argc < 4)) { |
| 104 | printf("Must specify load address for %s command " |
| 105 | "with compressed image\n", |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 106 | cmdtp->name); |
| 107 | return 1; |
| 108 | } |
| 109 | |
| 110 | if (verify) { |
| 111 | printf(" Verifying Checksum ... "); |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 112 | if (!image_check_dcrc(hdr)) { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 113 | printf("Bad Data CRC\n"); |
| 114 | return 1; |
| 115 | } |
| 116 | printf("OK\n"); |
| 117 | } |
| 118 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 119 | count = image_multi_count(hdr); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 120 | if (part >= count) { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 121 | printf("Bad Image Part\n"); |
| 122 | return 1; |
| 123 | } |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 124 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 125 | image_multi_getimg(hdr, part, &data, &len); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 126 | break; |
Heiko Schocher | 21d29f7 | 2014-05-28 11:33:33 +0200 | [diff] [blame] | 127 | #endif |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 128 | #if defined(CONFIG_FIT) |
| 129 | case IMAGE_FORMAT_FIT: |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 130 | if (uname == NULL) { |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 131 | puts("No FIT subimage unit name\n"); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 132 | return 1; |
| 133 | } |
| 134 | |
| 135 | printf("## Copying '%s' subimage from FIT image " |
| 136 | "at %08lx ...\n", uname, addr); |
| 137 | |
| 138 | fit_hdr = (const void *)addr; |
Simon Glass | c581970 | 2021-02-15 17:08:09 -0700 | [diff] [blame] | 139 | if (fit_check_format(fit_hdr, IMAGE_SIZE_INVAL)) { |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 140 | puts("Bad FIT image format\n"); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 141 | return 1; |
| 142 | } |
| 143 | |
| 144 | /* get subimage node offset */ |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 145 | noffset = fit_image_get_node(fit_hdr, uname); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 146 | if (noffset < 0) { |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 147 | printf("Can't find '%s' FIT subimage\n", uname); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 148 | return 1; |
| 149 | } |
| 150 | |
Stefan Theil | 240e58e | 2019-01-07 10:25:52 +0100 | [diff] [blame] | 151 | if (!fit_image_check_comp(fit_hdr, noffset, IH_COMP_NONE) |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 152 | && (argc < 4)) { |
| 153 | printf("Must specify load address for %s command " |
| 154 | "with compressed image\n", |
| 155 | cmdtp->name); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 156 | return 1; |
| 157 | } |
| 158 | |
| 159 | /* verify integrity */ |
| 160 | if (verify) { |
Simon Glass | b8da836 | 2013-05-07 06:11:57 +0000 | [diff] [blame] | 161 | if (!fit_image_verify(fit_hdr, noffset)) { |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 162 | puts("Bad Data Hash\n"); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 163 | return 1; |
| 164 | } |
| 165 | } |
| 166 | |
Tien Fong Chee | 3695ea5 | 2019-02-12 20:49:30 +0800 | [diff] [blame] | 167 | /* get subimage/external data address and length */ |
| 168 | if (fit_image_get_data_and_size(fit_hdr, noffset, |
| 169 | &fit_data, &fit_len)) { |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 170 | puts("Could not find script subimage data\n"); |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 171 | return 1; |
| 172 | } |
| 173 | |
Daniel Golle | 88de6c5 | 2022-08-27 04:17:28 +0100 | [diff] [blame] | 174 | if (fit_image_get_comp(fit_hdr, noffset, &comp)) |
| 175 | comp = IH_COMP_NONE; |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 176 | |
Bartlomiej Sieka | fbe7a15 | 2008-03-20 19:38:45 +0100 | [diff] [blame] | 177 | data = (ulong)fit_data; |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 178 | len = (ulong)fit_len; |
| 179 | break; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 180 | #endif |
| 181 | default: |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 182 | puts("Invalid image type for imxtract\n"); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 183 | return 1; |
| 184 | } |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 185 | |
| 186 | if (argc > 3) { |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 187 | switch (comp) { |
| 188 | case IH_COMP_NONE: |
| 189 | #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) |
| 190 | { |
| 191 | size_t l = len; |
| 192 | size_t tail; |
| 193 | void *to = (void *) dest; |
| 194 | void *from = (void *)data; |
| 195 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 196 | printf(" Loading part %d ... ", part); |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 197 | |
| 198 | while (l > 0) { |
| 199 | tail = (l > CHUNKSZ) ? CHUNKSZ : l; |
Stefan Roese | 29caf93 | 2022-09-02 14:10:46 +0200 | [diff] [blame] | 200 | schedule(); |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 201 | memmove(to, from, tail); |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 202 | to += tail; |
| 203 | from += tail; |
| 204 | l -= tail; |
| 205 | } |
| 206 | } |
| 207 | #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 208 | printf(" Loading part %d ... ", part); |
| 209 | memmove((char *) dest, (char *)data, len); |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 210 | #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ |
| 211 | break; |
Matthew McClintock | 0e0996e | 2011-05-24 05:48:26 +0000 | [diff] [blame] | 212 | #ifdef CONFIG_GZIP |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 213 | case IH_COMP_GZIP: |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 214 | printf(" Uncompressing part %d ... ", part); |
| 215 | if (gunzip((void *) dest, unc_len, |
| 216 | (uchar *) data, &len) != 0) { |
| 217 | puts("GUNZIP ERROR - image not loaded\n"); |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 218 | return 1; |
| 219 | } |
| 220 | break; |
Matthew McClintock | 0e0996e | 2011-05-24 05:48:26 +0000 | [diff] [blame] | 221 | #endif |
Tom Rini | c76c93a | 2019-05-23 07:14:07 -0400 | [diff] [blame] | 222 | #if defined(CONFIG_BZIP2) && defined(CONFIG_LEGACY_IMAGE_FORMAT) |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 223 | case IH_COMP_BZIP2: |
Wolfgang Denk | 5f566f4 | 2010-01-31 21:51:43 +0100 | [diff] [blame] | 224 | { |
| 225 | int i; |
| 226 | |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 227 | printf(" Uncompressing part %d ... ", part); |
Wolfgang Denk | 5f566f4 | 2010-01-31 21:51:43 +0100 | [diff] [blame] | 228 | /* |
Wolfgang Denk | 93910ed | 2010-03-12 23:06:04 +0100 | [diff] [blame] | 229 | * If we've got less than 4 MB of malloc() |
Wolfgang Denk | 5f566f4 | 2010-01-31 21:51:43 +0100 | [diff] [blame] | 230 | * space, use slower decompression algorithm |
| 231 | * which requires at most 2300 KB of memory. |
| 232 | */ |
| 233 | i = BZ2_bzBuffToBuffDecompress( |
Simon Glass | 628af17 | 2013-08-30 11:00:09 -0600 | [diff] [blame] | 234 | map_sysmem(ntohl(hdr->ih_load), 0), |
Wolfgang Denk | 5f566f4 | 2010-01-31 21:51:43 +0100 | [diff] [blame] | 235 | &unc_len, (char *)data, len, |
| 236 | CONFIG_SYS_MALLOC_LEN < (4096 * 1024), |
| 237 | 0); |
| 238 | if (i != BZ_OK) { |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 239 | printf("BUNZIP2 ERROR %d - " |
Wolfgang Denk | 5f566f4 | 2010-01-31 21:51:43 +0100 | [diff] [blame] | 240 | "image not loaded\n", i); |
| 241 | return 1; |
| 242 | } |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 243 | } |
| 244 | break; |
| 245 | #endif /* CONFIG_BZIP2 */ |
| 246 | default: |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 247 | printf("Unimplemented compression type %d\n", comp); |
Wolfgang Wegner | 5912d36 | 2009-12-10 10:11:21 +0100 | [diff] [blame] | 248 | return 1; |
| 249 | } |
Stephen Warren | 712fbcf | 2011-10-18 11:11:49 +0000 | [diff] [blame] | 250 | puts("OK\n"); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 251 | } |
| 252 | |
Mario Six | 8354aa2 | 2018-03-28 14:39:10 +0200 | [diff] [blame] | 253 | flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN)); |
Pieter Voorthuijsen | c72b65c | 2015-01-12 16:23:18 +0100 | [diff] [blame] | 254 | |
Simon Glass | 018f530 | 2017-08-03 12:22:10 -0600 | [diff] [blame] | 255 | env_set_hex("fileaddr", data); |
| 256 | env_set_hex("filesize", len); |
wdenk | 48abe7b | 2004-06-09 10:15:00 +0000 | [diff] [blame] | 257 | |
| 258 | return 0; |
| 259 | } |
| 260 | |
Tom Rini | 3616218 | 2023-10-07 15:13:08 -0400 | [diff] [blame] | 261 | U_BOOT_LONGHELP(imgextract, |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 262 | "addr part [dest]\n" |
| 263 | " - extract <part> from legacy image at <addr> and copy to <dest>" |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 264 | #if defined(CONFIG_FIT) |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 265 | "\n" |
| 266 | "addr uname [dest]\n" |
| 267 | " - extract <uname> subimage from FIT image at <addr> and copy to <dest>" |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 268 | #endif |
Tom Rini | 3616218 | 2023-10-07 15:13:08 -0400 | [diff] [blame] | 269 | ); |
Kim Phillips | 088f1b1 | 2012-10-29 13:34:31 +0000 | [diff] [blame] | 270 | |
| 271 | U_BOOT_CMD( |
| 272 | imxtract, 4, 1, do_imgextract, |
| 273 | "extract a part of a multi-image", imgextract_help_text |
Marian Balakowicz | 1b7897f | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 274 | ); |