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
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);
*/
(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
/* does not return */
+error:
+ return 1;
}
static ulong get_sp (void)