Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102423
b: refs/heads/master
c: bd451d5
h: refs/heads/master
i:
  102421: 291ccb1
  102419: fe25b1f
  102415: e079e58
v: v3
  • Loading branch information
Jesper Nilsson committed Jun 30, 2008
1 parent 2bb4dd4 commit 8f5ae12
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 146 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e05f86c13bca8eac80bccd1e86f3e09a7d3ae963
refs/heads/master: bd451d5ed206cda4ed0e03fac4e5dece2fd7767f
1 change: 1 addition & 0 deletions trunk/arch/cris/arch-v10/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# arch/cris/arch-v10/boot/Makefile
#

OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss

subdir- := compressed rescue
Expand Down
14 changes: 11 additions & 3 deletions trunk/arch/cris/arch-v10/boot/compressed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
# arch/cris/arch-v10/boot/compressed/Makefile
#

asflags-y += $(LINUXINCLUDE)
ccflags-y += -O2 $(LINUXINCLUDE)
ldflags-y += -T $(srctree)/$(obj)/decompress.ld
CC = gcc-cris -melf $(LINUXINCLUDE)
ccflags-y += -O2
LD = ld-cris
ldflags-y += -T $(obj)/decompress.ld
OBJECTS = $(obj)/head.o $(obj)/misc.o
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss

quiet_cmd_image = BUILD $@
Expand All @@ -19,6 +21,12 @@ $(obj)/decompress.o: $(OBJECTS) FORCE
$(obj)/decompress.bin: $(obj)/decompress.o FORCE
$(call if_changed,objcopy)

$(obj)/head.o: $(obj)/head.S .config
@$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@

$(obj)/misc.o: $(obj)/misc.c .config
@$(CC) -D__KERNEL__ -c $< -o $@

$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
$(call if_changed,image)

Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/cris/arch-v10/boot/compressed/decompress.ld
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* OUTPUT_FORMAT(elf32-us-cris) */
OUTPUT_FORMAT(elf32-cris)
OUTPUT_FORMAT(elf32-us-cris)

MEMORY
{
Expand Down
98 changes: 49 additions & 49 deletions trunk/arch/cris/arch-v10/boot/compressed/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,77 @@
#define COMMAND_LINE_MAGIC 0x87109563

;; Exported symbols

.globl _input_data

.globl input_data



.text

nop
di

;; We need to initialze DRAM registers before we start using the DRAM

cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
cmp.d RAM_INIT_MAGIC, r8 ; Already initialized?
beq dram_init_finished
nop

#include "../../lib/dram_init.S"

dram_init_finished:

dram_init_finished:
;; Initiate the PA and PB ports

move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
move.b $r0, [R_PORT_PA_DATA]
move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0
move.b r0, [R_PORT_PA_DATA]

move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
move.b $r0, [R_PORT_PA_DIR]
move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0
move.b r0, [R_PORT_PA_DIR]

move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
move.b $r0, [R_PORT_PB_DATA]
move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0
move.b r0, [R_PORT_PB_DATA]

move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
move.b $r0, [R_PORT_PB_DIR]
move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0
move.b r0, [R_PORT_PB_DIR]

;; Setup the stack to a suitably high address.
;; We assume 8 MB is the minimum DRAM in an eLinux
;; product and put the sp at the top for now.

move.d 0x40800000, $sp
move.d 0x40800000, sp

;; Figure out where the compressed piggyback image is
;; in the flash (since we wont try to copy it to DRAM
;; before unpacking). It is at _edata, but in flash.
;; Use (_edata - basse) as offset to the current PC.

basse: move.d $pc, $r5
and.d 0x7fffffff, $r5 ; strip any non-cache bit
subq 2, $r5 ; compensate for the move.d $pc instr
move.d $r5, $r0 ; save for later - flash address of 'basse'
add.d _edata, $r5
sub.d basse, $r5 ; $r5 = flash address of '_edata'

basse: move.d pc, r5
and.d 0x7fffffff, r5 ; strip any non-cache bit
subq 2, r5 ; compensate for the move.d pc instr
move.d r5, r0 ; save for later - flash address of 'basse'
add.d _edata, r5
sub.d basse, r5 ; r5 = flash address of '_edata'
;; Copy text+data to DRAM

move.d basse, $r1 ; destination
move.d _edata, $r2 ; end destination
1: move.w [$r0+], $r3
move.w $r3, [$r1+]
cmp.d $r2, $r1
move.d basse, r1 ; destination
move.d _edata, r2 ; end destination
1: move.w [r0+], r3
move.w r3, [r1+]
cmp.d r2, r1
bcs 1b
nop

move.d $r5, [input_data] ; for the decompressor
move.d r5, [_input_data] ; for the decompressor


;; Clear the decompressors BSS (between _edata and _end)

moveq 0, $r0
move.d _edata, $r1
move.d _end, $r2
1: move.w $r0, [$r1+]
cmp.d $r2, $r1
moveq 0, r0
move.d _edata, r1
move.d _end, r2
1: move.w r0, [r1+]
cmp.d r2, r1
bcs 1b
nop

Expand All @@ -94,16 +94,16 @@ basse: move.d $pc, $r5
move.d $r10, [$r12]
move.d _cmd_line_addr, $r12
move.d $r11, [$r12]

;; Do the decompression and save compressed size in _inptr

;; Do the decompression and save compressed size in inptr

jsr decompress_kernel

;; Put start address of root partition in $r9 so the kernel can use it
jsr _decompress_kernel

;; Put start address of root partition in r9 so the kernel can use it
;; when mounting from flash

move.d [input_data], $r9 ; flash address of compressed kernel
add.d [inptr], $r9 ; size of compressed kernel
move.d [_input_data], r9 ; flash address of compressed kernel
add.d [_inptr], r9 ; size of compressed kernel

;; Restore command line magic and address.
move.d _cmd_line_magic, $r10
Expand All @@ -112,12 +112,12 @@ basse: move.d $pc, $r5
move.d [$r11], $r11

;; Enter the decompressed kernel
move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
jump 0x40004000 ; kernel is linked to this address

.data

input_data:
_input_data:
.dword 0 ; used by the decompressor
_cmd_line_magic:
.dword 0
Expand Down
Loading

0 comments on commit 8f5ae12

Please sign in to comment.