#include <common.h>
#include <command.h>
#include <errno.h>
-#include <qemu_fw_cfg.h>
+#include <qfw.h>
/*
* This function prepares kernel for zboot. It loads kernel data
* when invoking qemu), do not update bootargs
*/
if (*data_addr != '\0') {
- if (setenv("bootargs", data_addr) < 0)
+ if (env_set("bootargs", data_addr) < 0)
printf("warning: unable to change bootargs\n");
}
}
void *load_addr;
void *initrd_addr;
- env = getenv("loadaddr");
+ env = env_get("loadaddr");
load_addr = env ?
(void *)simple_strtoul(env, NULL, 16) :
+#ifdef CONFIG_LOADADDR
(void *)CONFIG_LOADADDR;
+#else
+ NULL;
+#endif
- env = getenv("ramdiskaddr");
+ env = env_get("ramdiskaddr");
initrd_addr = env ?
(void *)simple_strtoul(env, NULL, 16) :
+#ifdef CONFIG_RAMDISK_ADDR
(void *)CONFIG_RAMDISK_ADDR;
+#else
+ NULL;
+#endif
if (argc == 2) {
load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
}
+ if (!load_addr || !initrd_addr) {
+ printf("missing load or initrd address\n");
+ return CMD_RET_FAILURE;
+ }
+
return qemu_fwcfg_setup_kernel(load_addr, initrd_addr);
}