hw/riscv/spike.c: load initrd right after riscv_load_kernel()
This will make the code more in line with what the other boards are doing. We'll also avoid an extra check to machine->kernel_filename since we already checked that before executing riscv_load_kernel(). Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Message-Id: <20230102115241.25733-6-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
1db0c57ade
commit
c44df400d9
@ -302,6 +302,10 @@ static void spike_board_init(MachineState *machine)
|
||||
g_free(firmware_name);
|
||||
}
|
||||
|
||||
/* Create device tree */
|
||||
create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline,
|
||||
riscv_is_32bit(&s->soc[0]), htif_custom_base);
|
||||
|
||||
/* Load kernel */
|
||||
if (machine->kernel_filename) {
|
||||
kernel_start_addr = riscv_calc_kernel_start_addr(&s->soc[0],
|
||||
@ -310,6 +314,17 @@ static void spike_board_init(MachineState *machine)
|
||||
kernel_entry = riscv_load_kernel(machine->kernel_filename,
|
||||
kernel_start_addr,
|
||||
htif_symbol_callback);
|
||||
|
||||
if (machine->initrd_filename) {
|
||||
hwaddr start;
|
||||
hwaddr end = riscv_load_initrd(machine->initrd_filename,
|
||||
machine->ram_size, kernel_entry,
|
||||
&start);
|
||||
qemu_fdt_setprop_cell(machine->fdt, "/chosen",
|
||||
"linux,initrd-start", start);
|
||||
qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-end",
|
||||
end);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* If dynamic firmware is used, it doesn't know where is the next mode
|
||||
@ -318,22 +333,6 @@ static void spike_board_init(MachineState *machine)
|
||||
kernel_entry = 0;
|
||||
}
|
||||
|
||||
/* Create device tree */
|
||||
create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline,
|
||||
riscv_is_32bit(&s->soc[0]), htif_custom_base);
|
||||
|
||||
/* Load initrd */
|
||||
if (machine->kernel_filename && machine->initrd_filename) {
|
||||
hwaddr start;
|
||||
hwaddr end = riscv_load_initrd(machine->initrd_filename,
|
||||
machine->ram_size, kernel_entry,
|
||||
&start);
|
||||
qemu_fdt_setprop_cell(machine->fdt, "/chosen",
|
||||
"linux,initrd-start", start);
|
||||
qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-end",
|
||||
end);
|
||||
}
|
||||
|
||||
/* Compute the fdt load address in dram */
|
||||
fdt_load_addr = riscv_load_fdt(memmap[SPIKE_DRAM].base,
|
||||
machine->ram_size, machine->fdt);
|
||||
|
Loading…
Reference in New Issue
Block a user