From: Marian Balakowicz Date: Wed, 12 Mar 2008 09:33:00 +0000 (+0100) Subject: [new uImage] Add new uImage format support to arch specific do_bootm_linux() routines X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=cd7c596e9f561dbbc17b717277438aee78cde14f;p=u-boot.git [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 --- diff --git a/lib_arm/bootm.c b/lib_arm/bootm.c index 08eef0bc28..c5e8cb3eb6 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 c9a0190023..b1c651ab2c 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 33979a9fb2..1ea80f4e36 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 b4a52fa21d..107ebaaa67 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 f185beaa9e..6f49c31616 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 99c453369d..fab4a54418 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 5e7a46031d..e4c139efab 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 4b940cb619..0c89e96358 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 4d8ef35526..86e104cdcc 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 8055841d2f..49462c8458 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; }