[new uImage] Add new uImage format support to arch specific do_bootm_linux() routines

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@semihalf.com>
This commit is contained in:
Marian Balakowicz 2008-03-12 10:33:00 +01:00
parent 3dfe110149
commit cd7c596e9f
10 changed files with 137 additions and 36 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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");

View File

@ -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;
}