aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/boot/compressed/decompress.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-03MIPS: Add support for ZSTD-compressed kernelsPaul Cercueil1-0/+4
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 <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-05zboot: fix stack protector in compressed boot phaseHuacai Chen1-8/+1
Calling __stack_chk_guard_setup() in decompress_kernel() is too late that stack checking always fails for decompress_kernel() itself. So remove __stack_chk_guard_setup() and initialize __stack_chk_guard before we call decompress_kernel(). Original code comes from ARM but also used for MIPS and SH, so fix them together. If without this fix, compressed booting of these archs will fail because stack checking is enabled by default (>=4.16). Link: http://lkml.kernel.org/r/[email protected] Fixes: 8779657d29c0 ("stackprotector: Introduce CONFIG_CC_STACKPROTECTOR_STRONG") Signed-off-by: Huacai Chen <[email protected]> Acked-by: James Hogan <[email protected]> Acked-by: Kees Cook <[email protected]> Acked-by: Rich Felker <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Russell King <[email protected]> Cc: Yoshinori Sato <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-08-02MIPS: ZBOOT: copy appended dtb to the end of the kernelJonas Gorski1-0/+17
Instead of rewriting the arguments, just move the appended dtb to where the decompressed kernel expects it. This eliminates the need for special casing vmlinuz.bin appended dtb files. Signed-off-by: Jonas Gorski <[email protected]> Cc: Kevin Cernekee <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: John Crispin <[email protected]> Cc: Paul Burton <[email protected]> Cc: James Hogan <[email protected]> Cc: Alban Bedel <[email protected]> Cc: Daniel Gimpelevich <[email protected]> Cc: Antony Pavlov <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/13698/ Signed-off-by: Ralf Baechle <[email protected]>
2015-09-10lib/decompressors: use real out buf size for gunzip with kernelYinghai Lu1-2/+2
When loading x86 64bit kernel above 4GiB with patched grub2, got kernel gunzip error. | early console in decompress_kernel | decompress_kernel: | input: [0x807f2143b4-0x807ff61aee] | output: [0x807cc00000-0x807f3ea29b] 0x027ea29c: output_len | boot via startup_64 | KASLR using RDTSC... | new output: [0x46fe000000-0x470138cfff] 0x0338d000: output_run_size | decompress: [0x46fe000000-0x47007ea29b] <=== [0x807f2143b4-0x807ff61aee] | | Decompressing Linux... gz... | | uncompression error | | -- System halted the new buffer is at 0x46fe000000ULL, decompressor_gzip is using 0xffffffb901ffffff as out_len. gunzip in lib/zlib_inflate/inflate.c cap that len to 0x01ffffff and decompress fails later. We could hit this problem with crashkernel booting that uses kexec loading kernel above 4GiB. We have decompress_* support: 1. inbuf[]/outbuf[] for kernel preboot. 2. inbuf[]/flush() for initramfs 3. fill()/flush() for initrd. This bug only affect kernel preboot path that use outbuf[]. Add __decompress and take real out_buf_len for gunzip instead of guessing wrong buf size. Fixes: 1431574a1c4 (lib/decompressors: fix "no limit" output buffer length) Signed-off-by: Yinghai Lu <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Jon Medhurst <[email protected]> Cc: Stephen Warren <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2015-04-02MIPS: Reduce kernel image size for !CONFIG_DEBUG_ZBOOTWu Zhangjin1-0/+5
!CONFIG_DEBUG_ZBOOT doesn't need puts() and puthex(), remove them and the corrospindig strings for !CONFIG_DEBUG_ZBOOT, as a result, it saves about 1280 bytes. [[email protected]: Resolved reject.] Signed-off-by: Wu Zhangjin <[email protected]> Cc: [email protected] Cc: Wu Zhangjin <[email protected]> Patchwork: https://patchwork.linux-mips.org/patch/1898/ Signed-off-by: Ralf Baechle <[email protected]>
2014-08-26MIPS: ZBOOT: add missing <linux/string.h> includeAurelien Jarno1-0/+1
Commit dc4d7b37 (MIPS: ZBOOT: gather string functions into string.c) moved the string related functions into a separate file, which might cause the following build error, depending on the configuration: | CC arch/mips/boot/compressed/decompress.o | In file included from linux/arch/mips/boot/compressed/../../../../lib/decompress_unxz.c:234:0, | from linux/arch/mips/boot/compressed/decompress.c:67: | linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_stream.c: In function 'fill_temp': | linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_stream.c:162:2: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration] | cc1: some warnings being treated as errors | linux/scripts/Makefile.build:308: recipe for target 'arch/mips/boot/compressed/decompress.o' failed | make[6]: *** [arch/mips/boot/compressed/decompress.o] Error 1 | linux/arch/mips/Makefile:308: recipe for target 'vmlinuz' failed It does not fail with the standard configuration, as when CONFIG_DYNAMIC_DEBUG is not enabled <linux/string.h> gets included in include/linux/dynamic_debug.h. There might be other ways for it to get indirectly included. We can't add the include directly in xz_dec_stream.c as some architectures might want to use a different version for the boot/ directory (see for example arch/x86/boot/string.h). Signed-off-by: Aurelien Jarno <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/7420/ Signed-off-by: Ralf Baechle <[email protected]>
2014-08-02MIPS: ZBOOT: implement stack protector in compressed boot phaseBen Chan1-0/+14
This patch implements the stack protector code in MIPS compressed boot phase based on the same code added to arm in commit 8779657d29c0ebcc0c94ede4df2f497baf1b563f "stackprotector: Introduce CONFIG_CC_STACKPROTECTOR_STRONG" by Kees Cook <[email protected]> Signed-off-by: Ben Chan <[email protected]> Cc: Kees Cook <[email protected]> Cc: Olof Johansson <[email protected]> Reviewed-by: Kees Cook <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/7175/ Signed-off-by: Ralf Baechle <[email protected]>
2014-01-24MIPS: ZBOOT: gather string functions into string.cAntony Pavlov1-22/+0
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 <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Cc: [email protected] Cc: Ralf Baechle <[email protected]> Cc: John Crispin <[email protected]> Cc: Florian Fainelli <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: John Crispin <[email protected]> Patchwork: http://patchwork.linux-mips.org/patch/6344/
2013-10-29MIPS: ZBOOT: Support LZ4 compression schemeFlorian Fainelli1-1/+6
Add support for the LZ4 compression scheme in the ZBOOT decompression stub, in order to support it we need to: - select the "lz4" compression tool to compress the vmlinux.bin payload - memcpy() is also required for decompress_unlz4.c so we share the implementation between GZIP, XZ and now LZ4 Signed-off-by: Florian Fainelli <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/5829/ Signed-off-by: Ralf Baechle <[email protected]>
2013-10-29MIPS: ZBOOT: Support XZ compression schemeFlorian Fainelli1-1/+7
Add support for the XZ compression scheme in the ZBOOT decompression stub, in order to support it we need to: - select the "xzkern" compression tool to compress the vmlinux.bin payload - link with ashldi3.o for xz_dec_run() to work - memcpy() is also required for decompress_unxz.c so we share the implementation between GZIP and XZ Signed-off-by: Florian Fainelli <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/5818/ Signed-off-by: Ralf Baechle <[email protected]>
2013-02-01MIPS: Whitespace cleanup.Ralf Baechle1-2/+2
Having received another series of whitespace patches I decided to do this once and for all rather than dealing with this kind of patches trickling in forever. Signed-off-by: Ralf Baechle <[email protected]>
2010-08-05MIPS: Clean up arch/mips/boot/compressed/decompress.cWu Zhangjin1-24/+14
- Remove several outdated comments - Clearify the definition of zimage_start and zimage_size and the their usage Signed-off-by: Wu Zhangjin <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/1382/ Signed-off-by: Ralf Baechle <[email protected]>
2010-02-27MIPS: Loongson: Change the Email address of Wu ZhangjinWu Zhangjin1-2/+2
Currently [email protected] is not usable; change it to [email protected]. Signed-off-by: Wu Zhangjin <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Patchwork: http://patchwork.linux-mips.org/patch/829/ Signed-off-by: Ralf Baechle <[email protected]>
2010-01-28MIPS: Add support of LZO-compressed kernelsWu Zhangjin1-0/+4
The necessary changes to the x86 Kconfig and boot/compressed to allow the use of this new compression method. Signed-off-by: Wu Zhangjin <[email protected]> Cc: [email protected] Cc: Sergei Shtylyov <[email protected]> Patchwork: http://patchwork.linux-mips.org/patch/857/ Signed-off-by: Ralf Baechle <[email protected]>
2010-01-12MIPS: Cleanup and Fixup of compressed kernel supportWu Zhangjin1-10/+0
o Remove the .initrd section. The initrd section was already handled when vmlinux was linked. o Discard .MIPS.options, .options, .pdr, .reginfo, .comment and .note sections. If .MIPS.options is not removed, kernels compiled with gcc 3.4.6 will not boot. o Clean up the file format. o Remove several other unneeded sections. Tested with GCC 3.4.6 and 4.4.1 with and without initrd. Signed-off-by: Wu Zhangjin <[email protected]> Cc: [email protected] Patchwork: http://patchwork.linux-mips.org/patch/785/ Signed-off-by: Ralf Baechle <[email protected]>
2009-12-17MIPS: Add support for GZIP / BZIP2 / LZMA compressed kernel imagesWu Zhangjin1-0/+126
This patch helps to generate smaller kernel images for linux-MIPS, Here is the effect when using lzma: $ ls -sh vmlinux 7.1M vmlinux $ ls -sh vmlinuz 1.5M vmlinuz Have tested the 32bit kernel on Qemu/Malta and 64bit kernel on FuLoong Mini PC. both of them work well. and also, tested by Alexander Clouter on an AR7 based Linksys WAG54Gv2, and by Manuel Lauss on an Alchemy board. This -v2 version incorporate the feedback from Ralf, and add the following changes: 1. add .ecoff, .bin, .erec format support 2. only enable it and the debug source code for the machines we tested 3. a dozen of fixups and cleanups and if you want to enable it for your board, please try to select SYS_SUPPORTS_ZBOOT for it, and if the board have an 16550 compatible uart, you can select SYS_SUPPORTS_ZBOOT_UART16550 directly. and then sending the relative patches to Ralf. Tested-by: Manuel Lauss <[email protected]> Tested-by: Alexander Clouter <[email protected]> Signed-off-by: Wu Zhangjin <[email protected]> Signed-off-by: Ralf Baechle <[email protected]>