Files
twx-linux/scripts/xz_wrap.sh
Jubin Zhong 83c382f436 FROMLIST: kbuild: Enable armthumb BCJ filter for Thumb-2 kernel
xz_wrap.sh use $SRCARCH to detect the BCJ filter. However, assigning
arm BCJ filter to Thumb-2 kernel is not optimal. In my case, about 5%
decrease of image size is observed with armthumb BCJ filter:

Test results:
  hardware:      QEMU emulator version 3.1.0
  config:        vexpress_defconfig with THUMB2_KERNEL & KERNEL_XZ on
  arm BCJ:       4029808
  armthumb BCJ:  3827280

Choose armthumb BCJ filter for Thumb-2 kernel to make smaller images.

Signed-off-by: Jubin Zhong <zhongjubin@huawei.com>

Link: https://lore.kernel.org/lkml/1637323647-19988-1-git-send-email-zhongjubin@huawei.com/
Change-Id: I23c6e0fd2e54fdc84e78f122d6f4f06e54026696
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2022-02-22 15:04:18 +08:00

30 lines
653 B
Bash
Executable File

#!/bin/sh
#
# 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>
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
. include/config/auto.conf
BCJ=
LZMA2OPTS=
case $SRCARCH in
x86) BCJ=--x86 ;;
powerpc) BCJ=--powerpc ;;
ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;;
arm) BCJ=--arm ;;
sparc) BCJ=--sparc ;;
esac
if [ -n "${CONFIG_THUMB2_KERNEL}" ]; then
BCJ=--armthumb
fi
exec $XZ --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB