Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/

authored by

Antony Pavlov and committed by
Ralf Baechle
dc4d7b37 dfe0924e

+30 -24
+2 -2
arch/mips/boot/compressed/Makefile
··· 27 27 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ 28 28 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) 29 29 30 - targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o 30 + targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o 31 31 32 32 # decompressor objects (linked with vmlinuz) 33 - vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o 33 + vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o 34 34 35 35 ifdef CONFIG_DEBUG_ZBOOT 36 36 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
-22
arch/mips/boot/compressed/decompress.c
··· 43 43 /* activate the code for pre-boot environment */ 44 44 #define STATIC static 45 45 46 - #if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ) || \ 47 - defined(CONFIG_KERNEL_LZ4) 48 - void *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 46 #ifdef CONFIG_KERNEL_GZIP 60 47 #include "../../../../lib/decompress_inflate.c" 61 48 #endif 62 49 63 50 #ifdef CONFIG_KERNEL_BZIP2 64 - void *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 51 #include "../../../../lib/decompress_bunzip2.c" 74 52 #endif 75 53
+28
arch/mips/boot/compressed/string.c
··· 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 + 9 + void *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 + 20 + void *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 + }