mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-09 20:18:54 -04:00
bootm: Move to using a function pointer table for the boot os function
This removes a bit of code and makes it easier for the upcoming sub bootm command support to call into the proper OS specific handler. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
d35c451d6c
commit
be08315933
@ -119,6 +119,22 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
|
|||||||
static boot_os_fn do_bootm_integrity;
|
static boot_os_fn do_bootm_integrity;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
boot_os_fn * boot_os[] = {
|
||||||
|
[IH_OS_LINUX] = do_bootm_linux,
|
||||||
|
[IH_OS_NETBSD] = do_bootm_netbsd,
|
||||||
|
#ifdef CONFIG_LYNXKDI
|
||||||
|
[IH_OS_LYNXOS] = do_bootm_lynxkdi,
|
||||||
|
#endif
|
||||||
|
[IH_OS_RTEMS] = do_bootm_rtems,
|
||||||
|
#if defined(CONFIG_CMD_ELF)
|
||||||
|
[IH_OS_VXWORKS] = do_bootm_vxworks,
|
||||||
|
[IH_OS_QNX] = do_bootm_qnxelf,
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_INTEGRITY
|
||||||
|
[IH_OS_INTEGRITY] = do_bootm_integrity,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
|
ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
|
||||||
static bootm_headers_t images; /* pointers to os/initrd/fdt images */
|
static bootm_headers_t images; /* pointers to os/initrd/fdt images */
|
||||||
|
|
||||||
@ -386,12 +402,22 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* bootm - boot application image from image in memory */
|
/* bootm - boot application image from image in memory */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
static int relocated = 0;
|
||||||
|
|
||||||
int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
ulong iflag;
|
ulong iflag;
|
||||||
ulong load_end = 0;
|
ulong load_end = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
boot_os_fn *boot_fn;
|
||||||
|
|
||||||
|
/* relocate boot function table */
|
||||||
|
if (!relocated) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < ARRAY_SIZE(boot_os); i++)
|
||||||
|
boot_os[i] += gd->reloc_off;
|
||||||
|
relocated = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (bootm_start(cmdtp, flag, argc, argv))
|
if (bootm_start(cmdtp, flag, argc, argv))
|
||||||
return 1;
|
return 1;
|
||||||
@ -454,45 +480,13 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||||||
|
|
||||||
show_boot_progress (8);
|
show_boot_progress (8);
|
||||||
|
|
||||||
switch (images.os.os) {
|
|
||||||
default: /* handled by (original) Linux case */
|
|
||||||
case IH_OS_LINUX:
|
|
||||||
#ifdef CONFIG_SILENT_CONSOLE
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
fixup_silent_linux();
|
if (images.os.os == IH_OS_LINUX)
|
||||||
#endif
|
fixup_silent_linux();
|
||||||
do_bootm_linux (0, argc, argv, &images);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IH_OS_NETBSD:
|
|
||||||
do_bootm_netbsd (0, argc, argv, &images);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef CONFIG_LYNXKDI
|
|
||||||
case IH_OS_LYNXOS:
|
|
||||||
do_bootm_lynxkdi (0, argc, argv, &images);
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case IH_OS_RTEMS:
|
boot_fn = boot_os[images.os.os];
|
||||||
do_bootm_rtems (0, argc, argv, &images);
|
boot_fn(0, argc, argv, &images);
|
||||||
break;
|
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_ELF)
|
|
||||||
case IH_OS_VXWORKS:
|
|
||||||
do_bootm_vxworks (0, argc, argv, &images);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IH_OS_QNX:
|
|
||||||
do_bootm_qnxelf (0, argc, argv, &images);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_INTEGRITY
|
|
||||||
case IH_OS_INTEGRITY:
|
|
||||||
do_bootm_integrity (0, argc, argv, &images);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
show_boot_progress (-9);
|
show_boot_progress (-9);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user