summaryrefslogtreecommitdiff
path: root/arch/mips/boot/compressed/string.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2020-09-01 16:26:51 +0200
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-09-03 10:13:24 +0200
commita510b616131f85215ba156ed67e5ed1c0701f80f (patch)
tree48a1c75c75ee4d4fb7633feba8b52ab8ef0752ae /arch/mips/boot/compressed/string.c
parent1c4dd334df3a0627ff57b35612057e2b497e373b (diff)
MIPS: Add support for ZSTD-compressed kernels
Add support for self-extracting kernels with a ZSTD compression. Tested on a kernel for the GCW-Zero, it allows to reduce the size of the kernel file from 4.1 MiB with gzip to 3.5 MiB with ZSTD, and boots just as fast. Compressed kernels are now also compiled with -D__DISABLE_EXPORTS in order to disable the EXPORT_SYMBOL() macros inside of lib/zstd/decompress.c. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/boot/compressed/string.c')
-rw-r--r--arch/mips/boot/compressed/string.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
index 43beecc3587c..0b593b709228 100644
--- a/arch/mips/boot/compressed/string.c
+++ b/arch/mips/boot/compressed/string.c
@@ -5,6 +5,7 @@
* Very small subset of simple string routines
*/
+#include <linux/compiler_attributes.h>
#include <linux/types.h>
void *memcpy(void *dest, const void *src, size_t n)
@@ -27,3 +28,19 @@ void *memset(void *s, int c, size_t n)
ss[i] = c;
return s;
}
+
+void * __weak memmove(void *dest, const void *src, size_t n)
+{
+ unsigned int i;
+ const char *s = src;
+ char *d = dest;
+
+ if ((uintptr_t)dest < (uintptr_t)src) {
+ for (i = 0; i < n; i++)
+ d[i] = s[i];
+ } else {
+ for (i = n; i > 0; i--)
+ d[i - 1] = s[i - 1];
+ }
+ return dest;
+}