summaryrefslogtreecommitdiff
path: root/lib_avr32
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-01-08 18:12:17 +0100
committerWolfgang Denk <wd@denx.de>2008-02-07 01:12:57 +0100
commitf13e7b2e993c61fed1f607962501e051940d6e80 (patch)
tree3894629f4d16c470f059ff4aa0d36e949103b79d /lib_avr32
parent1ee1180b6e93e56d0282ac8d943e448e9d0eab20 (diff)
[new uImage] Cleanup image header pointer use in bootm code
- use single image header pointer instead of a set of auxilliary variables. - add multi component image helper routines: get component size/data address Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'lib_avr32')
-rw-r--r--lib_avr32/avr32_linux.c68
1 files changed, 25 insertions, 43 deletions
diff --git a/lib_avr32/avr32_linux.c b/lib_avr32/avr32_linux.c
index 44827ec8853..455590e37dd 100644
--- a/lib_avr32/avr32_linux.c
+++ b/lib_avr32/avr32_linux.c
@@ -174,20 +174,16 @@ static void setup_end_tag(struct tag *params)
}
void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
- unsigned long addr, unsigned long *len_ptr, int verify)
+ image_header_t *hdr, int verify)
{
- unsigned long data, len = 0;
- unsigned long initrd_start, initrd_end;
- unsigned long image_start, image_end;
+ ulong rd_data, rd_len = 0;
+ ulong initrd_start, initrd_end;
+ image_header_t *rd_hdr;
+
void (*theKernel)(int magic, void *tagtable);
- image_header_t *hdr;
struct tag *params, *params_start;
char *commandline = getenv("bootargs");
- hdr = (image_header_t *)addr;
- image_start = addr;
- image_end = addr + image_get_data_size (hdr);
-
theKernel = (void *)image_get_ep (hdr);
/*
@@ -196,29 +192,27 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
if (argc >= 3) {
show_boot_progress (9);
- addr = simple_strtoul(argv[2], NULL, 16);
- hdr = (image_header_t *)addr;
+ rd_hdr = (image_header_t *)simple_strtoul (argv[2], NULL, 16);
+ printf ("## Loading RAMDISK image at %08lx ...\n", rd_hdr);
- printf("## Loading RAMDISK image at %08lx ...\n", addr);
-
- if (!image_check_magic (hdr)) {
+ if (!image_check_magic (rd_hdr)) {
puts("Bad Magic Number\n");
show_boot_progress (-10);
do_reset(cmdtp, flag, argc, argv);
}
- if (!image_check_hcrc (hdr)) {
+ if (!image_check_hcrc (rd_hdr)) {
puts("Bad Header Checksum\n");
show_boot_progress (-11);
do_reset(cmdtp, flag, argc, argv);
}
show_boot_progress (10);
- print_image_hdr (hdr);
+ print_image_hdr (rd_hdr);
if (verify) {
puts(" Verifying Checksum ... ");
- if (!image_check_dcrc (hdr)) {
+ if (!image_check_dcrc (rd_hdr)) {
puts("Bad Data CRC\n");
show_boot_progress (-12);
do_reset(cmdtp, flag, argc, argv);
@@ -228,44 +222,32 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
show_boot_progress (11);
- if (!image_check_os (hdr, IH_OS_LINUX) ||
- !image_check_arch (hdr, IH_ARCH_AVR32) ||
- !image_check_type (hdr, IH_TYPE_RAMDISK)) {
+ if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
+ !image_check_arch (rd_hdr, IH_ARCH_AVR32) ||
+ !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
puts("Not a Linux/AVR32 RAMDISK image\n");
show_boot_progress (-13);
do_reset(cmdtp, flag, argc, argv);
}
- data = image_get_data (hdr);
- len = image_get_data_size (hdr);
-
- } else if (image_check_type (hdr, IH_TYPE_MULTI) && (len_ptr[1])) {
- ulong tail = image_to_cpu (len_ptr[0]) % 4;
- int i;
+ rd_data = image_get_data (rd_hdr);
+ rd_len = image_get_data_size (rd_hdr);
+ } else if (image_check_type (hdr, IH_TYPE_MULTI)) {
+ /*
+ * Get second entry data start address and len
+ */
show_boot_progress (13);
-
- /* skip kernel length and terminator */
- data = (ulong) (&len_ptr[2]);
- /* skip any additional image length fields */
- for (i = 1; len_ptr[i]; ++i)
- data += 4;
- /* add kernel length, and align */
- data += image_to_cpu (len_ptr[0]);
- if (tail) {
- data += 4 - tail;
- }
-
- len = image_to_cpu (len_ptr[1]);
+ image_multi_getimg (hdr, 1, &rd_data, &rd_len);
} else {
/* no initrd image */
show_boot_progress (14);
- len = data = 0;
+ rd_len = rd_data = 0;
}
- if (data) {
- initrd_start = data;
- initrd_end = initrd_start + len;
+ if (rd_data) {
+ initrd_start = rd_data;
+ initrd_end = initrd_start + rd_len;
} else {
initrd_start = 0;
initrd_end = 0;