Skip to content

Commit

Permalink
MIPS: ZBOOT: Support XZ compression scheme
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ffainelli authored and ralfbaechle committed Oct 29, 2013
1 parent 26fca83 commit 4e23eb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,7 @@ config SYS_SUPPORTS_ZBOOT
select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ

config SYS_SUPPORTS_ZBOOT_UART16550
bool
Expand Down
5 changes: 5 additions & 0 deletions arch/mips/boot/compressed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
endif

ifdef CONFIG_KERNEL_XZ
vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o
endif

targets += vmlinux.bin
OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
Expand All @@ -46,6 +50,7 @@ tool_$(CONFIG_KERNEL_GZIP) = gzip
tool_$(CONFIG_KERNEL_BZIP2) = bzip2
tool_$(CONFIG_KERNEL_LZMA) = lzma
tool_$(CONFIG_KERNEL_LZO) = lzo
tool_$(CONFIG_KERNEL_XZ) = xzkern

targets += vmlinux.bin.z
$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
Expand Down
8 changes: 7 additions & 1 deletion arch/mips/boot/compressed/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void error(char *x)
/* activate the code for pre-boot environment */
#define STATIC static

#ifdef CONFIG_KERNEL_GZIP
#if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ)
void *memcpy(void *dest, const void *src, size_t n)
{
int i;
Expand All @@ -54,6 +54,8 @@ void *memcpy(void *dest, const void *src, size_t n)
d[i] = s[i];
return dest;
}
#endif
#ifdef CONFIG_KERNEL_GZIP
#include "../../../../lib/decompress_inflate.c"
#endif

Expand All @@ -78,6 +80,10 @@ void *memset(void *s, int c, size_t n)
#include "../../../../lib/decompress_unlzo.c"
#endif

#ifdef CONFIG_KERNEL_XZ
#include "../../../../lib/decompress_unxz.c"
#endif

void decompress_kernel(unsigned long boot_heap_start)
{
unsigned long zimage_start, zimage_size;
Expand Down

0 comments on commit 4e23eb6

Please sign in to comment.