From 7c984de699951ef610158fce0dd6371f22eccb93 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 8 May 2019 19:16:26 +0100 Subject: [PATCH] make.sh: Mount /usr/src in memory for faster build This patch enables that /usr/src is a ramdisk which should give us fewer I/O operations when extracting tarballs or writing small intermediate files by the compiler. In some virtualised environments this should bring a good performance boost. There is no persistent data stored in this directory and some persistent directories are mounted over it. Signed-off-by: Michael Tremer --- make.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/make.sh b/make.sh index bfcc83709f..8c998ef87c 100755 --- a/make.sh +++ b/make.sh @@ -39,6 +39,8 @@ GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8) # Last commit TOOLCHAINVER=20181030 +ENABLE_RAMDISK="on" + ############################################################################### # # Beautifying variables & presentation & input output interface @@ -281,6 +283,7 @@ stdumount() { umount $BASEDIR/build/usr/src/lfs 2>/dev/null; umount $BASEDIR/build/usr/src/log 2>/dev/null; umount $BASEDIR/build/usr/src/src 2>/dev/null; + umount $BASEDIR/build/usr/src 2>/dev/null; } now() { @@ -468,6 +471,12 @@ prepareenv() { mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys} mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null + + if [ "${ENABLE_RAMDISK}" = "on" ]; then + mkdir -p $BASEDIR/build/usr/src + mount -t tmpfs tmpfs -o size=4G,mode=1777 $BASEDIR/build/usr/src + fi + mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache} mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null -- 2.39.2