• Nicolas Pitre's avatar
    [ARM PATCH] 2154/2: XIP kernel for ARM · 457450ab
    Nicolas Pitre authored
    Patch from Nicolas Pitre
    
    This patch allows for the kernel to be configured for XIP.
    A lot of people are using semi hacked up XIP patches already so
    it is a good idea to have a generic and clean implementation 
    supporting all ARM targets. The patch isn't too intrusive.
    
    It involves:
    
    - modifying the kernel entry code to map separate .text and .data
      sections in the initial page table, as well as relocating
      .data to ram when needed
    
    - modifying the linker script to account for the different VMA and
      LMA for .data, as well as making sure that .init.data gets
      relocated to ram
    
    - adding the final kernel mapping with a new MT_ROM mem type
    
    - distinguishing between XIP and non-XIP for bootmem and memory
      resource declaration
    
    - and adding proper target handling to Makefiles.
    
    While at it, this also cleans up the kernel boot code a bit
    so the kernel can now be compiled for any address in ram,
    removing the need for a relation between kernel address and
    start of ram.  Also throws in some more comments.
    
    And finally the _text, _etext, _end and similar variables are now
    declared extern void instead of extern char, or even extern int.
    That allows for operations on their address directly without any
    cast, and trying to reference them by mistake would yield an 
    error which is a good thing.
    
    Tested both configurations: XIP and non XIP, the later 
    producing a kernel for execution from ram just as before.
    
    Signed-off-by: Nicolas Pitre 
    Signed-off-by: Russell King
    457450ab
setup.c 20.1 KB