diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_bootm.c | 2 | ||||
-rw-r--r-- | common/cmd_jffs2.c | 4 | ||||
-rw-r--r-- | common/cmd_mp.c | 3 | ||||
-rw-r--r-- | common/cmd_ximg.c | 92 | ||||
-rw-r--r-- | common/image.c | 1 |
5 files changed, 93 insertions, 9 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index f28e88f..23ab0c4 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -352,6 +352,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) *load_end = load + image_len; puts("OK\n"); break; +#ifdef CONFIG_GZIP case IH_COMP_GZIP: printf (" Uncompressing %s ... ", type_name); if (gunzip ((void *)load, unc_len, @@ -365,6 +366,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) *load_end = load + image_len; break; +#endif /* CONFIG_GZIP */ #ifdef CONFIG_BZIP2 case IH_COMP_BZIP2: printf (" Uncompressing %s ... ", type_name); diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 372ccb2..6799cca 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -406,8 +406,6 @@ int mtdparts_init(void) part->offset = 0x00000000; #endif - part->sector_size = get_part_sector_size(id, part); - part->dev = current_mtd_dev; INIT_LIST_HEAD(&part->link); @@ -415,6 +413,8 @@ int mtdparts_init(void) if (part->size == SIZE_REMAINING) part->size = id->size - part->offset; + part->sector_size = get_part_sector_size(id, part); + DEBUGF("part : name = %s, size = 0x%08lx, offset = 0x%08lx\n", part->name, part->size, part->offset); diff --git a/common/cmd_mp.c b/common/cmd_mp.c index 71e4303..d78c209 100644 --- a/common/cmd_mp.c +++ b/common/cmd_mp.c @@ -46,6 +46,8 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) cpu_reset(cpuid); } else if (strncmp(argv[2], "status", 6) == 0) { cpu_status(cpuid); + } else if (strncmp(argv[2], "disable", 7) == 0) { + return cpu_disable(cpuid); } else { cmd_usage(cmdtp); return 1; @@ -86,6 +88,7 @@ U_BOOT_CMD( "Multiprocessor CPU boot manipulation and release", "<num> reset - Reset cpu <num>\n" "cpu <num> status - Status of cpu <num>\n" + "cpu <num> disable - Disable cpu <num>\n" "cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]" #ifdef CPU_ARCH_HELP "\n" diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index 5593b2d..3e5fb44 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -31,8 +31,17 @@ #include <common.h> #include <command.h> #include <image.h> +#include <watchdog.h> +#if defined(CONFIG_BZIP2) +#include <bzlib.h> +#endif #include <asm/byteorder.h> +#ifndef CONFIG_SYS_XIMG_LEN +/* use 8MByte as default max gunzip size */ +#define CONFIG_SYS_XIMG_LEN 0x800000 +#endif + int do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { @@ -50,6 +59,8 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) const void *fit_data; size_t fit_len; #endif + uint unc_len = CONFIG_SYS_XIMG_LEN; + uint8_t comp; verify = getenv_yesno ("verify"); @@ -92,8 +103,10 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 1; } - if (image_get_comp (hdr) != IH_COMP_NONE) { - printf("Wrong Compression Type for %s command\n", + comp = image_get_comp (hdr); + if ((comp != IH_COMP_NONE) && (argc < 4)) { + printf("Must specify load address for %s command " + "with compressed image\n", cmdtp->name); return 1; } @@ -138,9 +151,11 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 1; } - if (fit_image_check_comp (fit_hdr, noffset, IH_COMP_NONE)) { - printf("Wrong Compression Type for %s command\n", - cmdtp->name); + if (fit_image_check_comp (fit_hdr, noffset, IH_COMP_NONE) + && (argc < 4)) { + printf("Must specify load address for %s command " + "with compressed image\n", + cmdtp->name); return 1; } @@ -153,11 +168,18 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } /* get subimage data address and length */ - if (fit_image_get_data (fit_hdr, noffset, &fit_data, &fit_len)) { + if (fit_image_get_data (fit_hdr, noffset, + &fit_data, &fit_len)) { puts ("Could not find script subimage data\n"); return 1; } + if (fit_image_get_comp (fit_hdr, noffset, &comp)) { + puts ("Could not find script subimage " + "compression type\n"); + return 1; + } + data = (ulong)fit_data; len = (ulong)fit_len; break; @@ -168,7 +190,63 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } if (argc > 3) { - memcpy((char *) dest, (char *) data, len); + switch (comp) { + case IH_COMP_NONE: +#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) + { + size_t l = len; + size_t tail; + void *to = (void *) dest; + void *from = (void *)data; + + printf (" Loading part %d ... ", part); + + while (l > 0) { + tail = (l > CHUNKSZ) ? CHUNKSZ : l; + WATCHDOG_RESET(); + memmove (to, from, tail); + to += tail; + from += tail; + l -= tail; + } + } +#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ + printf (" Loading part %d ... ", part); + memmove ((char *) dest, (char *)data, len); +#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ + break; + case IH_COMP_GZIP: + printf (" Uncompressing part %d ... ", part); + if (gunzip ((void *) dest, unc_len, + (uchar *) data, &len) != 0) { + puts ("GUNZIP ERROR - image not loaded\n"); + return 1; + } + break; +#if defined(CONFIG_BZIP2) + case IH_COMP_BZIP2: + printf (" Uncompressing part %d ... ", part); + /* + * If we've got less than 4 MB of malloc() space, + * use slower decompression algorithm which requires + * at most 2300 KB of memory. + */ + i = BZ2_bzBuffToBuffDecompress + ((char*)ntohl(hdr->ih_load), + &unc_len, (char *)data, len, + CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0); + if (i != BZ_OK) { + printf ("BUNZIP2 ERROR %d - " + "image not loaded\n", i); + return 1; + } + break; +#endif /* CONFIG_BZIP2 */ + default: + printf ("Unimplemented compression type %d\n", comp); + return 1; + } + puts ("OK\n"); } sprintf(pbuf, "%8lx", data); diff --git a/common/image.c b/common/image.c index 82e7aa4..9e49713 100644 --- a/common/image.c +++ b/common/image.c @@ -140,6 +140,7 @@ static table_entry_t uimage_type[] = { { IH_TYPE_STANDALONE, "standalone", "Standalone Program", }, { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",}, + { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",}, { -1, "", "", }, }; |