From 749129aeec49e0c37a4a2bfd839d28e860b8acfb389caf842a6f9e65bf88ca02 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Thu, 5 Apr 2007 22:28:50 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/qemu?expand=0&rev=6 --- qemu-0.9.0-initrd.patch | 64 +++++++++++++++++++++++++++++++++++++++++ qemu.changes | 5 ++++ qemu.spec | 6 +++- 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 qemu-0.9.0-initrd.patch diff --git a/qemu-0.9.0-initrd.patch b/qemu-0.9.0-initrd.patch new file mode 100644 index 00000000..2995e7dc --- /dev/null +++ b/qemu-0.9.0-initrd.patch @@ -0,0 +1,64 @@ +Index: qemu-0.9.0/hw/pc.c +=================================================================== +--- qemu-0.9.0.orig/hw/pc.c ++++ qemu-0.9.0/hw/pc.c +@@ -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; +@@ -452,6 +454,7 @@ static void pc_init1(int ram_size, int v + char buf[1024]; + int ret, linux_boot, initrd_size, i; + unsigned long bios_offset, vga_bios_offset, option_rom_offset; ++ unsigned long initrd_offset; + int bios_size, isa_bios_size; + PCIBus *pci_bus; + int piix3_devfn = -1; +@@ -576,8 +579,28 @@ static void pc_init1(int ram_size, int v + + /* 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 +608,7 @@ static void pc_init1(int ram_size, int v + } + } + 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.changes b/qemu.changes index dec5d5d2..62f3341f 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Apr 4 20:01:42 CEST 2007 - agraf@suse.de + +- fixed initrd loading on x86 + ------------------------------------------------------------------- Thu Mar 29 22:20:04 CEST 2007 - ro@suse.de diff --git a/qemu.spec b/qemu.spec index 4e7abe41..8be5bdd3 100644 --- a/qemu.spec +++ b/qemu.spec @@ -17,7 +17,7 @@ License: BSD License and BSD-like, GNU General Public License (GPL) Group: System/Emulators/Other Summary: Universal CPU emulator Version: 0.9.0 -Release: 6 +Release: 8 Source: %name-%version.tar.bz2 Patch1: qemu-0.7.0-binfmt.patch Patch5: qemu-0.7.0-sigaltstackhack.patch @@ -30,6 +30,7 @@ Patch15: qemu-0.9.0-syscalls.patch Patch16: qemu-0.7.1-armfpaex.patch Patch19: qemu-0.9.0-nousbdevfs.patch Patch20: qemu-0.9.0-usbheaders.patch +Patch21: qemu-0.9.0-initrd.patch # GCC 3 sources/patches Source601: gcc-3.3.5.tar.bz2 Patch600: gcc-gcc-3.3.5-hammer.patch.bz2 @@ -97,6 +98,7 @@ Authors: %patch16 %patch19 %patch20 +%patch21 -p1 cd gcc-3.3.5 %patch600 %patch601 @@ -271,6 +273,8 @@ rm -rf %{gcc33tmp} %endif %changelog +* Wed Apr 04 2007 - agraf@suse.de +- fixed initrd loading on x86 * Thu Mar 29 2007 - ro@suse.de - added bison to BuildRequires * Tue Feb 20 2007 - uli@suse.de