aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/boot
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-28 15:02:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-28 15:02:27 -0400
commit1fdb24e969110fafea36d3b393bea438f702c87f (patch)
tree47a1dfef8a259e7922285315f8a02d31b4efe2f1 /arch/arm/boot
parentf362f98e7c445643d27c610bb7a86b79727b592e (diff)
parent531a6a941745e1e045dd2a6bd09e1dc01247a5f3 (diff)
Merge branch 'devel-stable' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm
* 'devel-stable' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm: (178 commits) ARM: 7139/1: fix compilation with CONFIG_ARM_ATAG_DTB_COMPAT and large TEXT_OFFSET ARM: gic, local timers: use the request_percpu_irq() interface ARM: gic: consolidate PPI handling ARM: switch from NO_MACH_MEMORY_H to NEED_MACH_MEMORY_H ARM: mach-s5p64x0: remove mach/memory.h ARM: mach-s3c64xx: remove mach/memory.h ARM: plat-mxc: remove mach/memory.h ARM: mach-prima2: remove mach/memory.h ARM: mach-zynq: remove mach/memory.h ARM: mach-bcmring: remove mach/memory.h ARM: mach-davinci: remove mach/memory.h ARM: mach-pxa: remove mach/memory.h ARM: mach-ixp4xx: remove mach/memory.h ARM: mach-h720x: remove mach/memory.h ARM: mach-vt8500: remove mach/memory.h ARM: mach-s5pc100: remove mach/memory.h ARM: mach-tegra: remove mach/memory.h ARM: plat-tcc: remove mach/memory.h ARM: mach-mmp: remove mach/memory.h ARM: mach-cns3xxx: remove mach/memory.h ... Fix up mostly pretty trivial conflicts in: - arch/arm/Kconfig - arch/arm/include/asm/localtimer.h - arch/arm/kernel/Makefile - arch/arm/mach-shmobile/board-ap4evb.c - arch/arm/mach-u300/core.c - arch/arm/mm/dma-mapping.c - arch/arm/mm/proc-v7.S - arch/arm/plat-omap/Kconfig largely due to some CONFIG option renaming (ie CONFIG_PM_SLEEP -> CONFIG_ARM_CPU_SUSPEND for the arm-specific suspend code etc) and addition of NEED_MACH_MEMORY_H next to HAVE_IDE.
Diffstat (limited to 'arch/arm/boot')
-rw-r--r--arch/arm/boot/compressed/.gitignore9
-rw-r--r--arch/arm/boot/compressed/Makefile32
-rw-r--r--arch/arm/boot/compressed/atags_to_fdt.c97
-rw-r--r--arch/arm/boot/compressed/head.S122
-rw-r--r--arch/arm/boot/compressed/libfdt_env.h15
-rw-r--r--arch/arm/boot/compressed/misc.c42
-rw-r--r--arch/arm/boot/compressed/string.c127
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.in4
8 files changed, 396 insertions, 52 deletions
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore
index c6028967d33..e0936a14851 100644
--- a/arch/arm/boot/compressed/.gitignore
+++ b/arch/arm/boot/compressed/.gitignore
@@ -5,3 +5,12 @@ piggy.lzo
5piggy.lzma 5piggy.lzma
6vmlinux 6vmlinux
7vmlinux.lds 7vmlinux.lds
8
9# borrowed libfdt files
10fdt.c
11fdt.h
12fdt_ro.c
13fdt_rw.c
14fdt_wip.c
15libfdt.h
16libfdt_internal.h
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index a6b30b35ca6..21f56ff3279 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -26,6 +26,10 @@ HEAD = head.o
26OBJS += misc.o decompress.o 26OBJS += misc.o decompress.o
27FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 27FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
28 28
29# string library code (-Os is enforced to keep it much smaller)
30OBJS += string.o
31CFLAGS_string.o := -Os
32
29# 33#
30# Architecture dependencies 34# Architecture dependencies
31# 35#
@@ -89,21 +93,41 @@ suffix_$(CONFIG_KERNEL_GZIP) = gzip
89suffix_$(CONFIG_KERNEL_LZO) = lzo 93suffix_$(CONFIG_KERNEL_LZO) = lzo
90suffix_$(CONFIG_KERNEL_LZMA) = lzma 94suffix_$(CONFIG_KERNEL_LZMA) = lzma
91 95
96# Borrowed libfdt files for the ATAG compatibility mode
97
98libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
99libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h
100
101libfdt_objs := $(addsuffix .o, $(basename $(libfdt)))
102
103$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
104 $(call cmd,shipped)
105
106$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \
107 $(addprefix $(obj)/,$(libfdt_hdrs))
108
109ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
110OBJS += $(libfdt_objs) atags_to_fdt.o
111endif
112
92targets := vmlinux vmlinux.lds \ 113targets := vmlinux vmlinux.lds \
93 piggy.$(suffix_y) piggy.$(suffix_y).o \ 114 piggy.$(suffix_y) piggy.$(suffix_y).o \
94 font.o font.c head.o misc.o $(OBJS) 115 lib1funcs.o lib1funcs.S font.o font.c head.o misc.o $(OBJS)
95 116
96# Make sure files are removed during clean 117# Make sure files are removed during clean
97extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S 118extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S $(libfdt) $(libfdt_hdrs)
98 119
99ifeq ($(CONFIG_FUNCTION_TRACER),y) 120ifeq ($(CONFIG_FUNCTION_TRACER),y)
100ORIG_CFLAGS := $(KBUILD_CFLAGS) 121ORIG_CFLAGS := $(KBUILD_CFLAGS)
101KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) 122KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
102endif 123endif
103 124
104ccflags-y := -fpic -fno-builtin 125ccflags-y := -fpic -fno-builtin -I$(obj)
105asflags-y := -Wa,-march=all 126asflags-y := -Wa,-march=all
106 127
128# Supply kernel BSS size to the decompressor via a linker symbol.
129KBSS_SZ = $(shell size $(obj)/../../../../vmlinux | awk 'END{print $$3}')
130LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
107# Supply ZRELADDR to the decompressor via a linker symbol. 131# Supply ZRELADDR to the decompressor via a linker symbol.
108ifneq ($(CONFIG_AUTO_ZRELADDR),y) 132ifneq ($(CONFIG_AUTO_ZRELADDR),y)
109LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR) 133LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
@@ -123,7 +147,7 @@ LDFLAGS_vmlinux += -T
123# For __aeabi_uidivmod 147# For __aeabi_uidivmod
124lib1funcs = $(obj)/lib1funcs.o 148lib1funcs = $(obj)/lib1funcs.o
125 149
126$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE 150$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S
127 $(call cmd,shipped) 151 $(call cmd,shipped)
128 152
129# We need to prevent any GOTOFF relocs being used with references 153# We need to prevent any GOTOFF relocs being used with references
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
new file mode 100644
index 00000000000..6ce11c48117
--- /dev/null
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -0,0 +1,97 @@
1#include <asm/setup.h>
2#include <libfdt.h>
3
4static int node_offset(void *fdt, const char *node_path)
5{
6 int offset = fdt_path_offset(fdt, node_path);
7 if (offset == -FDT_ERR_NOTFOUND)
8 offset = fdt_add_subnode(fdt, 0, node_path);
9 return offset;
10}
11
12static int setprop(void *fdt, const char *node_path, const char *property,
13 uint32_t *val_array, int size)
14{
15 int offset = node_offset(fdt, node_path);
16 if (offset < 0)
17 return offset;
18 return fdt_setprop(fdt, offset, property, val_array, size);
19}
20
21static int setprop_string(void *fdt, const char *node_path,
22 const char *property, const char *string)
23{
24 int offset = node_offset(fdt, node_path);
25 if (offset < 0)
26 return offset;
27 return fdt_setprop_string(fdt, offset, property, string);
28}
29
30static int setprop_cell(void *fdt, const char *node_path,
31 const char *property, uint32_t val)
32{
33 int offset = node_offset(fdt, node_path);
34 if (offset < 0)
35 return offset;
36 return fdt_setprop_cell(fdt, offset, property, val);
37}
38
39/*
40 * Convert and fold provided ATAGs into the provided FDT.
41 *
42 * REturn values:
43 * = 0 -> pretend success
44 * = 1 -> bad ATAG (may retry with another possible ATAG pointer)
45 * < 0 -> error from libfdt
46 */
47int atags_to_fdt(void *atag_list, void *fdt, int total_space)
48{
49 struct tag *atag = atag_list;
50 uint32_t mem_reg_property[2 * NR_BANKS];
51 int memcount = 0;
52 int ret;
53
54 /* make sure we've got an aligned pointer */
55 if ((u32)atag_list & 0x3)
56 return 1;
57
58 /* if we get a DTB here we're done already */
59 if (*(u32 *)atag_list == fdt32_to_cpu(FDT_MAGIC))
60 return 0;
61
62 /* validate the ATAG */
63 if (atag->hdr.tag != ATAG_CORE ||
64 (atag->hdr.size != tag_size(tag_core) &&
65 atag->hdr.size != 2))
66 return 1;
67
68 /* let's give it all the room it could need */
69 ret = fdt_open_into(fdt, fdt, total_space);
70 if (ret < 0)
71 return ret;
72
73 for_each_tag(atag, atag_list) {
74 if (atag->hdr.tag == ATAG_CMDLINE) {
75 setprop_string(fdt, "/chosen", "bootargs",
76 atag->u.cmdline.cmdline);
77 } else if (atag->hdr.tag == ATAG_MEM) {
78 if (memcount >= sizeof(mem_reg_property)/4)
79 continue;
80 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start);
81 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size);
82 } else if (atag->hdr.tag == ATAG_INITRD2) {
83 uint32_t initrd_start, initrd_size;
84 initrd_start = atag->u.initrd.start;
85 initrd_size = atag->u.initrd.size;
86 setprop_cell(fdt, "/chosen", "linux,initrd-start",
87 initrd_start);
88 setprop_cell(fdt, "/chosen", "linux,initrd-end",
89 initrd_start + initrd_size);
90 }
91 }
92
93 if (memcount)
94 setprop(fdt, "/memory", "reg", mem_reg_property, 4*memcount);
95
96 return fdt_pack(fdt);
97}
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index e95a5989602..c2effc91725 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -216,6 +216,104 @@ restart: adr r0, LC0
216 mov r10, r6 216 mov r10, r6
217#endif 217#endif
218 218
219 mov r5, #0 @ init dtb size to 0
220#ifdef CONFIG_ARM_APPENDED_DTB
221/*
222 * r0 = delta
223 * r2 = BSS start
224 * r3 = BSS end
225 * r4 = final kernel address
226 * r5 = appended dtb size (still unknown)
227 * r6 = _edata
228 * r7 = architecture ID
229 * r8 = atags/device tree pointer
230 * r9 = size of decompressed image
231 * r10 = end of this image, including bss/stack/malloc space if non XIP
232 * r11 = GOT start
233 * r12 = GOT end
234 * sp = stack pointer
235 *
236 * if there are device trees (dtb) appended to zImage, advance r10 so that the
237 * dtb data will get relocated along with the kernel if necessary.
238 */
239
240 ldr lr, [r6, #0]
241#ifndef __ARMEB__
242 ldr r1, =0xedfe0dd0 @ sig is 0xd00dfeed big endian
243#else
244 ldr r1, =0xd00dfeed
245#endif
246 cmp lr, r1
247 bne dtb_check_done @ not found
248
249#ifdef CONFIG_ARM_ATAG_DTB_COMPAT
250 /*
251 * OK... Let's do some funky business here.
252 * If we do have a DTB appended to zImage, and we do have
253 * an ATAG list around, we want the later to be translated
254 * and folded into the former here. To be on the safe side,
255 * let's temporarily move the stack away into the malloc
256 * area. No GOT fixup has occurred yet, but none of the
257 * code we're about to call uses any global variable.
258 */
259 add sp, sp, #0x10000
260 stmfd sp!, {r0-r3, ip, lr}
261 mov r0, r8
262 mov r1, r6
263 sub r2, sp, r6
264 bl atags_to_fdt
265
266 /*
267 * If returned value is 1, there is no ATAG at the location
268 * pointed by r8. Try the typical 0x100 offset from start
269 * of RAM and hope for the best.
270 */
271 cmp r0, #1
272 sub r0, r4, #TEXT_OFFSET
273 add r0, r0, #0x100
274 mov r1, r6
275 sub r2, sp, r6
276 blne atags_to_fdt
277
278 ldmfd sp!, {r0-r3, ip, lr}
279 sub sp, sp, #0x10000
280#endif
281
282 mov r8, r6 @ use the appended device tree
283
284 /*
285 * Make sure that the DTB doesn't end up in the final
286 * kernel's .bss area. To do so, we adjust the decompressed
287 * kernel size to compensate if that .bss size is larger
288 * than the relocated code.
289 */
290 ldr r5, =_kernel_bss_size
291 adr r1, wont_overwrite
292 sub r1, r6, r1
293 subs r1, r5, r1
294 addhi r9, r9, r1
295
296 /* Get the dtb's size */
297 ldr r5, [r6, #4]
298#ifndef __ARMEB__
299 /* convert r5 (dtb size) to little endian */
300 eor r1, r5, r5, ror #16
301 bic r1, r1, #0x00ff0000
302 mov r5, r5, ror #8
303 eor r5, r5, r1, lsr #8
304#endif
305
306 /* preserve 64-bit alignment */
307 add r5, r5, #7
308 bic r5, r5, #7
309
310 /* relocate some pointers past the appended dtb */
311 add r6, r6, r5
312 add r10, r10, r5
313 add sp, sp, r5
314dtb_check_done:
315#endif
316
219/* 317/*
220 * Check to see if we will overwrite ourselves. 318 * Check to see if we will overwrite ourselves.
221 * r4 = final kernel address 319 * r4 = final kernel address
@@ -223,15 +321,14 @@ restart: adr r0, LC0
223 * r10 = end of this image, including bss/stack/malloc space if non XIP 321 * r10 = end of this image, including bss/stack/malloc space if non XIP
224 * We basically want: 322 * We basically want:
225 * r4 - 16k page directory >= r10 -> OK 323 * r4 - 16k page directory >= r10 -> OK
226 * r4 + image length <= current position (pc) -> OK 324 * r4 + image length <= address of wont_overwrite -> OK
227 */ 325 */
228 add r10, r10, #16384 326 add r10, r10, #16384
229 cmp r4, r10 327 cmp r4, r10
230 bhs wont_overwrite 328 bhs wont_overwrite
231 add r10, r4, r9 329 add r10, r4, r9
232 ARM( cmp r10, pc ) 330 adr r9, wont_overwrite
233 THUMB( mov lr, pc ) 331 cmp r10, r9
234 THUMB( cmp r10, lr )
235 bls wont_overwrite 332 bls wont_overwrite
236 333
237/* 334/*
@@ -285,14 +382,16 @@ wont_overwrite:
285 * r2 = BSS start 382 * r2 = BSS start
286 * r3 = BSS end 383 * r3 = BSS end
287 * r4 = kernel execution address 384 * r4 = kernel execution address
385 * r5 = appended dtb size (0 if not present)
288 * r7 = architecture ID 386 * r7 = architecture ID
289 * r8 = atags pointer 387 * r8 = atags pointer
290 * r11 = GOT start 388 * r11 = GOT start
291 * r12 = GOT end 389 * r12 = GOT end
292 * sp = stack pointer 390 * sp = stack pointer
293 */ 391 */
294 teq r0, #0 392 orrs r1, r0, r5
295 beq not_relocated 393 beq not_relocated
394
296 add r11, r11, r0 395 add r11, r11, r0
297 add r12, r12, r0 396 add r12, r12, r0
298 397
@@ -307,12 +406,21 @@ wont_overwrite:
307 406
308 /* 407 /*
309 * Relocate all entries in the GOT table. 408 * Relocate all entries in the GOT table.
409 * Bump bss entries to _edata + dtb size
310 */ 410 */
3111: ldr r1, [r11, #0] @ relocate entries in the GOT 4111: ldr r1, [r11, #0] @ relocate entries in the GOT
312 add r1, r1, r0 @ table. This fixes up the 412 add r1, r1, r0 @ This fixes up C references
313 str r1, [r11], #4 @ C references. 413 cmp r1, r2 @ if entry >= bss_start &&
414 cmphs r3, r1 @ bss_end > entry
415 addhi r1, r1, r5 @ entry += dtb size
416 str r1, [r11], #4 @ next entry
314 cmp r11, r12 417 cmp r11, r12
315 blo 1b 418 blo 1b
419
420 /* bump our bss pointers too */
421 add r2, r2, r5
422 add r3, r3, r5
423
316#else 424#else
317 425
318 /* 426 /*
diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h
new file mode 100644
index 00000000000..1f4e71876b0
--- /dev/null
+++ b/arch/arm/boot/compressed/libfdt_env.h
@@ -0,0 +1,15 @@
1#ifndef _ARM_LIBFDT_ENV_H
2#define _ARM_LIBFDT_ENV_H
3
4#include <linux/types.h>
5#include <linux/string.h>
6#include <asm/byteorder.h>
7
8#define fdt16_to_cpu(x) be16_to_cpu(x)
9#define cpu_to_fdt16(x) cpu_to_be16(x)
10#define fdt32_to_cpu(x) be32_to_cpu(x)
11#define cpu_to_fdt32(x) cpu_to_be32(x)
12#define fdt64_to_cpu(x) be64_to_cpu(x)
13#define cpu_to_fdt64(x) cpu_to_be64(x)
14
15#endif
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 832d37236c5..8e2a8fca5ed 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -18,14 +18,9 @@
18 18
19unsigned int __machine_arch_type; 19unsigned int __machine_arch_type;
20 20
21#define _LINUX_STRING_H_
22
23#include <linux/compiler.h> /* for inline */ 21#include <linux/compiler.h> /* for inline */
24#include <linux/types.h> /* for size_t */ 22#include <linux/types.h>
25#include <linux/stddef.h> /* for NULL */
26#include <linux/linkage.h> 23#include <linux/linkage.h>
27#include <asm/string.h>
28
29 24
30static void putstr(const char *ptr); 25static void putstr(const char *ptr);
31extern void error(char *x); 26extern void error(char *x);
@@ -101,41 +96,6 @@ static void putstr(const char *ptr)
101 flush(); 96 flush();
102} 97}
103 98
104
105void *memcpy(void *__dest, __const void *__src, size_t __n)
106{
107 int i = 0;
108 unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src;
109
110 for (i = __n >> 3; i > 0; i--) {
111 *d++ = *s++;
112 *d++ = *s++;
113 *d++ = *s++;
114 *d++ = *s++;
115 *d++ = *s++;
116 *d++ = *s++;
117 *d++ = *s++;
118 *d++ = *s++;
119 }
120
121 if (__n & 1 << 2) {
122 *d++ = *s++;
123 *d++ = *s++;
124 *d++ = *s++;
125 *d++ = *s++;
126 }
127
128 if (__n & 1 << 1) {
129 *d++ = *s++;
130 *d++ = *s++;
131 }
132
133 if (__n & 1)
134 *d++ = *s++;
135
136 return __dest;
137}
138
139/* 99/*
140 * gzip declarations 100 * gzip declarations
141 */ 101 */
diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c
new file mode 100644
index 00000000000..36e53ef9200
--- /dev/null
+++ b/arch/arm/boot/compressed/string.c
@@ -0,0 +1,127 @@
1/*
2 * arch/arm/boot/compressed/string.c
3 *
4 * Small subset of simple string routines
5 */
6
7#include <linux/string.h>
8
9void *memcpy(void *__dest, __const void *__src, size_t __n)
10{
11 int i = 0;
12 unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src;
13
14 for (i = __n >> 3; i > 0; i--) {
15 *d++ = *s++;
16 *d++ = *s++;
17 *d++ = *s++;
18 *d++ = *s++;
19 *d++ = *s++;
20 *d++ = *s++;
21 *d++ = *s++;
22 *d++ = *s++;
23 }
24
25 if (__n & 1 << 2) {
26 *d++ = *s++;
27 *d++ = *s++;
28 *d++ = *s++;
29 *d++ = *s++;
30 }
31
32 if (__n & 1 << 1) {
33 *d++ = *s++;
34 *d++ = *s++;
35 }
36
37 if (__n & 1)
38 *d++ = *s++;
39
40 return __dest;
41}
42
43void *memmove(void *__dest, __const void *__src, size_t count)
44{
45 unsigned char *d = __dest;
46 const unsigned char *s = __src;
47
48 if (__dest == __src)
49 return __dest;
50
51 if (__dest < __src)
52 return memcpy(__dest, __src, count);
53
54 while (count--)
55 d[count] = s[count];
56 return __dest;
57}
58
59size_t strlen(const char *s)
60{
61 const char *sc = s;
62
63 while (*sc != '\0')
64 sc++;
65 return sc - s;
66}
67
68int memcmp(const void *cs, const void *ct, size_t count)
69{
70 const unsigned char *su1 = cs, *su2 = ct, *end = su1 + count;
71 int res = 0;
72
73 while (su1 < end) {
74 res = *su1++ - *su2++;
75 if (res)
76 break;
77 }
78 return res;
79}
80
81int strcmp(const char *cs, const char *ct)
82{
83 unsigned char c1, c2;
84 int res = 0;
85
86 do {
87 c1 = *cs++;
88 c2 = *ct++;
89 res = c1 - c2;
90 if (res)
91 break;
92 } while (c1);
93 return res;
94}
95
96void *memchr(const void *s, int c, size_t count)
97{
98 const unsigned char *p = s;
99
100 while (count--)
101 if ((unsigned char)c == *p++)
102 return (void *)(p - 1);
103 return NULL;
104}
105
106char *strchr(const char *s, int c)
107{
108 while (*s != (char)c)
109 if (*s++ == '\0')
110 return NULL;
111 return (char *)s;
112}
113
114#undef memset
115
116void *memset(void *s, int c, size_t count)
117{
118 char *xs = s;
119 while (count--)
120 *xs++ = c;
121 return s;
122}
123
124void __memzero(void *s, size_t count)
125{
126 memset(s, 0, count);
127}
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index 4e728834a1b..4919f2ac8b8 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -51,6 +51,10 @@ SECTIONS
51 _got_start = .; 51 _got_start = .;
52 .got : { *(.got) } 52 .got : { *(.got) }
53 _got_end = .; 53 _got_end = .;
54
55 /* ensure the zImage file size is always a multiple of 64 bits */
56 /* (without a dummy byte, ld just ignores the empty section) */
57 .pad : { BYTE(0); . = ALIGN(8); }
54 _edata = .; 58 _edata = .;
55 59
56 . = BSS_START; 60 . = BSS_START;