diff options
Diffstat (limited to 'arch/mips/boot')
-rw-r--r-- | arch/mips/boot/.gitignore | 1 | ||||
-rw-r--r-- | arch/mips/boot/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/boot/compressed/Makefile | 18 | ||||
-rw-r--r-- | arch/mips/boot/compressed/decompress.c | 14 | ||||
-rw-r--r-- | arch/mips/boot/compressed/ld.script | 195 |
5 files changed, 72 insertions, 158 deletions
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore index ba63401c6e10..4667a5f9280b 100644 --- a/arch/mips/boot/.gitignore +++ b/arch/mips/boot/.gitignore | |||
@@ -1,4 +1,5 @@ | |||
1 | mkboot | 1 | mkboot |
2 | elf2ecoff | 2 | elf2ecoff |
3 | vmlinux.* | ||
3 | zImage | 4 | zImage |
4 | zImage.tmp | 5 | zImage.tmp |
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile index 094bc84765a3..e39a08edcaaa 100644 --- a/arch/mips/boot/Makefile +++ b/arch/mips/boot/Makefile | |||
@@ -28,7 +28,7 @@ VMLINUX = vmlinux | |||
28 | all: vmlinux.ecoff vmlinux.srec | 28 | all: vmlinux.ecoff vmlinux.srec |
29 | 29 | ||
30 | vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) | 30 | vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) |
31 | $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS) | 31 | $(obj)/elf2ecoff $(VMLINUX) $(obj)/vmlinux.ecoff $(E2EFLAGS) |
32 | 32 | ||
33 | $(obj)/elf2ecoff: $(obj)/elf2ecoff.c | 33 | $(obj)/elf2ecoff: $(obj)/elf2ecoff.c |
34 | $(HOSTCC) -o $@ $^ | 34 | $(HOSTCC) -o $@ $^ |
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index e27f40bbd4e5..9df903d714d7 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile | |||
@@ -14,8 +14,11 @@ | |||
14 | 14 | ||
15 | # compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE | 15 | # compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE |
16 | VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1) | 16 | VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1) |
17 | VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536)))) | 17 | VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo -n $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536)))) |
18 | VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" ] && printf %x $$(($(VMLINUX_LOAD_ADDRESS) + $(VMLINUX_SIZE)))) | 18 | # VMLINUZ_LOAD_ADDRESS = concat "high32 of VMLINUX_LOAD_ADDRESS" and "(low32 of VMLINUX_LOAD_ADDRESS) + VMLINUX_SIZE" |
19 | HIGH32 := $(shell A=$(VMLINUX_LOAD_ADDRESS); [ $${\#A} -gt 10 ] && expr substr "$(VMLINUX_LOAD_ADDRESS)" 3 $$(($${\#A} - 10))) | ||
20 | LOW32 := $(shell [ -n "$(HIGH32)" ] && A=11 || A=3; expr substr "$(VMLINUX_LOAD_ADDRESS)" $${A} 8) | ||
21 | VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" -a -n "$(LOW32)" ] && printf "$(HIGH32)%08x" $$(($(VMLINUX_SIZE) + 0x$(LOW32)))) | ||
19 | 22 | ||
20 | # set the default size of the mallocing area for decompressing | 23 | # set the default size of the mallocing area for decompressing |
21 | BOOT_HEAP_SIZE := 0x400000 | 24 | BOOT_HEAP_SIZE := 0x400000 |
@@ -41,9 +44,11 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE) | |||
41 | suffix_$(CONFIG_KERNEL_GZIP) = gz | 44 | suffix_$(CONFIG_KERNEL_GZIP) = gz |
42 | suffix_$(CONFIG_KERNEL_BZIP2) = bz2 | 45 | suffix_$(CONFIG_KERNEL_BZIP2) = bz2 |
43 | suffix_$(CONFIG_KERNEL_LZMA) = lzma | 46 | suffix_$(CONFIG_KERNEL_LZMA) = lzma |
47 | suffix_$(CONFIG_KERNEL_LZO) = lzo | ||
44 | tool_$(CONFIG_KERNEL_GZIP) = gzip | 48 | tool_$(CONFIG_KERNEL_GZIP) = gzip |
45 | tool_$(CONFIG_KERNEL_BZIP2) = bzip2 | 49 | tool_$(CONFIG_KERNEL_BZIP2) = bzip2 |
46 | tool_$(CONFIG_KERNEL_LZMA) = lzma | 50 | tool_$(CONFIG_KERNEL_LZMA) = lzma |
51 | tool_$(CONFIG_KERNEL_LZO) = lzo | ||
47 | $(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin | 52 | $(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin |
48 | $(call if_changed,$(tool_y)) | 53 | $(call if_changed,$(tool_y)) |
49 | 54 | ||
@@ -56,7 +61,7 @@ $(obj)/piggy.o: $(obj)/vmlinux.$(suffix_y) $(obj)/dummy.o | |||
56 | LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T | 61 | LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T |
57 | vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o | 62 | vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o |
58 | $(call if_changed,ld) | 63 | $(call if_changed,ld) |
59 | $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) -R .comment -R .stab -R .stabstr -R .initrd -R .sysmap $@ | 64 | $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@ |
60 | 65 | ||
61 | # | 66 | # |
62 | # Some DECstations need all possible sections of an ECOFF executable | 67 | # Some DECstations need all possible sections of an ECOFF executable |
@@ -84,14 +89,11 @@ vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ) | |||
84 | $(obj)/../elf2ecoff: $(src)/../elf2ecoff.c | 89 | $(obj)/../elf2ecoff: $(src)/../elf2ecoff.c |
85 | $(Q)$(HOSTCC) -o $@ $^ | 90 | $(Q)$(HOSTCC) -o $@ $^ |
86 | 91 | ||
87 | drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options | 92 | OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary |
88 | strip-flags = $(addprefix --remove-section=,$(drop-sections)) | ||
89 | |||
90 | OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary $(strip-flags) | ||
91 | vmlinuz.bin: vmlinuz | 93 | vmlinuz.bin: vmlinuz |
92 | $(call if_changed,objcopy) | 94 | $(call if_changed,objcopy) |
93 | 95 | ||
94 | OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec $(strip-flags) | 96 | OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec |
95 | vmlinuz.srec: vmlinuz | 97 | vmlinuz.srec: vmlinuz |
96 | $(call if_changed,objcopy) | 98 | $(call if_changed,objcopy) |
97 | 99 | ||
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c index 67330c2f7318..55d02b3a6712 100644 --- a/arch/mips/boot/compressed/decompress.c +++ b/arch/mips/boot/compressed/decompress.c | |||
@@ -28,8 +28,6 @@ char *zimage_start; | |||
28 | 28 | ||
29 | /* The linker tells us where the image is. */ | 29 | /* The linker tells us where the image is. */ |
30 | extern unsigned char __image_begin, __image_end; | 30 | extern unsigned char __image_begin, __image_end; |
31 | extern unsigned char __ramdisk_begin, __ramdisk_end; | ||
32 | unsigned long initrd_size; | ||
33 | 31 | ||
34 | /* debug interfaces */ | 32 | /* debug interfaces */ |
35 | extern void puts(const char *s); | 33 | extern void puts(const char *s); |
@@ -79,6 +77,10 @@ void *memset(void *s, int c, size_t n) | |||
79 | #include "../../../../lib/decompress_unlzma.c" | 77 | #include "../../../../lib/decompress_unlzma.c" |
80 | #endif | 78 | #endif |
81 | 79 | ||
80 | #ifdef CONFIG_KERNEL_LZO | ||
81 | #include "../../../../lib/decompress_unlzo.c" | ||
82 | #endif | ||
83 | |||
82 | void decompress_kernel(unsigned long boot_heap_start) | 84 | void decompress_kernel(unsigned long boot_heap_start) |
83 | { | 85 | { |
84 | int zimage_size; | 86 | int zimage_size; |
@@ -102,14 +104,6 @@ void decompress_kernel(unsigned long boot_heap_start) | |||
102 | puthex((unsigned long)(zimage_size + zimage_start)); | 104 | puthex((unsigned long)(zimage_size + zimage_start)); |
103 | puts("\n"); | 105 | puts("\n"); |
104 | 106 | ||
105 | if (initrd_size) { | ||
106 | puts("initrd at: "); | ||
107 | puthex((unsigned long)(&__ramdisk_begin)); | ||
108 | puts(" "); | ||
109 | puthex((unsigned long)(&__ramdisk_end)); | ||
110 | puts("\n"); | ||
111 | } | ||
112 | |||
113 | /* this area are prepared for mallocing when decompressing */ | 107 | /* this area are prepared for mallocing when decompressing */ |
114 | free_mem_ptr = boot_heap_start; | 108 | free_mem_ptr = boot_heap_start; |
115 | free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE; | 109 | free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE; |
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script index 29e9f4c0d5d8..613a35b02f50 100644 --- a/arch/mips/boot/compressed/ld.script +++ b/arch/mips/boot/compressed/ld.script | |||
@@ -1,150 +1,67 @@ | |||
1 | /* | ||
2 | * ld.script for compressed kernel support of MIPS | ||
3 | * | ||
4 | * Copyright (C) 2009 Lemote Inc. | ||
5 | * Author: Wu Zhangjin <wuzj@lemote.com> | ||
6 | */ | ||
7 | |||
1 | OUTPUT_ARCH(mips) | 8 | OUTPUT_ARCH(mips) |
2 | ENTRY(start) | 9 | ENTRY(start) |
3 | SECTIONS | 10 | SECTIONS |
4 | { | 11 | { |
5 | /* Read-only sections, merged into text segment: */ | 12 | /* . = VMLINUZ_LOAD_ADDRESS */ |
6 | .init : { *(.init) } =0 | 13 | /* read-only */ |
7 | .text : | 14 | _text = .; /* Text and read-only data */ |
8 | { | 15 | .text : { |
9 | _ftext = . ; | 16 | _ftext = . ; |
10 | *(.text) | 17 | *(.text) |
11 | *(.rodata) | 18 | *(.rodata) |
12 | *(.rodata1) | 19 | } = 0 |
13 | /* .gnu.warning sections are handled specially by elf32.em. */ | 20 | _etext = .; /* End of text section */ |
14 | *(.gnu.warning) | ||
15 | } =0 | ||
16 | .kstrtab : { *(.kstrtab) } | ||
17 | |||
18 | . = ALIGN(16); /* Exception table */ | ||
19 | __start___ex_table = .; | ||
20 | __ex_table : { *(__ex_table) } | ||
21 | __stop___ex_table = .; | ||
22 | |||
23 | __start___dbe_table = .; /* Exception table for data bus errors */ | ||
24 | __dbe_table : { *(__dbe_table) } | ||
25 | __stop___dbe_table = .; | ||
26 | |||
27 | __start___ksymtab = .; /* Kernel symbol table */ | ||
28 | __ksymtab : { *(__ksymtab) } | ||
29 | __stop___ksymtab = .; | ||
30 | |||
31 | _etext = .; | ||
32 | |||
33 | . = ALIGN(8192); | ||
34 | .data.init_task : { *(.data.init_task) } | ||
35 | |||
36 | /* Startup code */ | ||
37 | . = ALIGN(4096); | ||
38 | __init_begin = .; | ||
39 | .text.init : { *(.text.init) } | ||
40 | .data.init : { *(.data.init) } | ||
41 | . = ALIGN(16); | ||
42 | __setup_start = .; | ||
43 | .setup.init : { *(.setup.init) } | ||
44 | __setup_end = .; | ||
45 | __initcall_start = .; | ||
46 | .initcall.init : { *(.initcall.init) } | ||
47 | __initcall_end = .; | ||
48 | . = ALIGN(4096); /* Align double page for init_task_union */ | ||
49 | __init_end = .; | ||
50 | |||
51 | . = ALIGN(4096); | ||
52 | .data.page_aligned : { *(.data.idt) } | ||
53 | |||
54 | . = ALIGN(32); | ||
55 | .data.cacheline_aligned : { *(.data.cacheline_aligned) } | ||
56 | 21 | ||
57 | .fini : { *(.fini) } =0 | 22 | /* writable */ |
58 | .reginfo : { *(.reginfo) } | 23 | .data : { /* Data */ |
59 | /* Adjust the address for the data segment. We want to adjust up to | 24 | _fdata = . ; |
60 | the same address within the page on the next page up. It would | 25 | *(.data) |
61 | be more correct to do this: | 26 | /* Put the compressed image here, so bss is on the end. */ |
62 | . = .; | 27 | __image_begin = .; |
63 | The current expression does not correctly handle the case of a | 28 | *(.image) |
64 | text segment ending precisely at the end of a page; it causes the | 29 | __image_end = .; |
65 | data segment to skip a page. The above expression does not have | 30 | CONSTRUCTORS |
66 | this problem, but it will currently (2/95) cause BFD to allocate | 31 | } |
67 | a single segment, combining both text and data, for this case. | 32 | .sdata : { *(.sdata) } |
68 | This will prevent the text segment from being shared among | 33 | . = ALIGN(4); |
69 | multiple executions of the program; I think that is more | 34 | _edata = .; /* End of data section */ |
70 | important than losing a page of the virtual address space (note | ||
71 | that no actual memory is lost; the page which is skipped can not | ||
72 | be referenced). */ | ||
73 | . = .; | ||
74 | .data : | ||
75 | { | ||
76 | _fdata = . ; | ||
77 | *(.data) | ||
78 | 35 | ||
79 | /* Put the compressed image here, so bss is on the end. */ | 36 | /* BSS */ |
80 | __image_begin = .; | 37 | __bss_start = .; |
81 | *(.image) | 38 | _fbss = .; |
82 | __image_end = .; | 39 | .sbss : { *(.sbss) *(.scommon) } |
83 | /* Align the initial ramdisk image (INITRD) on page boundaries. */ | 40 | .bss : { |
84 | . = ALIGN(4096); | 41 | *(.dynbss) |
85 | __ramdisk_begin = .; | 42 | *(.bss) |
86 | *(.initrd) | 43 | *(COMMON) |
87 | __ramdisk_end = .; | 44 | } |
88 | . = ALIGN(4096); | 45 | . = ALIGN(4); |
46 | _end = . ; | ||
89 | 47 | ||
90 | CONSTRUCTORS | 48 | /* These are needed for ELF backends which have not yet been converted |
91 | } | 49 | * to the new style linker. */ |
92 | .data1 : { *(.data1) } | ||
93 | _gp = . + 0x8000; | ||
94 | .lit8 : { *(.lit8) } | ||
95 | .lit4 : { *(.lit4) } | ||
96 | .ctors : { *(.ctors) } | ||
97 | .dtors : { *(.dtors) } | ||
98 | .got : { *(.got.plt) *(.got) } | ||
99 | .dynamic : { *(.dynamic) } | ||
100 | /* We want the small data sections together, so single-instruction offsets | ||
101 | can access them all, and initialized data all before uninitialized, so | ||
102 | we can shorten the on-disk segment size. */ | ||
103 | .sdata : { *(.sdata) } | ||
104 | . = ALIGN(4); | ||
105 | _edata = .; | ||
106 | PROVIDE (edata = .); | ||
107 | 50 | ||
108 | __bss_start = .; | 51 | .stab 0 : { *(.stab) } |
109 | _fbss = .; | 52 | .stabstr 0 : { *(.stabstr) } |
110 | .sbss : { *(.sbss) *(.scommon) } | ||
111 | .bss : | ||
112 | { | ||
113 | *(.dynbss) | ||
114 | *(.bss) | ||
115 | *(COMMON) | ||
116 | . = ALIGN(4); | ||
117 | _end = . ; | ||
118 | PROVIDE (end = .); | ||
119 | } | ||
120 | 53 | ||
121 | /* Sections to be discarded */ | 54 | /* These must appear regardless of . */ |
122 | /DISCARD/ : | 55 | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } |
123 | { | 56 | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } |
124 | *(.text.exit) | ||
125 | *(.data.exit) | ||
126 | *(.exitcall.exit) | ||
127 | } | ||
128 | 57 | ||
129 | /* This is the MIPS specific mdebug section. */ | 58 | /* Sections to be discarded */ |
130 | .mdebug : { *(.mdebug) } | 59 | /DISCARD/ : { |
131 | /* These are needed for ELF backends which have not yet been | 60 | *(.MIPS.options) |
132 | converted to the new style linker. */ | 61 | *(.options) |
133 | .stab 0 : { *(.stab) } | 62 | *(.pdr) |
134 | .stabstr 0 : { *(.stabstr) } | 63 | *(.reginfo) |
135 | /* DWARF debug sections. | 64 | *(.comment) |
136 | Symbols in the .debug DWARF section are relative to the beginning of the | 65 | *(.note) |
137 | section so we begin .debug at 0. It's not clear yet what needs to happen | 66 | } |
138 | for the others. */ | ||
139 | .debug 0 : { *(.debug) } | ||
140 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | ||
141 | .debug_aranges 0 : { *(.debug_aranges) } | ||
142 | .debug_pubnames 0 : { *(.debug_pubnames) } | ||
143 | .debug_sfnames 0 : { *(.debug_sfnames) } | ||
144 | .line 0 : { *(.line) } | ||
145 | /* These must appear regardless of . */ | ||
146 | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } | ||
147 | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } | ||
148 | .comment : { *(.comment) } | ||
149 | .note : { *(.note) } | ||
150 | } | 67 | } |