aboutsummaryrefslogtreecommitdiffstats
path: root/chapter04/settingenviron.xml
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-11-14 00:27:17 +0800
committerXi Ruoyao <xry111@xry111.site>2023-11-14 00:27:17 +0800
commit7a72a22f9ba2c4e665dc4eefec60bc588ab57673 (patch)
tree43d1349bcc25af69d3bc05fe418bf7a77ea37322 /chapter04/settingenviron.xml
parent1780e72d8d14621ffe3aaea89678d2eb93a63bf1 (diff)
parente07c41946983e891b283482c294ed748494c2578 (diff)
Merge tag 'xry111/update-20231113' into trunk
There are some suspicious "nptl/tst-robust" test failures in Glibc, but all other test results are clean. To be diagnosed... And note that jhalfs needs an update to work with the merged parallelism changes.
Diffstat (limited to 'chapter04/settingenviron.xml')
-rw-r--r--chapter04/settingenviron.xml49
1 files changed, 49 insertions, 0 deletions
diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml
index b255a4b45..2d8d6045f 100644
--- a/chapter04/settingenviron.xml
+++ b/chapter04/settingenviron.xml
@@ -195,6 +195,55 @@ EOF</userinput></screen>
completed LFS system.</para>
</important>
+ <para>
+ For many modern systems with multiple processors (or cores) the
+ compilation time for a package can be reduced by performing a "parallel
+ make" by telling the make program how many processors are available via
+ a command line option or an environment variable. For instance, an Intel
+ Core i9-13900K processor has 8 P (performance) cores and
+ 16 E (efficiency) cores, and a P core can simultaneously run two threads
+ so each P core are modeled as two logical cores by the Linux kernel.
+ As the result there are 32 logical cores in total. One obvious way to
+ use all these logical cores is allowing <command>make</command> to spawn
+ up to 32 build jobs. This can be done by passing the
+ <parameter>-j32</parameter> option to <command>make</command>:
+ </para>
+
+ <screen role='nodump'><userinput>make -j32</userinput></screen>
+
+ <para>
+ Or set the <envar>MAKEFLAGS</envar> environment variable and its
+ content will be automatically used by <command>make</command> as
+ command line options:
+ </para>
+
+ <screen role='nodump'><userinput>export MAKEFLAGS=-j32</userinput></screen>
+
+ <important>
+ <para>
+ Never pass a <parameter>-j</parameter> option without a number to
+ <command>make</command> or set such an option in
+ <envar>MAKEFLAGS</envar>. Doing so will allow <command>make</command>
+ to spawn infinite build jobs and cause system stability issue.
+ </para>
+ </important>
+
+ <para>
+ To use all logical cores available for building packages in
+ <xref linkend='chapter-cross-tools'/> and
+ <xref linkend='chapter-temporary-tools'/>, set <envar>MAKEFLAGS</envar>
+ now in <filename>.bashrc</filename>:
+ </para>
+
+<screen><userinput>cat &gt;&gt; ~/.bashrc &lt;&lt; "EOF"
+<literal>export MAKEFLAGS=-j<replaceable>$(nproc)</replaceable></literal>
+EOF</userinput></screen>
+
+ <para>
+ Replace <replaceable>$(nproc)</replaceable> with the number of logical
+ cores you want to use if you don't want to use all the logical cores.
+ </para>
+
<para>Finally, to ensure the environment is fully prepared for building the
temporary tools, force the <command>bash</command> shell to read
the new user profile:</para>