From: Michael Tremer Date: Tue, 7 Nov 2017 14:23:59 +0000 (+0100) Subject: make.sh: Determine how much memory the build host has X-Git-Tag: v2.19-core117~1^2~99 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=5190eea24f9822a63dc5d06d214b48f973b14f29 make.sh: Determine how much memory the build host has Signed-off-by: Michael Tremer --- diff --git a/make.sh b/make.sh index 11be8465ec..948a24d390 100755 --- a/make.sh +++ b/make.sh @@ -65,6 +65,9 @@ mkdir $BASEDIR/log/ 2>/dev/null # Include funtions . tools/make-functions +# Get the amount of memory in this build system +HOST_MEM=$(system_memory) + if [ -f .config ]; then . .config fi diff --git a/tools/make-functions b/tools/make-functions index b419253fa8..3b878fb000 100644 --- a/tools/make-functions +++ b/tools/make-functions @@ -60,6 +60,20 @@ WARN="\\033[1;35m" FAIL="\\033[1;31m" NORMAL="\\033[0;39m" +system_memory() { + local key val unit + + while read -r key val unit; do + case "${key}" in + MemTotal:*) + # Convert to MB + echo "$(( ${val} / 1024 ))" + break + ;; + esac + done < /proc/meminfo +} + configure_build() { local build_arch="${1}"