]> git.hungrycats.org Git - linux/commitdiff
This changeset adds a new feature to ARM - the ability to load the
authorRussell King <rmk@flint.arm.linux.org.uk>
Wed, 17 Apr 2002 19:44:06 +0000 (20:44 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Wed, 17 Apr 2002 19:44:06 +0000 (20:44 +0100)
kernel zImage almost anywhere in RAM and call it directly, without
having to copy it to a specific address.  This removes a dependency
between the boot loader and the kernel.

19 files changed:
arch/arm/Config.help
arch/arm/boot/Makefile
arch/arm/boot/compressed/Makefile
arch/arm/boot/compressed/head-clps7500.S
arch/arm/boot/compressed/head-epxa10db.S
arch/arm/boot/compressed/head-ftvpci.S
arch/arm/boot/compressed/head-integrator.S
arch/arm/boot/compressed/head-l7200.S
arch/arm/boot/compressed/head-netwinder.S
arch/arm/boot/compressed/head-sa1100.S
arch/arm/boot/compressed/head-shark.S
arch/arm/boot/compressed/head-xscale.S
arch/arm/boot/compressed/head.S
arch/arm/boot/compressed/vmlinux.lds.in
arch/arm/config.in
arch/arm/def-configs/iq80310
arch/arm/def-configs/lusl7200
arch/arm/def-configs/sherman
arch/arm/def-configs/victor

index cbcfba911f55b71160db19c78a8c25f11b4b81f0..09a07f780c7ca06e5dee1cae7a64707d116ff65a 100644 (file)
@@ -836,3 +836,15 @@ CONFIG_DEBUG_BUGVERBOSE
   of the BUG call as well as the EIP and oops trace.  This aids
   debugging but costs about 70-100K of memory.
 
+CONFIG_ZBOOT_ROM
+  Say Y here if you intend to execute your compressed kernel image (zImage)
+  directly from ROM or flash.  If unsure, say N.
+
+CONFIG_ZBOOT_ROM_TEXT
+  The base address for zImage.  Unless you have special requirements, you
+  should not change this value.
+
+CONFIG_ZBOOT_ROM_BSS
+  The base address of 64KiB of read/write memory, which must be available
+  while the decompressor is running.  Unless you have special requirements,
+  you should not change this value.
index 1a045f06843f2e7d43183659f45ed754d63be3c4..1628584cf3402c6d8cb68395175c7d2275e814bc 100644 (file)
@@ -5,31 +5,31 @@
 # License.  See the file "COPYING" in the main directory of this archive
 # for more details.
 #
-# Copyright (C) 1995-2000 Russell King
+# Copyright (C) 1995-2002 Russell King
 #
 
 SYSTEM =$(TOPDIR)/vmlinux
 
 ifeq ($(CONFIG_CPU_26),y)
-ZTEXTADDR       = 0x02080000
+ZRELADDR        = 0x02080000
 PARAMS_PHYS     = 0x0207c000
 INITRD_PHYS     = 0x02180000
 INITRD_VIRT     = 0x02180000
 endif
 
 ifeq ($(CONFIG_ARCH_RPC),y)
-ZTEXTADDR       = 0x10008000
+ZRELADDR        = 0x10008000
 PARAMS_PHYS     = 0x10000100
 INITRD_PHYS     = 0x18000000
 INITRD_VIRT     = 0xc8000000
 endif
 
 ifeq ($(CONFIG_ARCH_CLPS7500),y)
-ZTEXTADDR       = 0x10008000
+ZRELADDR        = 0x10008000
 endif
 
 ifeq ($(CONFIG_ARCH_EBSA110),y)
-ZTEXTADDR       = 0x00008000
+ZRELADDR        = 0x00008000
 PARAMS_PHYS     = 0x00000400
 INITRD_PHYS     = 0x00800000
 INITRD_VIRT     = 0xc0800000
@@ -41,41 +41,34 @@ ZRELADDR     = 0x08008000
 endif
 
 ifeq ($(CONFIG_FOOTBRIDGE),y)
-ZTEXTADDR       = 0x00008000
+ZRELADDR        = 0x00008000
 PARAMS_PHYS     = 0x00000100
 INITRD_PHYS     = 0x00800000
 INITRD_VIRT     = 0xc0800000
 endif
 
 ifeq ($(CONFIG_ARCH_INTEGRATOR),y)
-ZTEXTADDR       = 0x00008000
+ZRELADDR        = 0x00008000
 PARAMS_PHYS     = 0x00000100
 INITRD_PHYS     = 0x00800000
 INITRD_VIRT     = 0xc0800000
 endif
 
 ifeq ($(CONFIG_ARCH_CAMELOT),y)
-ZTEXTADDR       = 0x00008000
+ZRELADDR        = 0x00008000
 endif
 
 ifeq ($(CONFIG_ARCH_NEXUSPCI),y)
-ZTEXTADDR       = 0x40008000
+ZRELADDR        = 0x40008000
 endif
 
 ifeq ($(CONFIG_ARCH_L7200),y)
-# RAM based kernel
-#ZTEXTADDR      = 0xf0400000
-#ZRELADDR       = 0xf0008000
-
-# FLASH based kernel
-ZTEXTADDR       = 0x00010000
 ZRELADDR        = 0xf0008000
-ZBSSADDR        = 0xf03e0000
 endif
 
 # The standard locations for stuff on CLPS711x type processors
 ifeq ($(CONFIG_ARCH_CLPS711X),y)
-ZTEXTADDR       = 0xc0028000
+ZRELADDR        = 0xc0028000
 PARAMS_PHYS     = 0xc0000100
 endif
 
@@ -90,60 +83,40 @@ INITRD_VIRT  = 0xc0300000
 endif
 
 ifeq ($(CONFIG_ARCH_SA1100),y)
-ZTEXTADDR       = 0xc0008000
 ZRELADDR        = 0xc0008000
-ifeq ($(CONFIG_SA1100_VICTOR),y)
-  ZTEXTADDR     = 0x00002000
-  ZBSSADDR      = 0xc0200000
-endif
-ifeq ($(CONFIG_SA1100_SHERMAN),y)
-  ZTEXTADDR      = 0x00050000   
-  ZBSSADDR       = 0xc0200000
-endif
-ifeq ($(CONFIG_SA1100_GRAPHICSCLIENT),y)
-  ZTEXTADDR     = 0xC0200000
-endif
-ifeq ($(CONFIG_SA1100_GRAPHICSMASTER),y)
-  ZTEXTADDR     = 0xC0400000
-endif
-ifeq ($(CONFIG_SA1100_ADSBITSY),y)
-  ZTEXTADDR     = 0xC0400000
-endif
-ifeq ($(CONFIG_SA1100_YOPY),y)
-  ZTEXTADDR      = 0x00080000
-  ZBSSADDR       = 0xc0200000
-endif
+# No defconfig file to move this into...
+#ifeq ($(CONFIG_SA1100_YOPY),y)
+#  ZTEXTADDR      = 0x00080000
+#  ZBSSADDR       = 0xc0200000
+#endif
 ifeq ($(CONFIG_SA1111),y)
   ZRELADDR      = 0xc0208000
 endif
 endif
 
 ifeq ($(CONFIG_ARCH_ANAKIN),y)
-ZTEXTADDR       = 0x20008000
+ZRELADDR        = 0x20008000
 endif
 
 ifeq ($(CONFIG_ARCH_IQ80310),y)
 ZRELADDR        = 0xa0008000
-
-# for serial upload
-ZTEXTADDR       = 0xa1008000
-
-# for direct flash execution
-# ZTEXTADDR     = 0x00060000
-# ZBSSADDR      = 0xa1008000
 endif
 
 ifeq ($(CONFIG_ARCH_ADIFCC),y)
 ZRELADDR        = 0xc0008000
-ZTEXTADDR       = 0xc1000000
 endif
 
 #
-# If you don't define ZRELADDR above,
-# then it defaults to ZTEXTADDR
+# We now have a PIC decompressor implementation.  Decompressors running
+# from RAM should not define ZTEXTADDR.  Decompressors running directly
+# from ROM or Flash must define ZTEXTADDR (preferably via the config)
 #
-ifeq ($(ZRELADDR),)
-ZRELADDR       = $(ZTEXTADDR)
+ifeq ($(CONFIG_ZBOOT_ROM),y)
+ZTEXTADDR      =0x$(CONFIG_ZBOOT_ROM_TEXT)
+ZBSSADDR       =0x$(CONFIG_ZBOOT_ROM_BSS)
+else
+ZTEXTADDR      =0
+ZBSSADDR       =ALIGN(4)
 endif
 
 export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS INITRD_VIRT PARAMS_PHYS
index 112e8209ec53346bfa1a4de1e5c9dd76291d5fdf..2f5c0eee43eaacb0bc11737aec1fd9e18cc9d640 100644 (file)
@@ -9,7 +9,7 @@
 
 HEAD            = head.o
 OBJS            = misc.o
-CFLAGS          = $(CPPFLAGS) -O2 -DSTDC_HEADERS $(CFLAGS_BOOT)
+CFLAGS          = $(CPPFLAGS) -O2 -DSTDC_HEADERS $(CFLAGS_BOOT) -fpic
 FONTC           = $(TOPDIR)/drivers/video/font_acorn_8x8.c
 ZLDFLAGS        = -p -X -T vmlinux.lds
 
@@ -65,13 +65,7 @@ ifeq ($(CONFIG_CPU_XSCALE),y)
 OBJS           += head-xscale.o
 endif
 
-SEDFLAGS       = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;
-
-ifneq ($(ZBSSADDR),)
-SEDFLAGS       += s/BSS_START/$(ZBSSADDR)/
-else
-SEDFLAGS       += s/BSS_START/ALIGN(4)/
-endif
+SEDFLAGS       = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
 
 LIBGCC         := $(shell $(CC) $(CFLAGS) --print-libgcc-file-name)
 
index 80000db087ad86c29110b25f1e2803e0fa456f8b..a1a0c847dda2d33292680987143d657603093092 100644 (file)
@@ -13,7 +13,7 @@
                /* This branch is taken if the CPU memory width matches the
                   actual device in use.  The default at power on is 16 bits
                   so we must be prepared for a mismatch. */
-               .section ".start", #alloc, #execinstr
+               .section ".start", "ax"
 2:
                b       1f
                .word   0xffff
index 211a16e6e74489cff58aa217abba671027e5a15c..757681f12a394ce6611a477659eaba0f68ecedfd 100644 (file)
@@ -1,5 +1,5 @@
 #include <asm/mach-types.h>
 #include <asm/arch/excalibur.h>
 
-               .section        ".start", #alloc, #execinstr
+               .section        ".start", "ax"
                mov     r7, #MACH_TYPE_CAMELOT
index 8e10667cae067bb97e5fb2b5436f6a0dbbca0250..aa272a3847022853cf93f6439e68370f46a769a8 100644 (file)
@@ -13,7 +13,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-       .section        ".start", #alloc, #execinstr
+       .section        ".start", "ax"
 ftv_start:
        mcr     p15, 0, r0, c7, c5, 0           @ flush I cache
        mrc     p15, 0, r0, c1, c0
index 0f901b761447065f764d36caa72e12bfab3c6bc5..e9bf350d6687ca7d71eaf60da4c99682b6eaa635 100644 (file)
@@ -1,4 +1,4 @@
 #include <asm/mach-types.h>
 
-               .section        ".start", #alloc, #execinstr
+               .section        ".start", "ax"
                mov     r7, #MACH_TYPE_INTEGRATOR
index 8ab9eafdbf084dfb8d3f5b6ac0f1634a2d0aa796..1eb2246c30774057e6986be343276e635099d1f8 100644 (file)
@@ -13,7 +13,7 @@
 #error What am I doing here...
 #endif
 
-               .section        ".start", #alloc, #execinstr
+               .section        ".start", "ax"
 
 __L7200_start:
                mov     r0, #0x00100000         @ FLASH address of initrd
index 5eecdec422d071a439a5531491827bb8f41fc03b..e7313442873e18ed9d08560bbe8ce52acb513175 100644 (file)
@@ -1,50 +1,13 @@
 /*
  *  linux/arch/arm/boot/compressed/head-netwinder.S
  *
- *  Copyright (C) 2000 Russell King
+ *  Copyright (C) 2000-2002 Russell King
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#define K(a,b,c)       ((a) << 24 | (b) << 12 | (c))
+               .section        ".start", "ax"
 
-               .section        ".start", #alloc, #execinstr
-
-               /*
-                * check to see if we are running from the correct address.
-                * If not, we move ourselves in a two stage process.  Firstly,
-                * we copy the start of the kernel (which includes this code)
-                * to 0x8000, and then jump to this code to continue with the
-                * rest (since this code will get overwritten).
-                */
-               adr     r2, 1f
-               ldmdb   r2, {r9, r10}
-               and     r3, r2, #0xc000
-               teq     r3, #0x8000     @ correctly located?
-               beq     2f              @ skip this code
-               bic     r3, r2, #0xc000
-               orr     r3, r3, #0x8000
-               mov     r0, r3          @ new address if '1'
-               mov     r4, #64         @ number of bytes to copy
-               sub     r5, r10, r9     @ total number of bytes to copy
-               b       1f
-
-               .word   _start
-               .word   __bss_start
-
-1:
-               .rept   4
-               ldmia   r2!, {r6, r9, r10, r11}
-               stmia   r3!, {r6, r9, r10, r11}
-               .endr
-               subs    r4, r4, #64
-               bcs     1b
-               movs    r4, r5          @ remaining length
-               mov     r5, #0          @ no more to copy
-               movne   pc, r0          @ jump back to 1 (in the newly copied
-                                       @ code)
-               mov     r7, #5          @ only here to fix NeTTroms which dont
-               mov     r8, #2 << 24            @ scheduled for removal in 2.5.xx
-               orr     r8, r8, #5 << 12
-2:
+               mov     r7, #5
+               mov     r8, #0
index b0dd98d1fedb0fb24f0072ffcfaa41b452567873..ca6f27b83fcfe0c4a779d21944da37211f669109 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/linkage.h>
 #include <asm/mach-types.h>
 
-               .section        ".start", #alloc, #execinstr
+               .section        ".start", "ax"
 
 __SA1100_start:
 
index 26da294e9285c521e082ddd68a64a61cb34eb222..611a5bd1ec8f65c2e400ee0d2df91ae1931c6bbb 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <asm/assembler.h>
        
-               .section        ".start", #alloc, #execinstr
+               .section        ".start", "ax"
 
                b       __beginning
        
index abe2fe19a0fb4871a7531f380176b943cf458d7c..cf9a9c9d065d6d7cfcd81f27cbddfcf1fd6b427f 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/linkage.h>
 #include <asm/mach-types.h>
 
-               .section        ".start", #alloc, #execinstr
+               .section        ".start", "ax"
 
 __XScale_start:
 
index 8142db27d233a34c544e18c86c241d0148563950..bf2f4a57488adcca7024681d6cab283f28b57df3 100644 (file)
@@ -132,10 +132,28 @@ not_angel:
                 */
 
                .text
-1:             adr     r2, LC0
-               ldmia   r2, {r2, r3, r4, r5, sp}
+               adr     r0, LC0
+               ldmia   r0, {r1, r2, r3, r4, r5, r6, ip, sp}
+               subs    r0, r0, r1              @ calculate the delta offset
+
+               teq     r0, #0                  @ if delta is zero, we're
+               beq     not_relocated           @ running at the address we
+                                               @ were linked at.
+
+               add     r2, r2, r0              @ different address, so we
+               add     r3, r3, r0              @ need to fix up various
+               add     r5, r5, r0              @ pointers.
+               add     r6, r6, r0
+               add     ip, ip, r0
+               add     sp, sp, r0
+
+1:             ldr     r1, [r6, #0]            @ relocate entries in the GOT
+               add     r1, r1, r0              @ table.  This fixes up the
+               str     r1, [r6], #4            @ C references.
+               cmp     r6, ip
+               blt     1b
 
-               mov     r0, #0
+not_relocated: mov     r0, #0
 1:             str     r0, [r2], #4            @ clear bss
                str     r0, [r2], #4
                str     r0, [r2], #4
@@ -149,17 +167,26 @@ not_angel:
                mov     r1, sp                  @ malloc space above stack
                add     r2, sp, #0x10000        @ 64k max
 
-               teq     r4, r5                  @ will we overwrite ourselves?
-               moveq   r5, r2                  @ decompress after image
-               movne   r5, r4                  @ decompress to final location
+/*
+ * Check to see if we will overwrite ourselves.
+ *   r4 = final kernel address
+ *   r5 = start of this image
+ *   r2 = end of malloc space (and therefore this image)
+ * We basically want:
+ *   r4 >= r2 -> OK
+ *   r4 + image length <= r5 -> OK
+ */
+               cmp     r4, r2
+               bhs     wont_overwrite
+               add     r0, r4, #4096*1024      @ 4MB largest kernel size
+               cmp     r0, r5
+               bls     wont_overwrite
 
+               mov     r5, r2                  @ decompress after malloc space
                mov     r0, r5
                mov     r3, r7
                bl      SYMBOL_NAME(decompress_kernel)
 
-               teq     r4, r5                  @ do we need to relocate
-               beq     call_kernel             @ the kernel?
-
                add     r0, r0, #127
                bic     r0, r0, #127            @ align the kernel length
 /*
@@ -184,12 +211,26 @@ not_angel:
                bl      cache_clean_flush
                add     pc, r5, r0              @ call relocation code
 
+/*
+ * We're not in danger of overwriting ourselves.  Do this the simple way.
+ *
+ * r4     = kernel execution address
+ * r7     = architecture ID
+ */
+wont_overwrite:        mov     r0, r4
+               mov     r3, r7
+               bl      SYMBOL_NAME(decompress_kernel)
+               b       call_kernel
+
                .type   LC0, #object
-LC0:           .word   __bss_start
-               .word   _end
-               .word   _load_addr
-               .word   _start
-               .word   user_stack+4096
+LC0:           .word   LC0                     @ r1
+               .word   __bss_start             @ r2
+               .word   _end                    @ r3
+               .word   _load_addr              @ r4
+               .word   _start                  @ r5
+               .word   _got_start              @ r6
+               .word   _got_end                @ r7
+               .word   user_stack+4096         @ r8
                .size   LC0, . - LC0
 
 /*
@@ -518,5 +559,5 @@ memdump:    mov     r12, r0
 reloc_end:
 
                .align
-               .section        ".stack"
+               .section ".stack", "aw"
 user_stack:    .space  4096
index 6cd1348d868ba104b5b2f48f204c19e1cef7e53e..0fc786166f87abeb7ee7662d9e3a16b2c7bb8d7e 100644 (file)
@@ -35,29 +35,26 @@ SECTIONS
 
   _etext = .;
 
-  .data : {
-    *(.data)
-  }
-
+  _got_start = .;
+  .got                 : { *(.got) }
+  _got_end = .;
+  .got.plt             : { *(.got.plt) }
+  .data                        : { *(.data) }
   _edata = .;
 
   . = BSS_START;
   __bss_start = .;
-  .bss : {
-    *(.bss)
-  }
+  .bss                 : { *(.bss) }
   _end = .;
 
-  .stack : {
-    *(.stack)
-  }
+  .stack (NOLOAD)      : { *(.stack) }
 
-  .stab 0 : { *(.stab) }
-  .stabstr 0 : { *(.stabstr) }
-  .stab.excl 0 : { *(.stab.excl) }
-  .stab.exclstr 0 : { *(.stab.exclstr) }
-  .stab.index 0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-  .comment 0 : { *(.comment) }
+  .stab 0              : { *(.stab) }
+  .stabstr 0           : { *(.stabstr) }
+  .stab.excl 0         : { *(.stab.excl) }
+  .stab.exclstr 0      : { *(.stab.exclstr) }
+  .stab.index 0                : { *(.stab.index) }
+  .stab.indexstr 0     : { *(.stab.indexstr) }
+  .comment 0           : { *(.comment) }
 }
 
index 5f17124059794850aec501e25392cad0d7da25d9..808cd40466726e6fa395c3b9a0c2e1f8d36fa256 100644 (file)
@@ -433,6 +433,12 @@ else
    define_bool CONFIG_FIQ n
 fi
 
+# Compressed boot loader in ROM.  Yes, we really want to ask about
+# TEXT and BSS so we preserve their values in the config files.
+bool 'Compressed boot loader in ROM/flash' CONFIG_ZBOOT_ROM
+hex 'Compressed ROM boot loader base address' CONFIG_ZBOOT_ROM_TEXT 0
+hex 'Compressed ROM boot loader BSS address' CONFIG_ZBOOT_ROM_BSS 0
+
 if [ "$CONFIG_ARCH_SA1100" = "y" -o \
      "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then
    dep_bool 'Support CPU clock change (EXPERIMENTAL)' CONFIG_CPU_FREQ $CONFIG_EXPERIMENTAL
index 25fe045db60545c8d2cbc1f815257990ed201f4d..16ac62b92532ddc20c22fbcc5ce060f5ab7e795d 100644 (file)
@@ -139,6 +139,9 @@ CONFIG_ARM_THUMB=y
 #
 # General setup
 #
+CONFIG_ZBOOT_ROM=y
+CONFIG_ZBOOT_ROM_TEXT=0x00060000
+CONFIG_ZBOOT_ROM_BSS=0xa1008000
 CONFIG_PCI=y
 # CONFIG_ISA is not set
 # CONFIG_ISA_DMA is not set
index 18010c8997b26f6193544eb85a76d1bbeb992c79..3b1325925b83b65032cf63eaf3610aa63bfa7f1e 100644 (file)
@@ -23,6 +23,9 @@ CONFIG_CPU_32=y
 # CONFIG_CPU_26 is not set
 CONFIG_CPU_32v4=y
 CONFIG_CPU_ARM720=y
+CONFIG_ZBOOT_ROM=y
+CONFIG_ZBOOT_ROM_TEXT=0x00010000
+CONFIG_ZBOOT_ROM_BSS=0xf03e0000
 # CONFIG_PCI is not set
 # CONFIG_ISA is not set
 # CONFIG_ISA_DMA is not set
index 174bef0483cc98b0c2a966ec64e577a2d6644580..e7bcb1cfdec27d9c1c5ed18ed6c88147813d5037 100644 (file)
@@ -47,6 +47,9 @@ CONFIG_MODULES=y
 #
 # General setup
 #
+CONFIG_ZBOOT_ROM=y
+CONFIG_ZBOOT_ROM_TEXT=0x00050000
+CONFIG_ZBOOT_ROM_BSS=0xc0200000
 # CONFIG_NET is not set
 # CONFIG_SYSVIPC is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
index 2377cc4df05b558ba9a50b6f931a5ef5f1d76e5a..9232411d83fdb633da52bbb1b849f67877f1a3f6 100644 (file)
@@ -46,6 +46,9 @@ CONFIG_MODULES=y
 #
 # General setup
 #
+CONFIG_ZBOOT_ROM=y
+CONFIG_ZBOOT_ROM_TEXT=0x00002000
+CONFIG_ZBOOT_ROM_BSS=0xc0200000
 # CONFIG_NET is not set
 # CONFIG_SYSVIPC is not set
 # CONFIG_BSD_PROCESS_ACCT is not set