aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Labastie <pierre.labastie@neuf.fr>2023-11-15 18:19:14 +0100
committerPierre Labastie <pierre.labastie@neuf.fr>2023-11-15 18:24:22 +0100
commitcacc6c5433c5c2e2b52eee16cb88f661899a2a6f (patch)
treeb0460078b07cd2c2ea524d9a6a0e5e6b3ef32272
parent63190e6547cbe5f05d6f3db106f8ed81bd730b0c (diff)
Allow users to pass a cpuset
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.
-rw-r--r--LFS/master.sh11
-rw-r--r--common/libs/func_wrt_Makefile1
-rwxr-xr-xjhalfs2
3 files changed, 13 insertions, 1 deletions
diff --git a/LFS/master.sh b/LFS/master.sh
index d28b5cbad8..8402fc137b 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 78bb3e1970..c694e760b4 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 fe2c30cb70..9f2518c69b 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/"