* [Qemu-devel] [PATCH 1/2] riscv: Add a helper routine for finding firmware
2019-08-16 13:09 [Qemu-devel] [PATCH 0/2] riscv: Fix "-L" not working for bios image search path Bin Meng
@ 2019-08-16 13:09 ` Bin Meng
2019-08-16 13:09 ` [Qemu-devel] [PATCH 2/2] riscv: Resolve full path of the given bios image Bin Meng
2019-08-26 23:48 ` [Qemu-devel] [PATCH 0/2] riscv: Fix "-L" not working for bios image search path Palmer Dabbelt
2 siblings, 0 replies; 5+ messages in thread
From: Bin Meng @ 2019-08-16 13:09 UTC (permalink / raw)
To: Alistair Francis, Bastian Koppelmann, Palmer Dabbelt,
Sagar Karandikar, qemu-devel, qemu-riscv
This adds a helper routine for finding firmware. It is currently
used only for "-bios default" case.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
hw/riscv/boot.c | 22 +++++++++++++++-------
include/hw/riscv/boot.h | 1 +
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 6b7d322..a122846 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -69,13 +69,7 @@ void riscv_find_and_load_firmware(MachineState *machine,
* so then in the future we can make "-bios default" the default option
* if no -bios option is set without breaking anything.
*/
- firmware_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
- default_machine_firmware);
- if (firmware_filename == NULL) {
- error_report("Unable to load the default RISC-V firmware \"%s\"",
- default_machine_firmware);
- exit(1);
- }
+ firmware_filename = riscv_find_firmware(default_machine_firmware);
} else {
firmware_filename = machine->firmware;
}
@@ -90,6 +84,20 @@ void riscv_find_and_load_firmware(MachineState *machine,
}
}
+char *riscv_find_firmware(const char *firmware_filename)
+{
+ char *filename;
+
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, firmware_filename);
+ if (filename == NULL) {
+ error_report("Unable to load the RISC-V firmware \"%s\"",
+ firmware_filename);
+ exit(1);
+ }
+
+ return filename;
+}
+
target_ulong riscv_load_firmware(const char *firmware_filename,
hwaddr firmware_load_addr)
{
diff --git a/include/hw/riscv/boot.h b/include/hw/riscv/boot.h
index d56f2ae..1718a8f 100644
--- a/include/hw/riscv/boot.h
+++ b/include/hw/riscv/boot.h
@@ -23,6 +23,7 @@
void riscv_find_and_load_firmware(MachineState *machine,
const char *default_machine_firmware,
hwaddr firmware_load_addr);
+char *riscv_find_firmware(const char *firmware_filename);
target_ulong riscv_load_firmware(const char *firmware_filename,
hwaddr firmware_load_addr);
target_ulong riscv_load_kernel(const char *kernel_filename);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] riscv: Resolve full path of the given bios image
2019-08-16 13:09 [Qemu-devel] [PATCH 0/2] riscv: Fix "-L" not working for bios image search path Bin Meng
2019-08-16 13:09 ` [Qemu-devel] [PATCH 1/2] riscv: Add a helper routine for finding firmware Bin Meng
@ 2019-08-16 13:09 ` Bin Meng
2019-08-20 18:40 ` Alistair Francis
2019-08-26 23:48 ` [Qemu-devel] [PATCH 0/2] riscv: Fix "-L" not working for bios image search path Palmer Dabbelt
2 siblings, 1 reply; 5+ messages in thread
From: Bin Meng @ 2019-08-16 13:09 UTC (permalink / raw)
To: Alistair Francis, Bastian Koppelmann, Palmer Dabbelt,
Sagar Karandikar, qemu-devel, qemu-riscv
At present when "-bios image" is supplied, we just use the straight
path without searching for the configured data directories. Like
"-bios default", we add the same logic so that "-L" actually works.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
hw/riscv/boot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index a122846..15002d3 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -72,14 +72,14 @@ void riscv_find_and_load_firmware(MachineState *machine,
firmware_filename = riscv_find_firmware(default_machine_firmware);
} else {
firmware_filename = machine->firmware;
+ if (strcmp(firmware_filename, "none")) {
+ firmware_filename = riscv_find_firmware(firmware_filename);
+ }
}
if (strcmp(firmware_filename, "none")) {
/* If not "none" load the firmware */
riscv_load_firmware(firmware_filename, firmware_load_addr);
- }
-
- if (!strcmp(machine->firmware, "default")) {
g_free(firmware_filename);
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] riscv: Resolve full path of the given bios image
2019-08-16 13:09 ` [Qemu-devel] [PATCH 2/2] riscv: Resolve full path of the given bios image Bin Meng
@ 2019-08-20 18:40 ` Alistair Francis
0 siblings, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2019-08-20 18:40 UTC (permalink / raw)
To: Bin Meng
Cc: open list:RISC-V, Sagar Karandikar, Bastian Koppelmann,
Palmer Dabbelt, qemu-devel@nongnu.org Developers,
Alistair Francis
On Fri, Aug 16, 2019 at 6:11 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> At present when "-bios image" is supplied, we just use the straight
> path without searching for the configured data directories. Like
> "-bios default", we add the same logic so that "-L" actually works.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
>
> ---
>
> hw/riscv/boot.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
> index a122846..15002d3 100644
> --- a/hw/riscv/boot.c
> +++ b/hw/riscv/boot.c
> @@ -72,14 +72,14 @@ void riscv_find_and_load_firmware(MachineState *machine,
> firmware_filename = riscv_find_firmware(default_machine_firmware);
> } else {
> firmware_filename = machine->firmware;
> + if (strcmp(firmware_filename, "none")) {
> + firmware_filename = riscv_find_firmware(firmware_filename);
> + }
> }
>
> if (strcmp(firmware_filename, "none")) {
> /* If not "none" load the firmware */
> riscv_load_firmware(firmware_filename, firmware_load_addr);
> - }
> -
> - if (!strcmp(machine->firmware, "default")) {
> g_free(firmware_filename);
> }
> }
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] riscv: Fix "-L" not working for bios image search path
2019-08-16 13:09 [Qemu-devel] [PATCH 0/2] riscv: Fix "-L" not working for bios image search path Bin Meng
2019-08-16 13:09 ` [Qemu-devel] [PATCH 1/2] riscv: Add a helper routine for finding firmware Bin Meng
2019-08-16 13:09 ` [Qemu-devel] [PATCH 2/2] riscv: Resolve full path of the given bios image Bin Meng
@ 2019-08-26 23:48 ` Palmer Dabbelt
2 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2019-08-26 23:48 UTC (permalink / raw)
To: bmeng.cn
Cc: Bastian Koppelmann, Alistair Francis, qemu-devel, sagark, qemu-riscv
On Fri, 16 Aug 2019 06:09:34 PDT (-0700), bmeng.cn@gmail.com wrote:
> Currently when QEMU is given a bios image with only a file name and
> its file path passed in "-L", it still reports file not found.
>
> This series fixes the issue. This is especially helpful for creating
> distro QEMU packages.
>
>
> Bin Meng (2):
> riscv: Add a helper routine for finding firmware
> riscv: Resolve full path of the given bios image
>
> hw/riscv/boot.c | 26 +++++++++++++++++---------
> include/hw/riscv/boot.h | 1 +
> 2 files changed, 18 insertions(+), 9 deletions(-)
Thanks, I've put these two in the patch queue with Alistair's review.
^ permalink raw reply [flat|nested] 5+ messages in thread