[toolchain] eglibc: add support for 2.14
[openwrt.git] / target / linux / generic / patches-2.6.32 / 051-lzo_compressed_kernel_for_arm.patch
1 --- a/arch/arm/Kconfig
2 +++ b/arch/arm/Kconfig
3 @@ -18,6 +18,8 @@ config ARM
4 select HAVE_KRETPROBES if (HAVE_KPROBES)
5 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
6 select HAVE_GENERIC_DMA_COHERENT
7 + select HAVE_KERNEL_GZIP
8 + select HAVE_KERNEL_LZO
9 help
10 The ARM series is a line of low-power-consumption RISC chip designs
11 licensed by ARM Ltd and targeted at embedded applications and
12 --- a/arch/arm/boot/compressed/Makefile
13 +++ b/arch/arm/boot/compressed/Makefile
14 @@ -63,8 +63,12 @@ endif
15
16 SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
17
18 -targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \
19 - head.o misc.o $(OBJS)
20 +suffix_$(CONFIG_KERNEL_GZIP) = gzip
21 +suffix_$(CONFIG_KERNEL_LZO) = lzo
22 +
23 +targets := vmlinux vmlinux.lds \
24 + piggy.$(suffix_y) piggy.$(suffix_y).o \
25 + font.o font.c head.o misc.o $(OBJS)
26
27 ifeq ($(CONFIG_FUNCTION_TRACER),y)
28 ORIG_CFLAGS := $(KBUILD_CFLAGS)
29 @@ -87,22 +91,31 @@ endif
30 ifneq ($(PARAMS_PHYS),)
31 LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS)
32 endif
33 -LDFLAGS_vmlinux += -p --no-undefined -X \
34 - $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T
35 +# ?
36 +LDFLAGS_vmlinux += -p
37 +# Report unresolved symbol references
38 +LDFLAGS_vmlinux += --no-undefined
39 +# Delete all temporary local symbols
40 +LDFLAGS_vmlinux += -X
41 +# Next argument is a linker script
42 +LDFLAGS_vmlinux += -T
43 +
44 +# For __aeabi_uidivmod
45 +lib1funcs = $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.o
46
47 # Don't allow any static data in misc.o, which
48 # would otherwise mess up our GOT table
49 CFLAGS_misc.o := -Dstatic=
50
51 -$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
52 - $(addprefix $(obj)/, $(OBJS)) FORCE
53 +$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
54 + $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
55 $(call if_changed,ld)
56 @:
57
58 -$(obj)/piggy.gz: $(obj)/../Image FORCE
59 - $(call if_changed,gzip)
60 +$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
61 + $(call if_changed,$(suffix_y))
62
63 -$(obj)/piggy.o: $(obj)/piggy.gz FORCE
64 +$(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE
65
66 CFLAGS_font.o := -Dstatic=
67
68 --- a/arch/arm/boot/compressed/misc.c
69 +++ b/arch/arm/boot/compressed/misc.c
70 @@ -18,10 +18,15 @@
71
72 unsigned int __machine_arch_type;
73
74 +#define _LINUX_STRING_H_
75 +
76 #include <linux/compiler.h> /* for inline */
77 #include <linux/types.h> /* for size_t */
78 #include <linux/stddef.h> /* for NULL */
79 #include <asm/string.h>
80 +#include <linux/linkage.h>
81 +
82 +#include <asm/unaligned.h>
83
84 #ifdef STANDALONE_DEBUG
85 #define putstr printf
86 @@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __d
87 /*
88 * gzip delarations
89 */
90 -#define OF(args) args
91 #define STATIC static
92
93 -typedef unsigned char uch;
94 -typedef unsigned short ush;
95 -typedef unsigned long ulg;
96 -
97 -#define WSIZE 0x8000 /* Window size must be at least 32k, */
98 - /* and a power of two */
99 -
100 -static uch *inbuf; /* input buffer */
101 -static uch window[WSIZE]; /* Sliding window buffer */
102 -
103 -static unsigned insize; /* valid bytes in inbuf */
104 -static unsigned inptr; /* index of next byte to be processed in inbuf */
105 -static unsigned outcnt; /* bytes in output buffer */
106 -
107 -/* gzip flag byte */
108 -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
109 -#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
110 -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
111 -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
112 -#define COMMENT 0x10 /* bit 4 set: file comment present */
113 -#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
114 -#define RESERVED 0xC0 /* bit 6,7: reserved */
115 -
116 -#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
117 -
118 /* Diagnostic functions */
119 #ifdef DEBUG
120 # define Assert(cond,msg) {if(!(cond)) error(msg);}
121 @@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in out
122 # define Tracecv(c,x)
123 #endif
124
125 -static int fill_inbuf(void);
126 -static void flush_window(void);
127 static void error(char *m);
128
129 extern char input_data[];
130 extern char input_data_end[];
131
132 -static uch *output_data;
133 -static ulg output_ptr;
134 -static ulg bytes_out;
135 +static unsigned char *output_data;
136 +static unsigned long output_ptr;
137
138 static void error(char *m);
139
140 static void putstr(const char *);
141
142 -extern int end;
143 -static ulg free_mem_ptr;
144 -static ulg free_mem_end_ptr;
145 +static unsigned long free_mem_ptr;
146 +static unsigned long free_mem_end_ptr;
147
148 #ifdef STANDALONE_DEBUG
149 #define NO_INFLATE_MALLOC
150 @@ -258,46 +233,13 @@ static ulg free_mem_end_ptr;
151
152 #define ARCH_HAS_DECOMP_WDOG
153
154 -#include "../../../../lib/inflate.c"
155 -
156 -/* ===========================================================================
157 - * Fill the input buffer. This is called only when the buffer is empty
158 - * and at least one byte is really needed.
159 - */
160 -int fill_inbuf(void)
161 -{
162 - if (insize != 0)
163 - error("ran out of input data");
164 -
165 - inbuf = input_data;
166 - insize = &input_data_end[0] - &input_data[0];
167 -
168 - inptr = 1;
169 - return inbuf[0];
170 -}
171 +#ifdef CONFIG_KERNEL_GZIP
172 +#include "../../../../lib/decompress_inflate.c"
173 +#endif
174
175 -/* ===========================================================================
176 - * Write the output window window[0..outcnt-1] and update crc and bytes_out.
177 - * (Used for the decompressed data only.)
178 - */
179 -void flush_window(void)
180 -{
181 - ulg c = crc;
182 - unsigned n;
183 - uch *in, *out, ch;
184 -
185 - in = window;
186 - out = &output_data[output_ptr];
187 - for (n = 0; n < outcnt; n++) {
188 - ch = *out++ = *in++;
189 - c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
190 - }
191 - crc = c;
192 - bytes_out += (ulg)outcnt;
193 - output_ptr += (ulg)outcnt;
194 - outcnt = 0;
195 - putstr(".");
196 -}
197 +#ifdef CONFIG_KERNEL_LZO
198 +#include "../../../../lib/decompress_unlzo.c"
199 +#endif
200
201 #ifndef arch_error
202 #define arch_error(x)
203 @@ -314,22 +256,33 @@ static void error(char *x)
204 while(1); /* Halt */
205 }
206
207 +asmlinkage void __div0(void)
208 +{
209 + error("Attempting division by 0!");
210 +}
211 +
212 #ifndef STANDALONE_DEBUG
213
214 -ulg
215 -decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p,
216 - int arch_id)
217 +unsigned long
218 +decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
219 + unsigned long free_mem_ptr_end_p,
220 + int arch_id)
221 {
222 - output_data = (uch *)output_start; /* Points to kernel start */
223 + unsigned char *tmp;
224 +
225 + output_data = (unsigned char *)output_start;
226 free_mem_ptr = free_mem_ptr_p;
227 free_mem_end_ptr = free_mem_ptr_end_p;
228 __machine_arch_type = arch_id;
229
230 arch_decomp_setup();
231
232 - makecrc();
233 + tmp = (unsigned char *) (((unsigned long)input_data_end) - 4);
234 + output_ptr = get_unaligned_le32(tmp);
235 +
236 putstr("Uncompressing Linux...");
237 - gunzip();
238 + decompress(input_data, input_data_end - input_data,
239 + NULL, NULL, output_data, NULL, error);
240 putstr(" done, booting the kernel.\n");
241 return output_ptr;
242 }
243 @@ -341,11 +294,10 @@ int main()
244 {
245 output_data = output_buffer;
246
247 - makecrc();
248 putstr("Uncompressing Linux...");
249 - gunzip();
250 + decompress(input_data, input_data_end - input_data,
251 + NULL, NULL, output_data, NULL, error);
252 putstr("done.\n");
253 return 0;
254 }
255 #endif
256 -
257 --- a/arch/arm/boot/compressed/piggy.S
258 +++ /dev/null
259 @@ -1,6 +0,0 @@
260 - .section .piggydata,#alloc
261 - .globl input_data
262 -input_data:
263 - .incbin "arch/arm/boot/compressed/piggy.gz"
264 - .globl input_data_end
265 -input_data_end:
266 --- /dev/null
267 +++ b/arch/arm/boot/compressed/piggy.gzip.S
268 @@ -0,0 +1,6 @@
269 + .section .piggydata,#alloc
270 + .globl input_data
271 +input_data:
272 + .incbin "arch/arm/boot/compressed/piggy.gzip"
273 + .globl input_data_end
274 +input_data_end:
275 --- /dev/null
276 +++ b/arch/arm/boot/compressed/piggy.lzo.S
277 @@ -0,0 +1,6 @@
278 + .section .piggydata,#alloc
279 + .globl input_data
280 +input_data:
281 + .incbin "arch/arm/boot/compressed/piggy.lzo"
282 + .globl input_data_end
283 +input_data_end:
This page took 0.058668 seconds and 5 git commands to generate.