2011-01-12 17:01:22 -08:00
|
|
|
#!/bin/sh
|
2024-07-21 16:36:18 +03:00
|
|
|
# SPDX-License-Identifier: 0BSD
|
2011-01-12 17:01:22 -08:00
|
|
|
#
|
|
|
|
# This is a wrapper for xz to compress the kernel image using appropriate
|
|
|
|
# compression options depending on the architecture.
|
|
|
|
#
|
|
|
|
# Author: Lasse Collin <lasse.collin@tukaani.org>
|
|
|
|
|
|
|
|
BCJ=
|
|
|
|
LZMA2OPTS=
|
|
|
|
|
2012-04-18 19:55:44 +03:00
|
|
|
case $SRCARCH in
|
|
|
|
x86) BCJ=--x86 ;;
|
2011-01-12 17:01:22 -08:00
|
|
|
powerpc) BCJ=--powerpc ;;
|
|
|
|
arm) BCJ=--arm ;;
|
|
|
|
sparc) BCJ=--sparc ;;
|
|
|
|
esac
|
|
|
|
|
2024-07-21 16:36:28 +03:00
|
|
|
# Use single-threaded mode because it compresses a little better
|
|
|
|
# (and uses less RAM) than multithreaded mode.
|
|
|
|
#
|
|
|
|
# For the best compression, the dictionary size shouldn't be
|
|
|
|
# smaller than the uncompressed kernel. 128 MiB dictionary
|
|
|
|
# needs less than 1400 MiB of RAM in single-threaded mode.
|
|
|
|
#
|
|
|
|
# On the archs that use this script to compress the kernel,
|
|
|
|
# decompression in the preboot code is done in single-call mode.
|
|
|
|
# Thus the dictionary size doesn't affect the memory requirements
|
|
|
|
# of the preboot decompressor at all.
|
|
|
|
exec $XZ --check=crc32 --threads=1 $BCJ --lzma2=$LZMA2OPTS,dict=128MiB
|