[6702623] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[fd48baa] | 8 | <sect1 arch="ml_32,ml_x32,ml_all" id="pre-multilib">
|
---|
[6702623] | 9 | <?dbhtml filename="multilib.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>About the Multilib Edition</title>
|
---|
| 12 |
|
---|
[fd48baa] | 13 | <sect2><title>What is Multilib</title>
|
---|
[6702623] | 14 |
|
---|
| 15 | <para>Today, most systems in the x86 world have a word size of 64
|
---|
| 16 | bit. The word size is a number of bits which can be used at once
|
---|
| 17 | in the most efficient way. Previous architectures of x86 processors
|
---|
| 18 | had a word size of 32 bit which means they have a different
|
---|
| 19 | understanding of what is the best alignment of data in memory as
|
---|
| 20 | well as they have a different mechanism to address a different size
|
---|
| 21 | of memory. Even the instruction set of the 64 bit processors is
|
---|
| 22 | quite simmilar to the instructions of 32 bit processors, binaries
|
---|
| 23 | (objects compiled to machine code) cannot directly be executed on
|
---|
| 24 | 64 bit systems.</para>
|
---|
| 25 |
|
---|
| 26 | <para>Multilib is a mechanism to provide support for the 32 bit
|
---|
| 27 | binaries so that they can be executed of modern 64 bit CPUs.</para>
|
---|
| 28 |
|
---|
| 29 | </sect2>
|
---|
| 30 |
|
---|
[fd48baa] | 31 | <sect2><title>Why doing Multilib?</title>
|
---|
[6702623] | 32 |
|
---|
[26e4b86] | 33 | <para>From an educational point of view, LFS in its 'native' form is
|
---|
[6702623] | 34 | probably the best way to see how a Linux system is built from source.
|
---|
| 35 | There is no need to confuse with different architectures. But when
|
---|
| 36 | there is a need to run 32 binaries and you don't want to build the
|
---|
| 37 | whole system in 32 bit (which would be waste of ressources
|
---|
[26e4b86] | 38 | nowadays) then LFS-multilib is an option. Examples for such a
|
---|
[6702623] | 39 | need could be
|
---|
| 40 | <itemizedlist>
|
---|
| 41 | <listitem><para>Closed-source software without source only
|
---|
| 42 | available for 32 bit. That may be the case for printer driver
|
---|
| 43 | or any other kind of hardware drivers, the company provides
|
---|
| 44 | the binaries. If you have such a driver, LFS-multilib
|
---|
| 45 | may help you getting the stuff running</para>
|
---|
| 46 | </listitem>
|
---|
| 47 | <listitem><para>If you want to go far beyond LFS and setup a
|
---|
| 48 | virtualization platform like <application>VirtualBox</application>,
|
---|
| 49 | you will need multilib support</para>
|
---|
| 50 | </listitem>
|
---|
| 51 | <listitem><para>or even just because you can</para>
|
---|
| 52 | </listitem>
|
---|
| 53 | </itemizedlist>
|
---|
| 54 |
|
---|
| 55 | </para>
|
---|
| 56 |
|
---|
[fd48baa] | 57 | <para>The multilib edition of LFS goes a small step beyond and a
|
---|
[6702623] | 58 | small step back to what has been said in the previous section
|
---|
| 59 | when talking about target architectures. On one hand, the multilib
|
---|
| 60 | edition is focused and <emphasis>limited</emphasis> to x86_64
|
---|
| 61 | architectures only, on the other hand, it <emphasis>expands</emphasis>
|
---|
| 62 | the instructions to utilize both possible architectures, namely
|
---|
| 63 | 32-bit as well as 64-bit.</para>
|
---|
| 64 |
|
---|
| 65 | <para>It also goes a bit beyond the basic educational
|
---|
| 66 | approach of LFS which is to show you how to build a Linux system.
|
---|
| 67 | To achieve this, no support for additional architectures than
|
---|
| 68 | the default one for your system is required. If you haven't
|
---|
| 69 | previously built by the standard LFS book, you are encouraged to
|
---|
| 70 | do so before using this edition.</para>
|
---|
| 71 |
|
---|
| 72 | </sect2>
|
---|
| 73 |
|
---|
[fd48baa] | 74 | <sect2><title>Building a Multilib System</title>
|
---|
[6702623] | 75 |
|
---|
| 76 | <para>Building a multilib system is not that much different from
|
---|
| 77 | building a system by using the 'native' LFS book. Beside some
|
---|
| 78 | tweaks here and there the most prominent difference is that
|
---|
[fd48baa] | 79 | multilib requires compiling some applications up to three times:
|
---|
[6702623] | 80 | one for the primary 64-bit architecture,
|
---|
[fd48baa] | 81 | one for the 32-bit architecture (m32),
|
---|
| 82 | and once again for the 32-bit architecture with is 32-bit memory
|
---|
| 83 | access and 64 bit instruction set (mx32).</para>
|
---|
[6702623] | 84 |
|
---|
| 85 | <para>Continue only if you and your system meets the following
|
---|
| 86 | requirements:
|
---|
| 87 | <itemizedlist>
|
---|
[384c707] | 88 | <listitem>
|
---|
| 89 | <para>you have a x86_64 compatible machine</para>
|
---|
| 90 | <note><para>
|
---|
| 91 | If you have access to the kernel config for your system,
|
---|
| 92 | you will need to have
|
---|
| 93 | <parameter>CONFIG_IA32_EMULATION=y</parameter>
|
---|
| 94 | set in order to build for <parameter>m32</parameter> and
|
---|
| 95 | <parameter>CONFIG_X86_X32=y</parameter> set in order to
|
---|
| 96 | build for <parameter>mx32</parameter>.
|
---|
| 97 | </para>
|
---|
| 98 | <para>
|
---|
| 99 | If you do not have access to the kernel config for your system,
|
---|
| 100 | you may be able to test for compatability by running the
|
---|
| 101 | following commands:
|
---|
| 102 | </para>
|
---|
| 103 | <screen><userinput>echo 'int main(){}' > dummy.c
|
---|
| 104 | gcc -m32 dummy.c
|
---|
| 105 | ./a.out
|
---|
| 106 |
|
---|
| 107 | gcc -mx32 dummy.c
|
---|
| 108 | ./a.out</userinput></screen>
|
---|
| 109 | <para>
|
---|
| 110 | If either of the <command>./a.out</command> commands results in an
|
---|
| 111 | "Exec format error" message, then you do not have a system kernel
|
---|
| 112 | capable of building for that architecture within LFS, and so you
|
---|
| 113 | should probably look to build an LFS system without Multilib, but
|
---|
| 114 | with the required kernel capabilities, and use that to build a
|
---|
| 115 | Multilib system.
|
---|
| 116 | </para></note>
|
---|
| 117 | </listitem>
|
---|
[6702623] | 118 | <listitem><para>you already have some experience with LFS</para></listitem>
|
---|
| 119 | <listitem><para>you have a need for 32-bit support</para></listitem>
|
---|
| 120 | </itemizedlist>
|
---|
| 121 | </para>
|
---|
| 122 |
|
---|
| 123 | <para>If you passed all three requirements, go ahead and build LFS
|
---|
| 124 | in multilib mode.</para>
|
---|
| 125 |
|
---|
| 126 | </sect2>
|
---|
| 127 |
|
---|
| 128 | </sect1>
|
---|