#include <common.h>
#include <command.h>
#include <image.h>
-#include <zlib.h>
+#include <u-boot/zlib.h>
#include <asm/byteorder.h>
#include <asm/zimage.h>
/*cmd_boot.c*/
-extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-
-void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
- bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
{
void *base_ptr;
ulong os_data, os_len;
- ulong initrd_start, initrd_end;
- ulong ep;
image_header_t *hdr;
- get_ramdisk (cmdtp, flag, argc, argv, images,
- IH_ARCH_I386, &initrd_start, &initrd_end);
+#if defined(CONFIG_FIT)
+ const void *data;
+ size_t len;
+#endif
+
+ if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
+ return 1;
if (images->legacy_hdr_valid) {
hdr = images->legacy_hdr_os;
}
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("I386 linux bootm");
- do_reset (cmdtp, flag, argc, argv);
+ ret = fit_image_get_data (images->fit_hdr_os,
+ images->fit_noffset_os, &data, &len);
+ if (ret) {
+ puts ("Can't get image data/size!\n");
+ goto error;
+ }
+ os_data = (ulong)data;
+ os_len = (ulong)len;
#endif
} else {
puts ("Could not find kernel image!\n");
- do_reset (cmdtp, flag, argc, argv);
+ goto error;
}
base_ptr = load_zimage ((void*)os_data, os_len,
- initrd_start, initrd_end - initrd_start, 0);
+ images->rd_start, images->rd_end - images->rd_start, 0);
if (NULL == base_ptr) {
printf ("## Kernel loading failed ...\n");
- do_reset(cmdtp, flag, argc, argv);
+ goto error;
}
- if (!images->autostart)
- return ;
-
#ifdef DEBUG
printf ("## Transferring control to Linux (at address %08x) ...\n",
(u32)base_ptr);
printf("\nStarting kernel ...\n\n");
boot_zimage(base_ptr);
+ /* does not return */
+error:
+ return 1;
}