在 2013-03-28四的 10:42 +0100,Stefan Hajnoczi写道: > On Wed, Mar 27, 2013 at 02:10:31PM +0800, liguang wrote: > > if head magic is missing or wrong unexpectedly, we'd > > better to reject booting. > > 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.f...@cn.fujitsu.com> > > --- > > hw/i386/pc.c | 4 +++- > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > index b1e06fa..2b78dfc 100644 > > --- a/hw/i386/pc.c > > +++ b/hw/i386/pc.c > > @@ -683,8 +683,10 @@ 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, "please assure specicified kernel is for > > x86!\n"); > > + exit(1); > > load_multiboot() can fail for other reasons so this error messing is > misleading. Giving QEMU a non-x86 kernel is just one scenario where > this may fail.
according to my check of load_mutiboot function, mostly it will return 0 if it's not multboot, or 1 it's a multiboot, so print this message, or can I just print "wrong kernel image!" ? > > > } > > - protocol = 0; > > } > > Why did you drop protocol = 0? I think we only want either normal or multi boot linux kernel, I can't see meaning let other case go on. so, here, if a normal kernel, OK, go on, if multiboot, OK, go on, others, NO, end up. so, "protocol = 0" is meaningless here.