]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
make.sh: Mount /usr/src in memory for faster build
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 May 2019 18:16:26 +0000 (19:16 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 May 2019 03:55:49 +0000 (04:55 +0100)
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 <michael.tremer@ipfire.org>
make.sh

diff --git a/make.sh b/make.sh
index bfcc83709fb1d4917562b34eee33d3fe72a1d02b..8c998ef87c8f10b7d1faf7afea136e903fb0d790 100755 (executable)
--- 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