Commit 9d4f13e5 authored by Russell King's avatar Russell King Committed by Russell King

[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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 88026842
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# Copyright (C) 1995-2001 by Russell King # Copyright (C) 1995-2001 by Russell King
LDFLAGS_vmlinux :=-p --no-undefined -X LDFLAGS_vmlinux :=-p --no-undefined -X
CPPFLAGS_vmlinux.lds = -DKERNEL_RAM_ADDR=$(TEXTADDR) CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9 GZFLAGS :=-9
#CFLAGS +=-pipe #CFLAGS +=-pipe
...@@ -65,7 +65,7 @@ CHECKFLAGS += -D__arm__ ...@@ -65,7 +65,7 @@ CHECKFLAGS += -D__arm__
#Default value #Default value
head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
textaddr-y := 0xC0008000 textofs-y := 0x00008000
machine-$(CONFIG_ARCH_RPC) := rpc machine-$(CONFIG_ARCH_RPC) := rpc
machine-$(CONFIG_ARCH_EBSA110) := ebsa110 machine-$(CONFIG_ARCH_EBSA110) := ebsa110
...@@ -73,22 +73,20 @@ textaddr-y := 0xC0008000 ...@@ -73,22 +73,20 @@ textaddr-y := 0xC0008000
incdir-$(CONFIG_ARCH_CLPS7500) := cl7500 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
machine-$(CONFIG_FOOTBRIDGE) := footbridge machine-$(CONFIG_FOOTBRIDGE) := footbridge
incdir-$(CONFIG_FOOTBRIDGE) := ebsa285 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
textaddr-$(CONFIG_ARCH_CO285) := 0x60008000
machine-$(CONFIG_ARCH_CO285) := footbridge machine-$(CONFIG_ARCH_CO285) := footbridge
incdir-$(CONFIG_ARCH_CO285) := ebsa285 incdir-$(CONFIG_ARCH_CO285) := ebsa285
machine-$(CONFIG_ARCH_SHARK) := shark machine-$(CONFIG_ARCH_SHARK) := shark
machine-$(CONFIG_ARCH_SA1100) := sa1100 machine-$(CONFIG_ARCH_SA1100) := sa1100
ifeq ($(CONFIG_ARCH_SA1100),y) ifeq ($(CONFIG_ARCH_SA1100),y)
# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
textaddr-$(CONFIG_SA1111) := 0xc0208000 textofs-$(CONFIG_SA1111) := 0x00208000
endif endif
machine-$(CONFIG_ARCH_PXA) := pxa machine-$(CONFIG_ARCH_PXA) := pxa
machine-$(CONFIG_ARCH_L7200) := l7200 machine-$(CONFIG_ARCH_L7200) := l7200
machine-$(CONFIG_ARCH_INTEGRATOR) := integrator machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
machine-$(CONFIG_ARCH_CAMELOT) := epxa10db machine-$(CONFIG_ARCH_CAMELOT) := epxa10db
textaddr-$(CONFIG_ARCH_CLPS711X) := 0xc0028000 textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
machine-$(CONFIG_ARCH_CLPS711X) := clps711x machine-$(CONFIG_ARCH_CLPS711X) := clps711x
textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
machine-$(CONFIG_ARCH_IOP3XX) := iop3xx machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
machine-$(CONFIG_ARCH_IXP2000) := ixp2000 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
...@@ -110,7 +108,8 @@ CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL ...@@ -110,7 +108,8 @@ CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
export CFLAGS_3c589_cs.o export CFLAGS_3c589_cs.o
endif endif
TEXTADDR := $(textaddr-y) # The byte offset of the kernel image in RAM from the start of RAM.
TEXT_OFFSET := $(textofs-y)
ifeq ($(incdir-y),) ifeq ($(incdir-y),)
incdir-y := $(machine-y) incdir-y := $(machine-y)
...@@ -123,7 +122,7 @@ else ...@@ -123,7 +122,7 @@ else
MACHINE := MACHINE :=
endif endif
export TEXTADDR GZFLAGS export TEXT_OFFSET GZFLAGS
# Do we have FASTFPE? # Do we have FASTFPE?
FASTFPE :=arch/arm/fastfpe FASTFPE :=arch/arm/fastfpe
......
...@@ -15,7 +15,7 @@ include $(srctree)/$(MACHINE)/Makefile.boot ...@@ -15,7 +15,7 @@ include $(srctree)/$(MACHINE)/Makefile.boot
endif endif
# Note: the following conditions must always be true: # Note: the following conditions must always be true:
# ZRELADDR == virt_to_phys(TEXTADDR) # ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
# PARAMS_PHYS must be within 4MB of ZRELADDR # PARAMS_PHYS must be within 4MB of ZRELADDR
# INITRD_PHYS must be in RAM # INITRD_PHYS must be in RAM
ZRELADDR := $(zreladdr-y) ZRELADDR := $(zreladdr-y)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # Makefile for the linux kernel.
# #
AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR) AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
# Object file lists. # Object file lists.
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#define MACHINFO_PGOFFIO 12 #define MACHINFO_PGOFFIO 12
#define MACHINFO_NAME 16 #define MACHINFO_NAME 16
#define KERNEL_RAM_ADDR (PAGE_OFFSET + TEXT_OFFSET)
/* /*
* swapper_pg_dir is the virtual address of the initial page table. * swapper_pg_dir is the virtual address of the initial page table.
* We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must
......
...@@ -17,15 +17,13 @@ jiffies = jiffies_64; ...@@ -17,15 +17,13 @@ jiffies = jiffies_64;
jiffies = jiffies_64 + 4; jiffies = jiffies_64 + 4;
#endif #endif
SECTIONS
{
#ifdef CONFIG_XIP_KERNEL #ifdef CONFIG_XIP_KERNEL
#define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
#else #else
#define TEXTADDR KERNEL_RAM_ADDR . = PAGE_OFFSET + TEXT_OFFSET;
#endif #endif
SECTIONS
{
. = TEXTADDR;
.init : { /* Init code and data */ .init : { /* Init code and data */
_stext = .; _stext = .;
_sinittext = .; _sinittext = .;
...@@ -104,7 +102,7 @@ SECTIONS ...@@ -104,7 +102,7 @@ SECTIONS
#ifdef CONFIG_XIP_KERNEL #ifdef CONFIG_XIP_KERNEL
__data_loc = ALIGN(4); /* location in binary */ __data_loc = ALIGN(4); /* location in binary */
. = KERNEL_RAM_ADDR; . = PAGE_OFFSET + TEXT_OFFSET;
#else #else
. = ALIGN(THREAD_SIZE); . = ALIGN(THREAD_SIZE);
__data_loc = .; __data_loc = .;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment