]> git.sur5r.net Git - u-boot/blobdiff - lib_m68k/bootm.c
Merge branch 'Makefile' of git://git.denx.de/u-boot-arm
[u-boot] / lib_m68k / bootm.c
index ac04da08a5c1d3494b0d2041749cbf4eff6da7f9..6504cc9174cee48e2f861d8127119a1b7138b7c5 100644 (file)
@@ -43,18 +43,21 @@ DECLARE_GLOBAL_DATA_PTR;
 static ulong get_sp (void);
 static void set_clocks_in_mhz (bd_t *kbd);
 
-void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
-                   int argc, char *argv[],
-                   image_header_t *hdr, int verify)
+int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 {
-       ulong sp, sp_limit, alloc_current;
+       ulong sp;
 
-       ulong rd_data_start, rd_data_end, rd_len;
+       ulong rd_len;
        ulong initrd_start, initrd_end;
+       int ret;
 
        ulong cmd_start, cmd_end;
-       bd_t *kbd;
-       void (*kernel) (bd_t *, ulong, ulong, ulong, ulong);
+       ulong bootmap_base;
+       bd_t  *kbd;
+       void  (*kernel) (bd_t *, ulong, ulong, ulong, ulong);
+       struct lmb *lmb = &images->lmb;
+
+       bootmap_base = getenv_bootm_low();
 
        /*
         * Booting a (Linux) kernel image
@@ -68,28 +71,32 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
        sp = get_sp();
        debug ("## Current stack ends at 0x%08lx ", sp);
 
-       alloc_current = sp_limit = get_boot_sp_limit(sp);
-       debug ("=> set upper limit to 0x%08lx\n", sp_limit);
+       /* adjust sp by 1K to be safe */
+       sp -= 1024;
+       lmb_reserve(lmb, sp, (CFG_SDRAM_BASE + gd->ram_size - sp));
 
        /* allocate space and init command line */
-       alloc_current = get_boot_cmdline (alloc_current, &cmd_start, &cmd_end);
+       ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
+       if (ret) {
+               puts("ERROR with allocation of cmdline\n");
+               goto error;
+       }
 
        /* allocate space for kernel copy of board info */
-       alloc_current = get_boot_kbd (alloc_current, &kbd);
+       ret = boot_get_kbd (lmb, &kbd, bootmap_base);
+       if (ret) {
+               puts("ERROR with allocation of kernel bd\n");
+               goto error;
+       }
        set_clocks_in_mhz(kbd);
 
-       /* find kernel */
-       kernel =
-           (void (*)(bd_t *, ulong, ulong, ulong, ulong))image_get_ep (hdr);
-
-       /* find ramdisk */
-       get_ramdisk (cmdtp, flag, argc, argv, hdr, verify,
-                       IH_ARCH_M68K, &rd_data_start, &rd_data_end);
+       kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))images->ep;
 
-       rd_len = rd_data_end - rd_data_start;
-       alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
-                       kbd, sp_limit, get_sp (),
+       rd_len = images->rd_end - images->rd_start;
+       ret = boot_ramdisk_high (lmb, images->rd_start, rd_len,
                        &initrd_start, &initrd_end);
+       if (ret)
+               goto error;
 
        debug("## Transferring control to Linux (at address %08lx) ...\n",
              (ulong) kernel);
@@ -106,6 +113,8 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
         */
        (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
        /* does not return */
+error:
+       return 1;
 }
 
 static ulong get_sp (void)