diff options
author | Xi Ruoyao <xry111@xry111.site> | 2022-09-30 10:39:03 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2022-09-30 10:43:19 +0800 |
commit | e18ba697ebe7861e70b00dfb1480273f7ea9b40c (patch) | |
tree | 6e5ebf8ce6e3a97f361bb2cfd384752613df0b2d | |
parent | cc0e77d267fc5ca59ed2215c04ece7e80432e0c7 (diff) |
toolchain technical note: rewrite the descrption for triplet
- Don't say "most building system", refine the dicussion for autoconf.
Other building systems may use a variant of triplet, or use a
completely different system designation.
- Explain why a triplet may contain 4 fields in detail. "Histroical
reason" is not really correct because 3-field triplet is still used
today for BSD, Fuchsia, IOS, Mac OS X (darwin), Solaris, etc.
- "machine" triplet to "system" triplet (strictly speaking, only the
first field in the triplet is for the machine).
Why we need to say "vendor can be omitted" explicitly: we mention "gcc
-dumpmachine". On some distros (like Ubuntu) the output has no vendor
field. If you think this is too nasty, please remove both.
-rw-r--r-- | part3intro/toolchaintechnotes.xml | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/part3intro/toolchaintechnotes.xml b/part3intro/toolchaintechnotes.xml index 49656d052..7a8058424 100644 --- a/part3intro/toolchaintechnotes.xml +++ b/part3intro/toolchaintechnotes.xml @@ -145,15 +145,28 @@ <title>Implementation of Cross-Compilation for LFS</title> <note> - <para>Almost all the build systems use names of the form - cpu-vendor-kernel-os, referred to as the machine triplet. (Sometimes, - the vendor field is omitted.) An astute - reader may wonder why a <quote>triplet</quote> refers to a four component - name. The reason is historical: initially, three component names were enough - to designate a machine unambiguously, but as new machines and systems - proliferated, that proved insufficient. The word <quote>triplet</quote> - remained. A simple way to determine your machine triplet is to run - the <command>config.guess</command> + <para>All packages involved with cross compilation in the book use an + autoconf-based building system. The autoconf-based building system + accepts system types in the form cpu-vendor-kernel-os, + referred to as the system triplet. Since the vendor field is mostly + irrelevant, autoconf allows to omit it. An astute reader may wonder + why a <quote>triplet</quote> refers to a four component name. The + reason is the kernel field and the os field originiated from one + <quote>system</quote> field. Such a three-field form is still valid + today for some systems, for example + <literal>x86_64-unknown-freebsd</literal>. But for other systems, + two systems can share the same kernel but still be too different to + use a same triplet for them. For example, an Android running on a + mobile phone is completely different from Ubuntu running on an ARM64 + server. Without an emulation layer, you cannot run an executable for + the server on the mobile phone or vice versa. So the + <quote>system</quote> field is separated into kernel and os fields to + designate these systems unambiguously. For our example, the Android + system is designated <literal>aarch64-unknown-linux-android</literal>, + and the Ubuntu system is designated + <literal>aarch64-unknown-linux-gnu</literal>. The word + <quote>triplet</quote> remained. A simple way to determine your + system triplet is to run the <command>config.guess</command> script that comes with the source for many packages. Unpack the binutils sources and run the script: <userinput>./config.guess</userinput> and note the output. For example, for a 32-bit Intel processor the |