Updated 2.6.0 linux kernel patch for qemu-fast
Hi all,
If you've been trying to use a patched Linux kernel with
qemu-fast, and get this message:
Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!
It's the newer glibc's trying to use the vsyscalls. This patch fixes it, by making vsyscalls.lds a generated file, so it can use the FIXADDR_TOP constant rather than hardcoding the value.
Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: QEMU CONFIG Patch
Author: Rusty Russell
Status: Tested on 2.6.0
D: Convenient patch based on Fabrice Bellard's documentation on how to
D: boot an x86 kernel under qemu. Adjusts PAGE_OFFSET, HZ, and
D: FIXADDR_TOP.
arch/i386/Kconfig +8 -0
@@ -307,6 +307,14 @@ config X86_GENERIC when it has moderate overhead. This is intended for generic distributions kernels. +config QEMU + bool "Kernel to run under QEMU" + depends on EXPERIMENTAL + help + Select this if you want to boot the kernel inside qemu-fast, + the non-mmu version of the x86 emulator. See + <http://fabrice.bellard.free.fr/qemu/>. Say N. + # # Define implied options from the CPU selection here #
arch/i386/kernel/Makefile +4 -2
@@ -46,12 +46,14 @@ quiet_cmd_syscall = SYSCALL $@ cmd_syscall = $(CC) -nostdlib $(SYSCFLAGS_$(@F)) \ -Wl,-T,$(filter-out FORCE,$^) -o $@ +export AFLAGS_vsyscall.lds.o += -P -C -U$(ARCH) + vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags) SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags) $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \ -$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE +$(obj)/vsyscall-%.so: $(src)/vsyscall.lds.s $(obj)/vsyscall-%.o FORCE $(call if_changed,syscall) # We also create a special relocatable object that should mirror the symbol
@@ -62,5 +64,5 @@ $(obj)/built-in.o: $(obj)/vsyscall-syms. $(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o SYSCFLAGS_vsyscall-syms.o = -r -$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE +$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds.s $(obj)/vsyscall-sysenter.o FORCE $(call if_changed,syscall)
arch/i386/kernel/vmlinux.lds.S +2 -1
@@ -3,6 +3,7 @@ */ #include <asm-generic/vmlinux.lds.h> +#include <asm/page.h> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386)
@@ -10,7 +11,7 @@ ENTRY(startup_32) jiffies = jiffies_64; SECTIONS { - . = 0xC0000000 + 0x100000; + . = __PAGE_OFFSET + 0x100000; /* read-only */ _text = .; /* Text and read-only data */ .text : {
arch/i386/kernel/vsyscall.lds +0 -67
67 lines not on this page · raw message
arch/i386/kernel/vsyscall.lds.S +67 -0
67 lines not on this page · raw message
include/asm-i386/fixmap.h +16 -7
@@ -14,6 +14,19 @@#define _ASM_FIXMAP_H#include <linux/config.h> + +/* used by vmalloc.c, vsyscall.lds.S. +* +* Leave one empty page between vmalloc'ed areas and +* the start of the fixmap. +*/ +#ifdef CONFIG_QEMU +#define __FIXADDR_TOP 0xa7fff000 +#else +#define __FIXADDR_TOP 0xfffff000 +#endif + +#ifndef __ASSEMBLY__#include <linux/kernel.h> #include <asm/acpi.h> #include <asm/apicdef.h>
@@ -94,13 +107,8 @@ extern void __set_fixmap (enum fixed_add#define clear_fixmap (idx) \ __set_fixmap(idx, 0, __pgprot(0)) -/* -* used by vmalloc.c. -* -* Leave one empty page between vmalloc'ed areas and -* the start of the fixmap. -*/ -#define FIXADDR_TOP (0xfffff000UL) +#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) +#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
@@ -145,4 +153,5 @@ static inline unsigned long virt_to_fix(return __virt_to_fix (vaddr); } +#endif /* !__ASSEMBLY__ */ #endif
include/asm-i386/page.h +10 -3
@@ -10,10 +10,10 @@#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)#ifdef __KERNEL__ -#ifndef __ASSEMBLY__ -#include <linux/config.h> +#ifndef __ASSEMBLY__ +#ifdef CONFIG_X86_USE_3DNOW #include <asm/mmx.h>
@@ -115,12 +115,19 @@ static __inline__ int get_order(unsigned#endif /* __ASSEMBLY__ */ #ifdef __ASSEMBLY__ +#ifdef CONFIG_QEMU +#define __PAGE_OFFSET (0x90000000) +#else #define __PAGE_OFFSET (0xC0000000) +#endif /* QEMU */ +#else +#ifdef CONFIG_QEMU +#define __PAGE_OFFSET (0x90000000UL)#else #define __PAGE_OFFSET (0xC0000000UL) +#endif /* QEMU */ #endif -#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
include/asm-i386/param.h +6 -1
@@ -2,7 +2,12 @@#define _ASMi386_PARAM_H#ifdef __KERNEL__ -# define HZ 1000/* Internal kernel timer frequency */ +# include <linux/config.h> +# ifdef CONFIG_QEMU +# define HZ 100 +# else +# define HZ 1000/* Internal kernel timer frequency */ +# endif # define USER_HZ 100/* .. some user interfaces are in "ticks" */ # define CLOCKS_PER_SEC (USER_HZ)/* like times() */ #endif