Package: qemu-kvm
Version: 0.14.0+dfsg-1~tls
Severity: wishlist
File: /usr/bin/kvm
Hi,
thanks to multiboot specs and many examples on the internet building
your own toy kernel is quite simple. In 32bit that is. Building a
64bit kernel suddenly becomes quite complicated as one can't compile
64bit C code into a 32bit elf format as required by kvm. One can't
link 64bit object files together with a 32bit object containing
startup code either. So one needs to mangle stuff around to fit
loosing symbol information and debug functionality. Overall not a
satisfactory thing.
Luckily kvm allready knows all about loading a elf64 binary and it is
simple to create a little 32bit asm startup code in elf64 format as
entry point for the bootloader. All that is required for kvm to
support this is not to reject the elf64 format. Patch attached.
MfG
Goswin
-- Package-specific info:
/proc/cpuinfo:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 28
model name : Intel(R) Atom(TM) CPU 330 @ 1.60GHz
stepping : 2
cpu MHz : 1599.996
cache size : 512 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc
arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl tm2 ssse3
cx16 xtpr pdcm movbe lahf_lm
bogomips : 3199.76
clflush size : 64
cache_alignment : 64
address sizes : 32 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 28
model name : Intel(R) Atom(TM) CPU 330 @ 1.60GHz
stepping : 2
cpu MHz : 1599.996
cache size : 512 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc
arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl tm2 ssse3
cx16 xtpr pdcm movbe lahf_lm
bogomips : 3199.96
clflush size : 64
cache_alignment : 64
address sizes : 32 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 28
model name : Intel(R) Atom(TM) CPU 330 @ 1.60GHz
stepping : 2
cpu MHz : 1599.996
cache size : 512 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc
arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl tm2 ssse3
cx16 xtpr pdcm movbe lahf_lm
bogomips : 3199.97
clflush size : 64
cache_alignment : 64
address sizes : 32 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 28
model name : Intel(R) Atom(TM) CPU 330 @ 1.60GHz
stepping : 2
cpu MHz : 1599.996
cache size : 512 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc
arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl tm2 ssse3
cx16 xtpr pdcm movbe lahf_lm
bogomips : 3199.94
clflush size : 64
cache_alignment : 64
address sizes : 32 bits physical, 48 bits virtual
power management:
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (666, 'unstable'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-debian-xen-1 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash
Versions of packages qemu-kvm depends on:
ii adduser 3.112 add and remove users and groups
ii etherboot-qemu 5.4.4-7 Bootstrapping for various network
ii libaio1 0.3.107-7 Linux kernel AIO access library -
ii libasound2 1.0.23-1 shared library for ALSA applicatio
ii libattr1 1:2.4.44-2 Extended attribute shared library
ii libbluetooth3 4.89-1 Library to use the BlueZ Linux Blu
ii libbrlapi0.5 4.2-7 braille display access via BRLTTY
ii libc6 2.11.2-13 Embedded GNU C Library: Shared lib
ii libcurl3-gnutls 7.21.1-1 Multi-protocol file transfer libra
ii libgnutls26 2.10.5-1 the GNU TLS library - runtime libr
ii libjpeg62 6b1-1 The Independent JPEG Group's JPEG
ii libncurses5 5.7+20100313-3 shared libraries for terminal hand
ii libpng12-0 1.2.44-1 PNG library - runtime
ii libpulse0 0.9.21-3+b1 PulseAudio client libraries
ii libsasl2-2 2.1.23.dfsg1-6 Cyrus SASL - authentication abstra
ii libsdl1.2debian 1.2.14-6 Simple DirectMedia Layer
ii libuuid1 2.17.2-3.1 Universally Unique ID library
ii libvdeplug2 2.2.3-3 Virtual Distributed Ethernet - Plu
ii libx11-6 2:1.3.3-3 X11 client-side library
ii python 2.6.6-12 interactive high-level object-orie
ii qemu-keymaps 0.14.0+dfsg-5 QEMU keyboard maps
ii qemu-utils 0.14.0+dfsg-5 QEMU utilities
ii seabios 0.6.1.2-2 Legacy BIOS implementation
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
Versions of packages qemu-kvm recommends:
ii bridge-utils 1.4-5 Utilities for configuring the Linu
ii iproute 20100519-3 networking and traffic control too
Versions of packages qemu-kvm suggests:
ii debootstrap 1.0.23 Bootstrap a basic Debian system
pn samba <none> (no description available)
pn vde2 <none> (no description available)
-- no debconf information
Description: Allow 64bit elf binaries in multiboot format
This patch allows 64bit elf files with multiboot header to be loaded.
The entry point will still be called in 32bit mode and the kernel
must switch to 64bit mode on its own. The image and all modules must
also be located in the lower 2GB of ram. All the restrictions of a
32bit image still apply.
Author: Goswin von Brederlow <[email protected]>
Last-Updated: 2011-04-08
---
--- qemu-kvm-0.14.0+dfsg.orig/hw/multiboot.c
+++ qemu-kvm-0.14.0+dfsg/hw/multiboot.c
@@ -173,8 +173,7 @@ int load_multiboot(void *fw_cfg,
fclose(f);
if (((struct elf64_hdr*)header)->e_machine == EM_X86_64) {
- fprintf(stderr, "Cannot load x86-64 image, give a 32bit one.\n");
- exit(1);
+ mb_debug("qemu: 64bit elf, I hope you know what you are doing\n");
}
kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,