SNAME="ipfire" # Short name
# If you update the version don't forget to update backupiso and add it to core update
VERSION="2.25" # Version number
SNAME="ipfire" # Short name
# If you update the version don't forget to update backupiso and add it to core update
VERSION="2.25" # Version number
SLOGAN="www.ipfire.org" # Software slogan
CONFIG_ROOT=/var/ipfire # Configuration rootdir
MAX_RETRIES=1 # prefetch/check loop
SLOGAN="www.ipfire.org" # Software slogan
CONFIG_ROOT=/var/ipfire # Configuration rootdir
MAX_RETRIES=1 # prefetch/check loop
GIT_TAG="$(git tag | tail -1)" # Git Tag
GIT_LASTCOMMIT="$(git rev-parse --verify HEAD)" # Last commit
GIT_TAG="$(git tag | tail -1)" # Git Tag
GIT_LASTCOMMIT="$(git rev-parse --verify HEAD)" # Last commit
# 128MB of memory. Therefore we find out how
# many processes fit into memory.
local mem_max=$(( ${SYSTEM_MEMORY} / 128 ))
# 128MB of memory. Therefore we find out how
# many processes fit into memory.
local mem_max=$(( ${SYSTEM_MEMORY} / 128 ))
mkdir -p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev/null
mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null
mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
mkdir -p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev/null
mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null
mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
mount --bind /proc $BASEDIR/build/proc
mount --bind /sys $BASEDIR/build/sys
mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
mount --bind /proc $BASEDIR/build/proc
mount --bind /sys $BASEDIR/build/sys
mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
# Run LFS static binary creation scripts one by one
export CCACHE_DIR=$BASEDIR/ccache
export CCACHE_TEMPDIR="/tmp"
# Run LFS static binary creation scripts one by one
export CCACHE_DIR=$BASEDIR/ccache
export CCACHE_TEMPDIR="/tmp"
export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
# Remove pre-install list of installed files in case user erase some files before rebuild
export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
# Remove pre-install list of installed files in case user erase some files before rebuild
BUILD_PLATFORM="${BUILD_PLATFORM}" \
CCACHE_DIR=/usr/src/ccache \
CCACHE_TEMPDIR="${CCACHE_TEMPDIR}" \
BUILD_PLATFORM="${BUILD_PLATFORM}" \
CCACHE_DIR=/usr/src/ccache \
CCACHE_TEMPDIR="${CCACHE_TEMPDIR}" \
#only restore on a clean disk
if [ ! -e "${BASEDIR}/build${TOOLS_DIR}/.toolchain-successful" ]; then
if [ ! -n "$PACKAGE" ]; then
#only restore on a clean disk
if [ ! -e "${BASEDIR}/build${TOOLS_DIR}/.toolchain-successful" ]; then
if [ ! -n "$PACKAGE" ]; then
print_build_stage "Packaged toolchain compilation"
if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
tar axf $PACKAGE
print_build_stage "Packaged toolchain compilation"
if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
tar axf $PACKAGE
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
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 && tar -cf- --exclude='log/_build.*.log' build/${TOOLS_DIR} build/bin/sh log | xz ${XZ_OPT} \
- > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz
- md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
+ cd $BASEDIR && tar -cf- --exclude='log/_build.*.log' build/${TOOLS_DIR} build/bin/sh log \
+ | zstd ${ZSTD_OPT} > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.zst
+ md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.zst \
> cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
stdumount
;;
gettoolchain)
# arbitrary name to be updated in case of new toolchain package upload
PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
> cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
stdumount
;;
gettoolchain)
# arbitrary name to be updated in case of new toolchain package upload
PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
echo "`date -u '+%b %e %T'`: Load toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
cd $BASEDIR/cache/toolchains
URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
echo "`date -u '+%b %e %T'`: Load toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
cd $BASEDIR/cache/toolchains
echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
else
exiterror "$PACKAGE.md5 did not match, check downloaded package"
echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
else
exiterror "$PACKAGE.md5 did not match, check downloaded package"