Nimbin[12]?Mirrors & Forks / jhalfs / commits / cacc6c5

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

Allow users to pass a cpuset

Pierre Labastie · 2023-11-15 17:19 · cacc6c5433c5c2e2b52eee16cb88f661899a2a6f

If using a new book, MAKEFLAGS is set to -j$(nproc), so that if
we want to easure timings with 4 processors and our computer has
more than that, we need to restrict the number of processors.
Jhalfs allows to do that using th cpuset cgroup controller, so that
it only restrits the make job and not the whole machine. For that
use a small scripts written by Xi Ruoyao that restarts make this
the cpuset set.
 LFS/master.sh                 | 11 +++++++++++
 common/libs/func_wrt_Makefile |  1 +
 jhalfs                        |  2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/LFS/master.sh b/LFS/master.sh
index d28b5cb..8402fc1 100644
--- a/LFS/master.sh
+++ b/LFS/master.sh
@@ -302,6 +302,17 @@ build_Makefile() {           #
     i=`expr $i + 1`
   done
 
+  # If CPUSET is defined and not equal to "all", then we define a first target
+  # that calls a script which re-enters make calling target all
+  if [ -n "$CPUSET" ] && [ "$CPUSET" != all ]; then
+(
+    cat << EOF
+
+all-with-cpuset:
+	@CPUSPEC="\$(CPUSET)" ./run-in-cgroup \$(MAKE) all
+EOF
+) >> $MKFILE
+  fi
   # Drop in the main target 'all:' and the chapter targets with each sub-target
   # as a dependency. Also prevent running targets in parallel.
 (
diff --git a/common/libs/func_wrt_Makefile b/common/libs/func_wrt_Makefile
index 78bb3e1..c694e76 100644
--- a/common/libs/func_wrt_Makefile
+++ b/common/libs/func_wrt_Makefile
@@ -44,6 +44,7 @@ ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
 ADD_BLFS_TOOLS   = $BLFS_TOOL
 PKGMNGT          = $PKGMNGT
 WRAP_INSTALL     = $WRAP_INSTALL
+CPUSET           = $CPUSET
 
 
 export PATH := \${PATH}:/usr/sbin
diff --git a/jhalfs b/jhalfs
index fe2c30c..9f2518c 100755
--- a/jhalfs
+++ b/jhalfs
@@ -323,7 +323,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
   true >"$LOGDIR/$LOG"
 
 # Copy common helper files
-  cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh} "$JHALFSDIR/"
+  cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh,run-in-cgroup.sh} "$JHALFSDIR/"
 
 # Copy needed stylesheets
   cp "$COMMON_DIR"/{packages.xsl,chroot.xsl,kernfs.xsl} "$JHALFSDIR/"