[U-Boot-Users] [PATCH 10/20] [new uImage] Add new uImage format support to arch specific do_bootm_linux() routines
Bartlomiej Sieka
tur at semihalf.com
Wed Mar 12 21:11:28 CET 2008
From: Marian Balakowicz <m8 at semihalf.com>
This patch updates architecture specific implementations of
do_bootm_linux() adding new uImage format handling for
operations like get kernel entry point address, get kernel
image data start address.
Signed-off-by: Marian Balakowicz <m8 at semihalf.com>
---
lib_arm/bootm.c | 20 ++++++++++++++++----
lib_avr32/bootm.c | 20 ++++++++++++++++----
lib_blackfin/bootm.c | 17 ++++++++++++++---
lib_i386/bootm.c | 26 +++++++++++++++++++++-----
lib_m68k/bootm.c | 12 +++++++-----
lib_microblaze/bootm.c | 17 ++++++++++++++---
lib_mips/bootm.c | 19 +++++++++++++++----
lib_nios2/bootm.c | 17 ++++++++++++++---
lib_ppc/bootm.c | 8 ++++++--
lib_sh/bootm.c | 17 ++++++++++++++---
10 files changed, 137 insertions(+), 36 deletions(-)
diff --git a/lib_arm/bootm.c b/lib_arm/bootm.c
index 08eef0b..c5e8cb3 100644
--- a/lib_arm/bootm.c
+++ b/lib_arm/bootm.c
@@ -70,6 +70,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
char *s;
int machid = bd->bi_arch_number;
void (*theKernel)(int zero, int arch, uint params);
+ int ret;
#ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv ("bootargs");
@@ -80,12 +81,16 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("ARM linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
theKernel = (void (*)(int, int, uint))ep;
@@ -98,7 +103,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_ARM,
&initrd_start, &initrd_end);
if (ret)
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
show_boot_progress (15);
@@ -151,6 +156,13 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
cleanup_before_linux ();
theKernel (0, machid, bd->bi_boot_params);
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
diff --git a/lib_avr32/bootm.c b/lib_avr32/bootm.c
index c9a0190..b1c651a 100644
--- a/lib_avr32/bootm.c
+++ b/lib_avr32/bootm.c
@@ -181,25 +181,30 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
void (*theKernel)(int magic, void *tagtable);
struct tag *params, *params_start;
char *commandline = getenv("bootargs");
+ int ret;
/* find kernel entry point */
if (images->legacy_hdr_valid) {
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("AVR32 linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
theKernel = (void *)ep;
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_AVR32,
&initrd_start, &initrd_end);
if (ret)
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
show_boot_progress (15);
@@ -225,4 +230,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
prepare_to_boot();
theKernel(ATAG_MAGIC, params_start);
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c
index 33979a9..1ea80f4 100644
--- a/lib_blackfin/bootm.c
+++ b/lib_blackfin/bootm.c
@@ -65,12 +65,16 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("AVR32 linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ int ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
appl = (int (*)(char *))ep;
@@ -85,6 +89,13 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
dcache_disable();
}
(*appl) (cmdline);
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
char *make_command_line(void)
diff --git a/lib_i386/bootm.c b/lib_i386/bootm.c
index b4a52fa..107ebaa 100644
--- a/lib_i386/bootm.c
+++ b/lib_i386/bootm.c
@@ -40,11 +40,15 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong ep;
image_header_t *hdr;
int ret;
+#if defined(CONFIG_FIT)
+ const void *data;
+ size_t len;
+#endif
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_I386,
&initrd_start, &initrd_end);
if (ret)
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
if (images->legacy_hdr_valid) {
hdr = images->legacy_hdr_os;
@@ -58,12 +62,18 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
}
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("I386 linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ ret = fit_image_get_data (images->fit_hdr_os,
+ images->fit_noffset_os, &data, &len);
+ if (ret) {
+ puts ("Can't get image data/size!\n");
+ goto error;
+ }
+ os_data = (ulong)data;
+ os_len = (ulong)len;
#endif
} else {
puts ("Could not find kernel image!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
base_ptr = load_zimage ((void*)os_data, os_len,
@@ -71,7 +81,7 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
if (NULL == base_ptr) {
printf ("## Kernel loading failed ...\n");
- do_reset(cmdtp, flag, argc, argv);
+ goto error;
}
@@ -87,5 +97,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf("\nStarting kernel ...\n\n");
boot_zimage(base_ptr);
+ /* does not return */
+ return;
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
diff --git a/lib_m68k/bootm.c b/lib_m68k/bootm.c
index f185bea..6f49c31 100644
--- a/lib_m68k/bootm.c
+++ b/lib_m68k/bootm.c
@@ -35,8 +35,6 @@
DECLARE_GLOBAL_DATA_PTR;
-extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-
#define PHYSADDR(x) x
#define LINUX_MAX_ENVS 256
@@ -101,12 +99,16 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("M68K linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
diff --git a/lib_microblaze/bootm.c b/lib_microblaze/bootm.c
index 99c4533..fab4a54 100644
--- a/lib_microblaze/bootm.c
+++ b/lib_microblaze/bootm.c
@@ -47,12 +47,16 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("MICROBLAZE linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ int ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
theKernel = (void (*)(char *))ep;
@@ -67,4 +71,11 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
return ;
theKernel (commandline);
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
diff --git a/lib_mips/bootm.c b/lib_mips/bootm.c
index 5e7a460..e4c139e 100644
--- a/lib_mips/bootm.c
+++ b/lib_mips/bootm.c
@@ -60,19 +60,23 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("MIPS linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
theKernel = (void (*)(int, char **, char **, int *))ep;
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_MIPS,
&initrd_start, &initrd_end);
if (ret)
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
show_boot_progress (15);
@@ -116,6 +120,13 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
printf ("\nStarting kernel ...\n\n");
theKernel (linux_argc, linux_argv, linux_env, 0);
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
static void linux_params_init (ulong start, char *line)
diff --git a/lib_nios2/bootm.c b/lib_nios2/bootm.c
index 4b940cb..0c89e96 100644
--- a/lib_nios2/bootm.c
+++ b/lib_nios2/bootm.c
@@ -37,12 +37,16 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("NIOS2 linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ int ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
void (*kernel)(void) = (void (*)(void))ep;
@@ -53,4 +57,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
* needs to be called ;-)
*/
kernel ();
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 4d8ef35..86e104c 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -150,8 +150,12 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("PPC linux bootm");
- goto error;
+ ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c
index 8055841..49462c8 100644
--- a/lib_sh/bootm.c
+++ b/lib_sh/bootm.c
@@ -70,12 +70,16 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("SH linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ int ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
void (*kernel) (void) = (void (*)(void))ep;
@@ -87,4 +91,11 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
strcpy(COMMAND_LINE, bootargs);
kernel();
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}
More information about the U-Boot
mailing list