ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/marvell/linux/scripts/xz_wrap.sh b/marvell/linux/scripts/xz_wrap.sh
new file mode 100755
index 0000000..e8feba8
--- /dev/null
+++ b/marvell/linux/scripts/xz_wrap.sh
@@ -0,0 +1,46 @@
+#!/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.
+#
+
+BLOCK_SIZE=2621440
+DICT_SIZE=2097152
+PRESET=6
+
+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 [ "$BCJ" = "--arm" ] && grep -Fq CONFIG_ARM_THUMB=y "$srctree/$KCONFIG_CONFIG"; then
+	BCJ=--armthumb
+fi
+
+:<<EOF
+exec $XZ --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB
+EOF
+
+set -e
+LZMA2OPTS=$LZMA2OPTS,preset=$PRESET,dict=$DICT_SIZE
+
+if [ -n "$TMP_DIR" ]; then
+	export TMPDIR=$TMP_DIR
+fi
+
+TMPF=`mktemp`
+split -b $BLOCK_SIZE - $TMPF.part
+$XZ --check=crc32 $BCJ --lzma2=$LZMA2OPTS $TMPF.part??
+cat $TMPF.part??.xz
+rm -f $TMPF $TMPF.part?? $TMPF.part??.xz