diff options
author | Pierre Labastie <pierre.labastie@neuf.fr> | 2023-11-15 18:19:14 +0100 |
---|---|---|
committer | Pierre Labastie <pierre.labastie@neuf.fr> | 2023-11-15 18:24:22 +0100 |
commit | cacc6c5433c5c2e2b52eee16cb88f661899a2a6f (patch) | |
tree | b0460078b07cd2c2ea524d9a6a0e5e6b3ef32272 | |
parent | 63190e6547cbe5f05d6f3db106f8ed81bd730b0c (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.sh | 11 | ||||
-rw-r--r-- | common/libs/func_wrt_Makefile | 1 | ||||
-rwxr-xr-x | jhalfs | 2 |
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 @@ -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/" |