Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ARM] Make kernel link address depend on PAGE_OFFSET

We are coding the kernel link address into the makefiles, which is
invisibly dependent on PAGE_OFFSET. If PAGE_OFFSET is changed, the
makefiles also need to be changed.

Make adjustments such that the makefiles encode just the offset from
PAGE_OFFSET for the kernel link address, and use PAGE_OFFSET in the
linker scripts directly.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Russell King and committed by
Russell King
9d4f13e5 88026842

+17 -18
+7 -8
arch/arm/Makefile
··· 8 8 # Copyright (C) 1995-2001 by Russell King 9 9 10 10 LDFLAGS_vmlinux :=-p --no-undefined -X 11 - CPPFLAGS_vmlinux.lds = -DKERNEL_RAM_ADDR=$(TEXTADDR) 11 + CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 12 12 OBJCOPYFLAGS :=-O binary -R .note -R .comment -S 13 13 GZFLAGS :=-9 14 14 #CFLAGS +=-pipe ··· 65 65 66 66 #Default value 67 67 head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o 68 - textaddr-y := 0xC0008000 68 + textofs-y := 0x00008000 69 69 70 70 machine-$(CONFIG_ARCH_RPC) := rpc 71 71 machine-$(CONFIG_ARCH_EBSA110) := ebsa110 ··· 73 73 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500 74 74 machine-$(CONFIG_FOOTBRIDGE) := footbridge 75 75 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285 76 - textaddr-$(CONFIG_ARCH_CO285) := 0x60008000 77 76 machine-$(CONFIG_ARCH_CO285) := footbridge 78 77 incdir-$(CONFIG_ARCH_CO285) := ebsa285 79 78 machine-$(CONFIG_ARCH_SHARK) := shark 80 79 machine-$(CONFIG_ARCH_SA1100) := sa1100 81 80 ifeq ($(CONFIG_ARCH_SA1100),y) 82 81 # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory 83 - textaddr-$(CONFIG_SA1111) := 0xc0208000 82 + textofs-$(CONFIG_SA1111) := 0x00208000 84 83 endif 85 84 machine-$(CONFIG_ARCH_PXA) := pxa 86 85 machine-$(CONFIG_ARCH_L7200) := l7200 87 86 machine-$(CONFIG_ARCH_INTEGRATOR) := integrator 88 87 machine-$(CONFIG_ARCH_CAMELOT) := epxa10db 89 - textaddr-$(CONFIG_ARCH_CLPS711X) := 0xc0028000 88 + textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 90 89 machine-$(CONFIG_ARCH_CLPS711X) := clps711x 91 - textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000 92 90 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx 93 91 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 94 92 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 ··· 108 110 export CFLAGS_3c589_cs.o 109 111 endif 110 112 111 - TEXTADDR := $(textaddr-y) 113 + # The byte offset of the kernel image in RAM from the start of RAM. 114 + TEXT_OFFSET := $(textofs-y) 112 115 113 116 ifeq ($(incdir-y),) 114 117 incdir-y := $(machine-y) ··· 122 123 MACHINE := 123 124 endif 124 125 125 - export TEXTADDR GZFLAGS 126 + export TEXT_OFFSET GZFLAGS 126 127 127 128 # Do we have FASTFPE? 128 129 FASTFPE :=arch/arm/fastfpe
+1 -1
arch/arm/boot/Makefile
··· 15 15 endif 16 16 17 17 # Note: the following conditions must always be true: 18 - # ZRELADDR == virt_to_phys(TEXTADDR) 18 + # ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET) 19 19 # PARAMS_PHYS must be within 4MB of ZRELADDR 20 20 # INITRD_PHYS must be in RAM 21 21 ZRELADDR := $(zreladdr-y)
+1 -1
arch/arm/kernel/Makefile
··· 2 2 # Makefile for the linux kernel. 3 3 # 4 4 5 - AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR) 5 + AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 6 6 7 7 # Object file lists. 8 8
+2
arch/arm/kernel/head.S
··· 33 33 #define MACHINFO_PGOFFIO 12 34 34 #define MACHINFO_NAME 16 35 35 36 + #define KERNEL_RAM_ADDR (PAGE_OFFSET + TEXT_OFFSET) 37 + 36 38 /* 37 39 * swapper_pg_dir is the virtual address of the initial page table. 38 40 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must
+6 -8
arch/arm/kernel/vmlinux.lds.S
··· 17 17 jiffies = jiffies_64 + 4; 18 18 #endif 19 19 20 - #ifdef CONFIG_XIP_KERNEL 21 - #define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) 22 - #else 23 - #define TEXTADDR KERNEL_RAM_ADDR 24 - #endif 25 - 26 20 SECTIONS 27 21 { 28 - . = TEXTADDR; 22 + #ifdef CONFIG_XIP_KERNEL 23 + . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); 24 + #else 25 + . = PAGE_OFFSET + TEXT_OFFSET; 26 + #endif 29 27 .init : { /* Init code and data */ 30 28 _stext = .; 31 29 _sinittext = .; ··· 102 104 103 105 #ifdef CONFIG_XIP_KERNEL 104 106 __data_loc = ALIGN(4); /* location in binary */ 105 - . = KERNEL_RAM_ADDR; 107 + . = PAGE_OFFSET + TEXT_OFFSET; 106 108 #else 107 109 . = ALIGN(THREAD_SIZE); 108 110 __data_loc = .;