From 76b47ee470e2a1f1965a1239b8003c404859e7d3 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Apr 01 2007 19:05:10 +0000 Subject: - Fix direct loading of a linux kernel with -kernel & -initrd (bz 234681) - Remove spurious execute bits from manpages (bz 222573) --- diff --git a/qemu-0.9.0-load-initrd.patch b/qemu-0.9.0-load-initrd.patch new file mode 100644 index 0000000..674e374 --- /dev/null +++ b/qemu-0.9.0-load-initrd.patch @@ -0,0 +1,63 @@ +--- hw/pc.c.orig 2007-02-06 07:01:54.000000000 +0800 ++++ hw/pc.c 2007-04-01 22:19:50.000000000 +0800 +@@ -32,9 +32,11 @@ + #define LINUX_BOOT_FILENAME "linux_boot.bin" + + #define KERNEL_LOAD_ADDR 0x00100000 +-#define INITRD_LOAD_ADDR 0x00600000 ++#define MAX_INITRD_LOAD_ADDR 0x38000000 + #define KERNEL_PARAMS_ADDR 0x00090000 + #define KERNEL_CMDLINE_ADDR 0x00099000 ++/* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables. */ ++#define ACPI_DATA_SIZE 0x10000 + + static fdctrl_t *floppy_controller; + static RTCState *rtc_state; +@@ -451,7 +453,7 @@ + { + char buf[1024]; + int ret, linux_boot, initrd_size, i; +- unsigned long bios_offset, vga_bios_offset, option_rom_offset; ++ unsigned long bios_offset, vga_bios_offset, option_rom_offset, initrd_offset; + int bios_size, isa_bios_size; + PCIBus *pci_bus; + int piix3_devfn = -1; +@@ -576,8 +578,28 @@ + + /* load initrd */ + initrd_size = 0; ++ initrd_offset = 0; + if (initrd_filename) { +- initrd_size = load_image(initrd_filename, phys_ram_base + INITRD_LOAD_ADDR); ++ initrd_size = get_image_size (initrd_filename); ++ if (initrd_size > 0) { ++ initrd_offset = (ram_size - initrd_size) & TARGET_PAGE_MASK; ++ /* Leave space for BIOS ACPI tables. */ ++ initrd_offset -= ACPI_DATA_SIZE; ++ /* Avoid the last 64k to avoid 2.2.x kernel bugs. */ ++ initrd_offset -= 0x10000; ++ if (initrd_offset > MAX_INITRD_LOAD_ADDR) ++ initrd_offset = MAX_INITRD_LOAD_ADDR; ++ ++ if (initrd_size > ram_size ++ || initrd_offset < KERNEL_LOAD_ADDR + ret) { ++ fprintf(stderr, ++ "qemu: memory too small for initial ram disk '%s'\n", ++ initrd_filename); ++ exit(1); ++ } ++ initrd_size = load_image(initrd_filename, ++ phys_ram_base + initrd_offset); ++ } + if (initrd_size < 0) { + fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", + initrd_filename); +@@ -585,7 +607,7 @@ + } + } + if (initrd_size > 0) { +- stl_raw(phys_ram_base + KERNEL_PARAMS_ADDR + 0x218, INITRD_LOAD_ADDR); ++ stl_raw(phys_ram_base + KERNEL_PARAMS_ADDR + 0x218, initrd_offset); + stl_raw(phys_ram_base + KERNEL_PARAMS_ADDR + 0x21c, initrd_size); + } + pstrcpy(phys_ram_base + KERNEL_CMDLINE_ADDR, 4096, diff --git a/qemu.spec b/qemu.spec index fd8d406..ff8af99 100644 --- a/qemu.spec +++ b/qemu.spec @@ -8,7 +8,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 0.9.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL/LGPL Group: Development/Tools URL: http://www.qemu.org/ @@ -16,6 +16,7 @@ Source0: http://www.qemu.org/%{name}-%{version}.tar.gz Source1: qemu.init Patch0: qemu-0.7.0-build.patch Patch1: qemu-0.8.0-sdata.patch +Patch2: qemu-0.9.0-load-initrd.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: SDL-devel compat-gcc-%{gccver} zlib-devel which texi2html Requires(post): /sbin/chkconfig @@ -40,6 +41,7 @@ As QEMU requires no host kernel patches to run, it is safe and easy to use. %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p0 %build ./configure \ @@ -58,6 +60,7 @@ make prefix="${RPM_BUILD_ROOT}%{_prefix}" \ mandir="${RPM_BUILD_ROOT}%{_mandir}" \ docdir="${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" \ datadir="${RPM_BUILD_ROOT}%{_prefix}/share/qemu" install +chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/* install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/qemu @@ -89,6 +92,10 @@ fi %{_mandir}/man1/* %changelog +* Sun Apr 1 2007 Hans de Goede 0.9.0-2 +- Fix direct loading of a linux kernel with -kernel & -initrd (bz 234681) +- Remove spurious execute bits from manpages (bz 222573) + * Tue Feb 6 2007 David Woodhouse 0.9.0-1 - Update to 0.9.0