Message ID | 1365474461-17474-1-git-send-email-lig.fnst@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
On 04/08/2013 09:27 PM, liguang wrote: > if head magic is missing or wrong unexpectedly, we'd > better to prompt memssage for this. > e.g. > I make a mistake to boot a vmlinuz for MIPS(which > I think it's for x86) like this: > qemu-system-x86_64 -kernel vmlinuz -initrd demord > then qemu report: > "qemu: linux kernel too old to load a ram disk" > that's misleading. > Yes, that message would definitely be misleading in this case. > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> > --- > hw/i386/pc.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index ebbf059..6b29c3f 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -686,6 +686,8 @@ static void load_linux(void *fw_cfg, > if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, > kernel_cmdline, kernel_size, header)) { > return; > + } else { > + fprintf(stderr, "warn: invalid multiboot or modern kernel image\n"); > } > protocol = 0; > } > My impression from reading through the code is that this branch can be legitimately triggered by an older kernel (protocol < 0x200). In that case, the error message above would also be misleading. I think a better solution might be to simply validate that the arch specified in the ELF header matches the arch that qemu is emulating. I'll look into this more tomorrow morning. :) Jesse Larrew Software Engineer, KVM Team IBM Linux Technology Center Phone: (512) 973-2052 (T/L: 363-2052) jlarrew@linux.vnet.ibm.com
在 2013-04-08一的 23:36 -0500,Jesse Larrew写道: > On 04/08/2013 09:27 PM, liguang wrote: > > if head magic is missing or wrong unexpectedly, we'd > > better to prompt memssage for this. > > e.g. > > I make a mistake to boot a vmlinuz for MIPS(which > > I think it's for x86) like this: > > qemu-system-x86_64 -kernel vmlinuz -initrd demord > > then qemu report: > > "qemu: linux kernel too old to load a ram disk" > > that's misleading. > > > > Yes, that message would definitely be misleading in this case. > > > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> > > --- > > hw/i386/pc.c | 2 ++ > > 1 files changed, 2 insertions(+), 0 deletions(-) > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > index ebbf059..6b29c3f 100644 > > --- a/hw/i386/pc.c > > +++ b/hw/i386/pc.c > > @@ -686,6 +686,8 @@ static void load_linux(void *fw_cfg, > > if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, > > kernel_cmdline, kernel_size, header)) { > > return; > > + } else { > > + fprintf(stderr, "warn: invalid multiboot or modern kernel image\n"); > > } > > protocol = 0; > > } > > > > My impression from reading through the code is that this branch can be > legitimately triggered by an older kernel (protocol < 0x200). right. > In that case,the error message above would also be misleading. the warning message is saying: hey, we prefer modern kernel image or multiboot, but you specify neither, what are you doing? do you want to boot an old(obsolete) kernel? or, add a line like fprintf(stderr, "do you boot an old kernel?\n") :-) > > I think a better solution might be to simply validate that the arch > specified in the ELF header matches the arch that qemu is emulating. > I'll look into this more tomorrow morning. :) that's fine > > Jesse Larrew > Software Engineer, KVM Team > IBM Linux Technology Center > Phone: (512) 973-2052 (T/L: 363-2052) > jlarrew@linux.vnet.ibm.com >
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ebbf059..6b29c3f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -686,6 +686,8 @@ static void load_linux(void *fw_cfg, if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, kernel_cmdline, kernel_size, header)) { return; + } else { + fprintf(stderr, "warn: invalid multiboot or modern kernel image\n"); } protocol = 0; }
if head magic is missing or wrong unexpectedly, we'd better to prompt memssage for this. e.g. I make a mistake to boot a vmlinuz for MIPS(which I think it's for x86) like this: qemu-system-x86_64 -kernel vmlinuz -initrd demord then qemu report: "qemu: linux kernel too old to load a ram disk" that's misleading. Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> --- hw/i386/pc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)