aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/boot/compressed
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2014-01-13 16:30:56 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-01-24 16:39:55 -0500
commitdc4d7b377c1e07918eeca704477851ddef37d472 (patch)
treea226fa149119644a56db94840dc334c08d7bf746 /arch/mips/boot/compressed
parentdfe0924ebd0a3c9c0ecc2740a6b540c9adfc2d60 (diff)
MIPS: ZBOOT: gather string functions into string.c
In the worst case this adds less then 128 bytes of code but on the other hand this makes code organization more clear. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Cc: linux-mips@linux-mips.org Cc: Ralf Baechle <ralf@linux-mips.org> Cc: John Crispin <blogic@openwrt.org> Cc: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: John Crispin <blogic@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/6344/
Diffstat (limited to 'arch/mips/boot/compressed')
-rw-r--r--arch/mips/boot/compressed/Makefile4
-rw-r--r--arch/mips/boot/compressed/decompress.c22
-rw-r--r--arch/mips/boot/compressed/string.c28
3 files changed, 30 insertions, 24 deletions
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index ca0c343c9ea5..61af6b6ab13d 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -27,10 +27,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
27 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ 27 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
28 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) 28 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
29 29
30targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o 30targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
31 31
32# decompressor objects (linked with vmlinuz) 32# decompressor objects (linked with vmlinuz)
33vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o 33vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o
34 34
35ifdef CONFIG_DEBUG_ZBOOT 35ifdef CONFIG_DEBUG_ZBOOT
36vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o 36vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index a8c6fd6a4406..c00c4ddf4514 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -43,33 +43,11 @@ void error(char *x)
43/* activate the code for pre-boot environment */ 43/* activate the code for pre-boot environment */
44#define STATIC static 44#define STATIC static
45 45
46#if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ) || \
47 defined(CONFIG_KERNEL_LZ4)
48void *memcpy(void *dest, const void *src, size_t n)
49{
50 int i;
51 const char *s = src;
52 char *d = dest;
53
54 for (i = 0; i < n; i++)
55 d[i] = s[i];
56 return dest;
57}
58#endif
59#ifdef CONFIG_KERNEL_GZIP 46#ifdef CONFIG_KERNEL_GZIP
60#include "../../../../lib/decompress_inflate.c" 47#include "../../../../lib/decompress_inflate.c"
61#endif 48#endif
62 49
63#ifdef CONFIG_KERNEL_BZIP2 50#ifdef CONFIG_KERNEL_BZIP2
64void *memset(void *s, int c, size_t n)
65{
66 int i;
67 char *ss = s;
68
69 for (i = 0; i < n; i++)
70 ss[i] = c;
71 return s;
72}
73#include "../../../../lib/decompress_bunzip2.c" 51#include "../../../../lib/decompress_bunzip2.c"
74#endif 52#endif
75 53
diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
new file mode 100644
index 000000000000..9de9885acd0d
--- /dev/null
+++ b/arch/mips/boot/compressed/string.c
@@ -0,0 +1,28 @@
1/*
2 * arch/mips/boot/compressed/string.c
3 *
4 * Very small subset of simple string routines
5 */
6
7#include <linux/types.h>
8
9void *memcpy(void *dest, const void *src, size_t n)
10{
11 int i;
12 const char *s = src;
13 char *d = dest;
14
15 for (i = 0; i < n; i++)
16 d[i] = s[i];
17 return dest;
18}
19
20void *memset(void *s, int c, size_t n)
21{
22 int i;
23 char *ss = s;
24
25 for (i = 0; i < n; i++)
26 ss[i] = c;
27 return s;
28}