[lfs] branch multilib updated: pro-multilib: Rewrite.

"Git Owner" ([email protected] via lfs-book Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.book
Message-ID <176991584019.15481.1370518564786378770@rivendell.linuxfromscratch.org>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch multilib
in repository lfs.

The following commit(s) were added to refs/heads/multilib by this push:
     new a86de84e9 pro-multilib: Rewrite.
a86de84e9 is described below

commit a86de84e9ba98e0e243422755e4ceb1812508a1e
Author: Zeckmathederg <[email protected]>
AuthorDate: Sat Jan 31 20:18:19 2026 -0700

    pro-multilib: Rewrite.
---
 prologue/multilib.xml | 199 +++++++++++++++++++++++++++++---------------------
 1 file changed, 115 insertions(+), 84 deletions(-)

diff --git a/prologue/multilib.xml b/prologue/multilib.xml
index 8006ca7f8..10cfe4e28 100644
--- a/prologue/multilib.xml
+++ b/prologue/multilib.xml
@@ -12,117 +12,148 @@
 
   <sect2><title>What is Multilib</title>
 
-    <para>Today, most systems in the x86 world have a word size of 64 
-      bit. The word size is a number of bits which can be used at once
-      in the most efficient way. Previous architectures of x86 processors
-      had a word size of 32 bit which means they have a different 
-      understanding of what is the best alignment of data in memory as
-      well as they have a different mechanism to address a different size
-      of memory. Even the instruction set of the 64 bit processors is 
-      quite simmilar to the instructions of 32 bit processors, binaries
-      (objects compiled to machine code) cannot directly be executed on
-      64 bit systems.</para>
-
-    <para>Multilib is a mechanism to provide support for the 32 bit 
-      binaries so that they can be executed of modern 64 bit CPUs.</para>
+    <para>Today, most x86 systems are 64-bit. Before 64-bit came 32-bit, and
+      16-bit before that. These bit sizes are those that the CPU can work with
+      most efficiently. A result of this is that the CPU registers have changed
+      sizes, assignments, etc, along with different data alignment. Another
+      consequence is that software written or built for one bit size may fail
+      to work on another. To ensure that a previous bit size can run on a CPU
+      with a newer bit size, the CPU with the help of the kernel can emulate
+      software that targets the previous bit size.</para>
+
+    <para>This isn't quite enough to bridge bit size incompatibilities,
+      however. Most compiled software has dependencies that come from the
+      system, like the standard C library. When software of a different bit
+      size requests those dependencies, it wants them to be of the same bit
+      size as that software instead of the CPU's.</para>
+
+    <para>Multilib bridges that major gap, providing those dependencies for
+      the software's bit size while still offering a mainly 64-bit
+      experience.</para>
+
+    <para>This book provides 32-bit (i386/i486/i586/i686) and x32-bit
+      dependencies and toolchains intended for 64-bit x86 (x86_64)
+      systems.</para>
 
   </sect2>
 
-  <sect2><title>Why doing Multilib?</title>
+  <sect2><title>How MLFS Enables Multilib</title>
 
-    <para>From an educational point of view, LFS in its 'native' form is
-      probably the best way to see how a Linux system is built from source.
-      There is no need to confuse with different architectures. But when
-      there is a need to run 32 binaries and you don't want to build the 
-      whole system in 32 bit (which would be waste of ressources 
-      nowadays) then LFS-multilib is an option. Examples for such a
-      need could be
+    <important><para>MLFS is a variant of LFS and installs a completely new LFS
+      system. It is assumed that you are installing a new system and not
+      rebuilding the toolchain to include multilib support. While possible to
+      include support after the fact with a specific process, it is not yet
+      recommended.</para></important>
+
+    <para>LFS in its nature bootstraps itself from another Linux distribution.
+      To do this, every package is compiled from source and installed, often
+      multiple times in stages. In that spirit, MLFS does the same for the
+      dependencies. However, attempting to build a different bit sized
+      application or library on a standard vanilla LFS system results in
+      necessary libraries for this process being unable to be found and linked
+      against or into. The toolchains in place need to gain that support.</para>
+
+    <para>The duty of MLFS is to arm the system with toolchains that can target
+      32-bit and/or x32-bit, then provide basic dependencies that allow
+      32-bit/x32-bit compilations of packages outside of LFS to succeed and
+      work as expected.</para>
+
+  </sect2>
+
+  <sect2><title>The Purpose of a Multilib System</title>
+
+    <para>LFS nowadays is treated as educational material to learn from,
+      less-so using the produced result day-to-day. Installing support for
+      different bit sizes adds more onto the table at a price and makes the
+      initial LFS installing experience more confusing. It's recommended to
+      have installed LFS before installing MLFS. However, if you choose
+      to do the latter, you may encounter situations where having a multilib
+      system is rather beneficial. The following covers a non-exhaustive list
+      of reasons to do so:
       <itemizedlist>
-        <listitem><para>Closed-source software without source only 
-          available for 32 bit. That may be the case for printer driver 
-          or any other kind of hardware drivers, the company provides 
-          the binaries. If you have such a driver, LFS-multilib 
-          may help you getting the stuff running</para>
-        </listitem>
-        <listitem><para>If you want to go far beyond LFS and setup a 
-          virtualization platform like <application>VirtualBox</application>,
-          you will need multilib support</para>
-        </listitem>
-        <listitem><para>or even just because you can</para>
-        </listitem>
+        <listitem><para>Closed-source software existing only for 32-bit.
+          That may be the case for certain drivers or some desktop
+          software.</para></listitem>
+        <listitem><para>Setting up virtualization for a system with a different
+          bit size.</para></listitem>
+        <listitem><para>To learn the fundamentals of how multilib is set
+        up.</para></listitem>
       </itemizedlist>
       
     </para>
 
-    <para>The multilib edition of LFS goes a small step beyond and a 
-      small step back to what has been said in the previous section 
-      when talking about target architectures. On one hand, the multilib 
-      edition is focused and <emphasis>limited</emphasis> to x86_64 
-      architectures only, on the other hand, it <emphasis>expands</emphasis>
-      the instructions to utilize both possible architectures, namely
-      32-bit as well as 64-bit.</para>
-
-    <para>It also goes a bit beyond the basic educational 
-      approach of LFS which is to show you how to build a Linux system. 
-      To achieve this, no support for additional architectures than 
-      the default one for your system is required. If you haven't 
-      previously built a system using the standard LFS book, you are
-      encouraged to do so before using this edition.</para>
-
   </sect2>
 
   <sect2><title>Building a Multilib System</title>
 
+    <para>Earlier, it was mentioned MLFS does the same thing as LFS, which is
+      bootstrapping the system from another Linux distribution. At the same
+      time, it was mentioned that a compiler with no support for other bit
+      sizes built in will fail to build anything for that bit size. This means
+      that to build a compiler with support for other bit sizes (32-bit and
+      x32-bit), you need the system you are bootstrapping from to have that
+      support built into the compilers and must have the dependencies that
+      go along with them.</para>
+
+    <para>Over time, users of MLFS found that the best media for this
+      purpose is the <ulink
+      url="https://www.gentoo.org/downloads/#amd64">Gentoo CD</ulink>. It's
+      personal preference whether you want to use the minimal installation CD,
+      LiveGUI USB image, or the QCOW2 image. The LiveGUI USB image is very user
+      friendly, using KDE as the desktop environment and has web browsers for
+      use. The CDs offer 32-bit and x32-bit support on top of 64-bit. If you
+      already built an MLFS system, MLFS offers a good base to bootstrap from
+      as well.</para>
+
     <para>Building a multilib system is not that much different from 
-      building a system by using the 'native' LFS book. Beside some 
-      tweaks here and there the most prominent difference is that a
-      multilib system requires compiling some applications up to three
-      times:
-      one for the primary 64-bit architecture,
-      one for the 32-bit architecture (m32),
-      and once again for the 32-bit architecture with its 32-bit memory 
-      access and 64 bit instruction set (mx32).</para>
-
-    <para>Continue only if you and your system meets the following 
-      requirements:
+      building a system using the vanilla LFS book. Besides incorporating 
+      changes that allow multilib support in some packages or toolchains,
+      the overall process requires compiling some packages multiple times:
+      <orderedlist>
+        <listitem>
+          <para>For 64-bit (can provide both programs, libraries, and
+          data)</para>
+        </listitem>
+        <listitem arch="ml_32,ml_all">
+          <para>For 32-bit (typically installs only libraries)</para>
+        </listitem>
+        <listitem arch="ml_x32,ml_all">
+          <para>For x32-bit (typically installs only libraries)</para>
+        </listitem>
+      </orderedlist>
+    </para>
+
+    <para>Continue if your system meets the
+      following requirements:
       <itemizedlist>
         <listitem>
-          <para>you have a x86_64 compatible machine</para>
-          <note><para>
-            If you have access to the kernel config for your system,
-            you will need to have
-            <parameter>CONFIG_IA32_EMULATION=y</parameter>
-            set in order to build for <parameter>m32</parameter> and
-            <parameter>CONFIG_X86_X32_ABI=y</parameter> set in order to
-            build for <parameter>mx32</parameter>. 
-          </para>
+          <para>You have a x86_64 system.</para>
+        </listitem>
+        <listitem>
           <para>
-           If you do not have access to the kernel config for your system,
-            you may be able to test for compatability by running the 
-            following commands:
+            Have the ability to execute 32-bit/x32-bit software. Check
+            compatibility by running the following commands:
           </para>
 <screen><userinput>echo 'int main(){}' &gt; dummy.c
-gcc -m32 dummy.c
+</userinput><userinput arch="ml_32,ml_all">gcc -m32 dummy.c
 ./a.out
 
-gcc -mx32 dummy.c
-./a.out</userinput></screen>
+</userinput><userinput arch="ml_x32,ml_all">gcc -mx32 dummy.c
+./a.out
+
+</userinput><userinput>rm -vf dummy.c a.out</userinput></screen>
           <para>
-            If either of the <command>./a.out</command> commands results in an 
+            If either of the <command>./a.out</command> commands result in an 
             "Exec format error" message, then you do not have a system kernel
-            capable of building for that architecture within LFS, and so you
-            should probably look to build an LFS system without Multilib, but
-            with the required kernel capabilities, and use that to build a
-            Multilib system.
-          </para></note>
+            capable of building for that architecture within LFS. At that
+            point, try using another distribution or installation media.
+          </para>
         </listitem>
-        <listitem><para>you already have some experience with LFS</para></listitem>
-        <listitem><para>you have a need for 32-bit support</para></listitem>
       </itemizedlist>
     </para>
 
-    <para>If you passed all three requirements, go ahead and build LFS 
-      in multilib mode.</para>
+    <para>If you passed the above architecture
+      requirements, go ahead and build MLFS.</para>
 
   </sect2>
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-book
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.