]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tools: Fail if passed initrd is not really an initrd
authorPekka Enberg <penberg@kernel.org>
Wed, 18 May 2011 19:19:40 +0000 (22:19 +0300)
committerPekka Enberg <penberg@kernel.org>
Wed, 18 May 2011 19:23:12 +0000 (22:23 +0300)
commit86e5e4af0c518ec3e9f59f4621fd662813acb9f2
treece34bb0d7e1f126884abb73acf6dabf57f81d731
parentc474e3fec70bcacd5b24a24838c653e5a13e7b58
kvm tools: Fail if passed initrd is not really an initrd

We recently changed the meaning of "-i" from disk image to initrd. This has
confused many users because kvm just reports:

  Fatal: mmap() failed.

if a disk image is passed as initrd. This patch fixes that by checking for the
first two ID bytes in initrd:

  $ ./kvm run -i ~/images/linux-0.2.qcow
    # kvm run -k ../../arch/x86/boot/bzImage -m 256 -c 1
    Fatal: /home/penberg/images/linux-0.2.qcow is not an initrd

Reported-by: Thomas Heil <heil@terminal-consulting.de>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/kvm.c