@@ -318,7 +318,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
hwaddr initrd_size,
hwaddr kernel_size,
bool little_endian,
- const char *boot_device,
const char *kernel_cmdline,
uint32_t epow_irq)
{
@@ -411,9 +410,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
_FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0)));
}
}
- if (boot_device) {
- _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
- }
if (boot_menu) {
_FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu)));
}
@@ -730,6 +726,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
char *bootlist;
void *fdt;
sPAPRPHBState *phb;
+ MachineState *machine = MACHINE(qdev_get_machine());
+ const char *boot_device = machine->boot_order;
fdt = g_malloc(FDT_MAX_SIZE);
@@ -769,6 +767,14 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
fprintf(stderr, "Couldn't finalize CPU device tree properties\n");
}
+ if (boot_device) {
+ int offset = fdt_path_offset(fdt, "/chosen");
+ ret = fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device);
+ if (ret < 0) {
+ fprintf(stderr, "Couldn't set up boot-device dt property\n");
+ }
+ }
+
bootlist = get_boot_devices_list(&cb, true);
if (cb && bootlist) {
int offset = fdt_path_offset(fdt, "/chosen");
@@ -1347,7 +1353,6 @@ static void ppc_spapr_init(MachineState *machine)
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
- const char *boot_device = machine->boot_order;
PowerPCCPU *cpu;
CPUPPCState *env;
PCIHostState *phb;
@@ -1601,8 +1606,7 @@ static void ppc_spapr_init(MachineState *machine)
/* Prepare the device tree */
spapr->fdt_skel = spapr_create_fdt_skel(initrd_base, initrd_size,
kernel_size, kernel_le,
- boot_device, kernel_cmdline,
- spapr->epow_irq);
+ kernel_cmdline, spapr->epow_irq);
assert(spapr->fdt_skel != NULL);
}