]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - make.sh
make.sh: Remove check for minimum host memory
[ipfire-2.x.git] / make.sh
diff --git a/make.sh b/make.sh
index 419f9fa95faf2fd17b9b7a73ae1a88a55e778bda..703ce0c4871aa359d3a31f4d8a5e70b59523ba0d 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -526,6 +526,7 @@ enterchroot() {
                CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
                CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
                KVER="${KVER}" \
+               XZ_OPT="${XZ_OPT}" \
                $(fake_environ) \
                $(qemu_environ) \
                "$@"
@@ -860,6 +861,20 @@ fi
 # Get the amount of memory in this build system
 HOST_MEM=$(system_memory)
 
+# We compress archives with "xz -8", using all cores and up to 70% of memory
+XZ_MEM=$(( HOST_MEM * 7 / 10 ))
+
+# XZ memory cannot be larger than 2GB on 32 bit systems
+case "${HOST_ARCH}" in
+       i*86|armv*)
+               if [ ${XZ_MEM} -gt 2048 ]; then
+                       XZ_MEM=2048
+               fi
+               ;;
+esac
+
+XZ_OPT="-T0 -8 --memory=${XZ_MEM}MiB"
+
 if [ -n "${BUILD_ARCH}" ]; then
        configure_build "${BUILD_ARCH}"
 else
@@ -1557,7 +1572,7 @@ buildpackages() {
        lfsmake2 flash-images
   fi
 
-  mv $LFS/install/images/{*.iso,*.tgz,*.img.gz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
+  mv $LFS/install/images/{*.iso,*.tgz,*.img.xz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
 
   ipfirepackages
 
@@ -1760,7 +1775,7 @@ toolchain)
        buildtoolchain
        echo "`date -u '+%b %e %T'`: Create toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
        test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
-       cd $BASEDIR && XZ_OPT="-T0 -8" tar -Jc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
+       cd $BASEDIR && XZ_OPT="$(XZ_OPT)" tar -Jc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz --xz \
                build/${TOOLS_DIR} build/bin/sh log >> $LOGFILE
        md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
                > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5