[PATCH] hw/i386: return an error message when mb magic/pvh note could not be found

nathan@kolpa.me posted 1 patch 9 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/9939bfcd6fad908c21bbfb751a2896d7@email.mijndomein.nl
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>
hw/i386/x86.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[PATCH] hw/i386: return an error message when mb magic/pvh note could not be found
Posted by nathan@kolpa.me 9 months, 3 weeks ago
When using a non-linux kernel where the multiboot magic is
misconfigured the following message would display: "linux kernel too old to load a ram
disk".

This patch instead, displays a more descriptive error message: "could not find multiboot magic or PVH ELF Note". The linux specific boot sequence is skipped because earlier it is asserted that the linux protocol magic field could not be found.

Signed-off-by: Nathan Kolpa <nathan@kolpa.me>
---
 hw/i386/x86.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 2b6291ad8d..b59f1180f5 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -902,7 +902,10 @@ void x86_load_linux(X86MachineState *x86ms,
 
             return;
         }
-        protocol = 0;
+
+        fprintf(stderr, "qemu: could not find multiboot magic or "
+                "PVH ELF Note.\n");
+        exit(1);
     }
 
     if (protocol < 0x200 || !(header[0x211] & 0x01)) {
-- 
2.43.0