diff options
author | Marian Balakowicz <m8@semihalf.com> | 2008-02-04 08:28:09 +0100 |
---|---|---|
committer | Marian Balakowicz <m8@semihalf.com> | 2008-02-25 15:53:49 +0100 |
commit | d5934ad7756f038a393a9cfab76a4fe306d9d930 (patch) | |
tree | 0299a8fc06709c436f3e1715f80f3e5f9f00885d /common/cmd_autoscript.c | |
parent | 5583cbf736474ef754e128a54fb78632f57b48fd (diff) | |
download | u-boot-imx-d5934ad7756f038a393a9cfab76a4fe306d9d930.zip u-boot-imx-d5934ad7756f038a393a9cfab76a4fe306d9d930.tar.gz u-boot-imx-d5934ad7756f038a393a9cfab76a4fe306d9d930.tar.bz2 |
[new uImage] Add dual format uImage support framework
This patch adds framework for dual format images. Format detection is added
and the bootm controll flow is updated to include cases for new FIT format
uImages.
When the legacy (image_header based) format is detected appropriate
legacy specific handling is invoked. For the new (FIT based) format uImages
dual boot framework has a minial support, that will only print out a
corresponding debug messages. Implementation of the FIT specific handling will
be added in following patches.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common/cmd_autoscript.c')
-rw-r--r-- | common/cmd_autoscript.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c index 53f8e83..f9ab1d9 100644 --- a/common/cmd_autoscript.c +++ b/common/cmd_autoscript.c @@ -53,7 +53,7 @@ int autoscript (ulong addr) { ulong len; - image_header_t *hdr = (image_header_t *)addr; + image_header_t *hdr; ulong *data; char *cmd; int rcode = 0; @@ -61,33 +61,47 @@ autoscript (ulong addr) verify = getenv_verify (); - if (!image_check_magic (hdr)) { - puts ("Bad magic number\n"); - return 1; - } + switch (gen_image_get_format ((void *)addr)) { + case IMAGE_FORMAT_LEGACY: + hdr = (image_header_t *)addr; - if (!image_check_hcrc (hdr)) { - puts ("Bad header crc\n"); - return 1; - } + if (!image_check_magic (hdr)) { + puts ("Bad magic number\n"); + return 1; + } - if (verify) { - if (!image_check_dcrc (hdr)) { - puts ("Bad data crc\n"); + if (!image_check_hcrc (hdr)) { + puts ("Bad header crc\n"); return 1; } - } - if (!image_check_type (hdr, IH_TYPE_SCRIPT)) { - puts ("Bad image type\n"); - return 1; - } + if (verify) { + if (!image_check_dcrc (hdr)) { + puts ("Bad data crc\n"); + return 1; + } + } + + if (!image_check_type (hdr, IH_TYPE_SCRIPT)) { + puts ("Bad image type\n"); + return 1; + } - /* get length of script */ - data = (ulong *)image_get_data (hdr); + /* get length of script */ + data = (ulong *)image_get_data (hdr); - if ((len = image_to_cpu (*data)) == 0) { - puts ("Empty Script\n"); + if ((len = image_to_cpu (*data)) == 0) { + puts ("Empty Script\n"); + return 1; + } + break; +#if defined(CONFIG_FIT) + case IMAGE_FORMAT_FIT: + fit_unsupported ("autoscript"); + return 1; +#endif + default: + puts ("Wrong image format for autoscript\n"); return 1; } |