]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
MIPS: bootm.c: separate linux jump code
authorGabor Juhos <juhosg@openwrt.org>
Mon, 7 Jan 2013 02:53:40 +0000 (02:53 +0000)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Wed, 16 Jan 2013 09:52:07 +0000 (10:52 +0100)
Move the actual jump 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>
arch/mips/lib/bootm.c

index 4ac712aa4b0f14019fa8e2ff1aa88a868c829c4c..689d17bd355d410407990743255c1b163ac5a15b 100644 (file)
@@ -43,10 +43,27 @@ 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)
 {
-       void (*theKernel) (int, char **, char **, int *);
        char *commandline = getenv("bootargs");
        char env_buf[12];
        char *cp;
@@ -54,14 +71,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
        if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
                return 1;
 
-       /* find kernel entry point */
-       theKernel = (void (*)(int, char **, char **, int *))images->ep;
-
-       bootstage_mark(BOOTSTAGE_ID_RUN_OS);
-
-       debug("## Transferring control to Linux (at address %08lx) ...\n",
-               (ulong) theKernel);
-
        linux_params_init(UNCACHED_SDRAM(gd->bd->bi_boot_params), commandline);
 
 #ifdef CONFIG_MEMSIZE_IN_BYTES
@@ -95,10 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
        if (cp)
                linux_env_set("eth1addr", cp);
 
-       /* we assume that the kernel is in place */
-       printf("\nStarting kernel ...\n\n");
-
-       theKernel(linux_argc, linux_argv, linux_env, 0);
+       boot_jump_linux(images);
 
        /* does not return */
        return 1;