diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-01-07 02:53:41 +0000 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2013-01-16 10:52:07 +0100 |
commit | 0ea7213f63f580aa679a36795831dabd35d786aa (patch) | |
tree | 7052cd366046b15a0701d4a8a8b5a1d5b3c38814 | |
parent | e08634c7bfdb5fcda2541a8845d44888538d6178 (diff) | |
download | u-boot-imx-0ea7213f63f580aa679a36795831dabd35d786aa.zip u-boot-imx-0ea7213f63f580aa679a36795831dabd35d786aa.tar.gz u-boot-imx-0ea7213f63f580aa679a36795831dabd35d786aa.tar.bz2 |
MIPS: bootm.c: separate environment initialization
Move the environment initialization code into a
separate function. This make the code reusable
for bootm subcommands.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
-rw-r--r-- | arch/mips/lib/bootm.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 689d17b..8c2e508 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -43,34 +43,12 @@ static int linux_env_idx; static void linux_params_init(ulong start, char *commandline); static void linux_env_set(char *env_name, char *env_val); -static void boot_jump_linux(bootm_headers_t *images) -{ - void (*theKernel) (int, char **, char **, int *); - - /* find kernel entry point */ - theKernel = (void (*)(int, char **, char **, int *))images->ep; - - debug("## Transferring control to Linux (at address %08lx) ...\n", - (ulong) theKernel); - - bootstage_mark(BOOTSTAGE_ID_RUN_OS); - - /* we assume that the kernel is in place */ - printf("\nStarting kernel ...\n\n"); - - theKernel(linux_argc, linux_argv, linux_env, 0); -} - -int do_bootm_linux(int flag, int argc, char * const argv[], - bootm_headers_t *images) +static void boot_prep_linux(bootm_headers_t *images) { char *commandline = getenv("bootargs"); char env_buf[12]; char *cp; - if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) - return 1; - linux_params_init(UNCACHED_SDRAM(gd->bd->bi_boot_params), commandline); #ifdef CONFIG_MEMSIZE_IN_BYTES @@ -103,7 +81,33 @@ int do_bootm_linux(int flag, int argc, char * const argv[], cp = getenv("eth1addr"); if (cp) linux_env_set("eth1addr", cp); +} + +static void boot_jump_linux(bootm_headers_t *images) +{ + void (*theKernel) (int, char **, char **, int *); + + /* find kernel entry point */ + theKernel = (void (*)(int, char **, char **, int *))images->ep; + + debug("## Transferring control to Linux (at address %08lx) ...\n", + (ulong) theKernel); + + bootstage_mark(BOOTSTAGE_ID_RUN_OS); + + /* we assume that the kernel is in place */ + printf("\nStarting kernel ...\n\n"); + + theKernel(linux_argc, linux_argv, linux_env, 0); +} + +int do_bootm_linux(int flag, int argc, char * const argv[], + bootm_headers_t *images) +{ + if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) + return 1; + boot_prep_linux(images); boot_jump_linux(images); /* does not return */ |