Skip to content
Snippets Groups Projects
Commit cd7c596e authored by Marian Balakowicz's avatar Marian Balakowicz
Browse files

[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: default avatarMarian Balakowicz <m8@semihalf.com>
parent 3dfe1101
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -70,6 +70,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
char *s; char *s;
int machid = bd->bi_arch_number; int machid = bd->bi_arch_number;
void (*theKernel)(int zero, int arch, uint params); void (*theKernel)(int zero, int arch, uint params);
int ret;
#ifdef CONFIG_CMDLINE_TAG #ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv ("bootargs"); char *commandline = getenv ("bootargs");
...@@ -80,12 +81,16 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("ARM linux bootm"); ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
theKernel = (void (*)(int, int, uint))ep; theKernel = (void (*)(int, int, uint))ep;
...@@ -98,7 +103,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -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, ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_ARM,
&initrd_start, &initrd_end); &initrd_start, &initrd_end);
if (ret) if (ret)
do_reset (cmdtp, flag, argc, argv); goto error;
show_boot_progress (15); show_boot_progress (15);
...@@ -151,6 +156,13 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -151,6 +156,13 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
cleanup_before_linux (); cleanup_before_linux ();
theKernel (0, machid, bd->bi_boot_params); theKernel (0, machid, bd->bi_boot_params);
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
......
...@@ -181,25 +181,30 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -181,25 +181,30 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
void (*theKernel)(int magic, void *tagtable); void (*theKernel)(int magic, void *tagtable);
struct tag *params, *params_start; struct tag *params, *params_start;
char *commandline = getenv("bootargs"); char *commandline = getenv("bootargs");
int ret;
/* find kernel entry point */ /* find kernel entry point */
if (images->legacy_hdr_valid) { if (images->legacy_hdr_valid) {
ep = image_get_ep (images->legacy_hdr_os); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("AVR32 linux bootm"); ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
theKernel = (void *)ep; theKernel = (void *)ep;
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_AVR32, ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_AVR32,
&initrd_start, &initrd_end); &initrd_start, &initrd_end);
if (ret) if (ret)
do_reset (cmdtp, flag, argc, argv); goto error;
show_boot_progress (15); show_boot_progress (15);
...@@ -225,4 +230,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -225,4 +230,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
prepare_to_boot(); prepare_to_boot();
theKernel(ATAG_MAGIC, params_start); theKernel(ATAG_MAGIC, params_start);
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
...@@ -65,12 +65,16 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("AVR32 linux bootm"); int ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
appl = (int (*)(char *))ep; appl = (int (*)(char *))ep;
...@@ -85,6 +89,13 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ...@@ -85,6 +89,13 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
dcache_disable(); dcache_disable();
} }
(*appl) (cmdline); (*appl) (cmdline);
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
char *make_command_line(void) char *make_command_line(void)
......
...@@ -40,11 +40,15 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -40,11 +40,15 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong ep; ulong ep;
image_header_t *hdr; image_header_t *hdr;
int ret; int ret;
#if defined(CONFIG_FIT)
const void *data;
size_t len;
#endif
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_I386, ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_I386,
&initrd_start, &initrd_end); &initrd_start, &initrd_end);
if (ret) if (ret)
do_reset (cmdtp, flag, argc, argv); goto error;
if (images->legacy_hdr_valid) { if (images->legacy_hdr_valid) {
hdr = images->legacy_hdr_os; hdr = images->legacy_hdr_os;
...@@ -58,12 +62,18 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -58,12 +62,18 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
} }
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("I386 linux bootm"); ret = fit_image_get_data (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); 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 #endif
} else { } else {
puts ("Could not find kernel image!\n"); puts ("Could not find kernel image!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
base_ptr = load_zimage ((void*)os_data, os_len, 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[], ...@@ -71,7 +81,7 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
if (NULL == base_ptr) { if (NULL == base_ptr) {
printf ("## Kernel loading failed ...\n"); 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[], ...@@ -87,5 +97,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf("\nStarting kernel ...\n\n"); printf("\nStarting kernel ...\n\n");
boot_zimage(base_ptr); boot_zimage(base_ptr);
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
#define PHYSADDR(x) x #define PHYSADDR(x) x
#define LINUX_MAX_ENVS 256 #define LINUX_MAX_ENVS 256
...@@ -101,12 +99,16 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, ...@@ -101,12 +99,16 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
ep = image_get_ep (images->legacy_hdr_os); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("M68K linux bootm"); ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); 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; kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
......
...@@ -47,12 +47,16 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("MICROBLAZE linux bootm"); int ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
theKernel = (void (*)(char *))ep; theKernel = (void (*)(char *))ep;
...@@ -67,4 +71,11 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ...@@ -67,4 +71,11 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
return ; return ;
theKernel (commandline); theKernel (commandline);
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
...@@ -60,19 +60,23 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("MIPS linux bootm"); ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
theKernel = (void (*)(int, char **, char **, int *))ep; theKernel = (void (*)(int, char **, char **, int *))ep;
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_MIPS, ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_MIPS,
&initrd_start, &initrd_end); &initrd_start, &initrd_end);
if (ret) if (ret)
do_reset (cmdtp, flag, argc, argv); goto error;
show_boot_progress (15); show_boot_progress (15);
...@@ -116,6 +120,13 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ...@@ -116,6 +120,13 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
printf ("\nStarting kernel ...\n\n"); printf ("\nStarting kernel ...\n\n");
theKernel (linux_argc, linux_argv, linux_env, 0); 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) static void linux_params_init (ulong start, char *line)
......
...@@ -37,12 +37,16 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("NIOS2 linux bootm"); int ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
void (*kernel)(void) = (void (*)(void))ep; void (*kernel)(void) = (void (*)(void))ep;
...@@ -53,4 +57,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -53,4 +57,11 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
* needs to be called ;-) * needs to be called ;-)
*/ */
kernel (); kernel ();
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
...@@ -150,8 +150,12 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("PPC linux bootm"); ret = fit_image_get_entry (images->fit_hdr_os,
goto error; images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
......
...@@ -70,12 +70,16 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -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); ep = image_get_ep (images->legacy_hdr_os);
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
} else if (images->fit_uname_os) { } else if (images->fit_uname_os) {
fit_unsupported_reset ("SH linux bootm"); int ret = fit_image_get_entry (images->fit_hdr_os,
do_reset (cmdtp, flag, argc, argv); images->fit_noffset_os, &ep);
if (ret) {
puts ("Can't get entry point property!\n");
goto error;
}
#endif #endif
} else { } else {
puts ("Could not find kernel entry point!\n"); puts ("Could not find kernel entry point!\n");
do_reset (cmdtp, flag, argc, argv); goto error;
} }
void (*kernel) (void) = (void (*)(void))ep; void (*kernel) (void) = (void (*)(void))ep;
...@@ -87,4 +91,11 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], ...@@ -87,4 +91,11 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
strcpy(COMMAND_LINE, bootargs); strcpy(COMMAND_LINE, bootargs);
kernel(); kernel();
/* does not return */
return;
error:
if (images->autostart)
do_reset (cmdtp, flag, argc, argv);
return;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment