Reply by [LT] CodeC February 5, 20082008-02-05
Hi All,

I want to compile vanila kernel (2.6.23-14) for ARM920T MCU. It should be
a XIP kernel.
In menuconfig I have set 0x10020000 physical XIP address.
After compiling I see, that my kernel binary is linked to 0xBF020000
address. Auto-generated linker script (arch/arm/kernel/ starts
with these lines:

 . = ((((0xc0000000)) - 16*1048576) + ((0x10020000) & 0x000fffff));

Where are this address calculation from? In memory definition header file
(include/asm-arm/memory.h) I found this:

#define TASK_SIZE		UL(0xbf000000)
#define TASK_UNMAPPED_BASE	UL(0x40000000)
#define TASK_SIZE_26		UL(0x04000000)
#define PAGE_OFFSET		UL(0xc0000000)
#define MODULE_START		(MODULE_END - 16*1048576)
#define XIP_VIRT_ADDR(physaddr)  (MODULE_START + ((physaddr) &

How to generate correct linker script for my XIP kernel?
Would be correct to change XIP_VIRT_ADDR(physaddr) definition to:
#define XIP_VIRT_ADDR(physaddr) (physaddr) ???
How about .data section? Where is it linked to?
Maybe there:
 __data_loc = ALIGN(4); /* location in binary */
 . = (0xc0000000) + 0x00008000;
 .data : AT(__data_loc) {
  __data_start = .; /* address in memory */

But it is not correct memory address in my system, because it is out of
physical boundary.
I need some help with this linker script.