From 13702d9f059b4b066b7a40a790e88b8e6adcb09d Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 28 Oct 2022 10:10:10 -0500 Subject: [PATCH 1/3] Cleaned up English idiom just a trifle. --- chapter04/addinguser.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml index 7903b5a84..2db1f756f 100644 --- a/chapter04/addinguser.xml +++ b/chapter04/addinguser.xml @@ -62,7 +62,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs lfs - This is the actual name for the created user. + This is the name of the new user. @@ -71,7 +71,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs If you want to log in as &lfs-user; or switch to &lfs-user; from a non-&root; user (as opposed to switching to user &lfs-user; when logged in as &root;, which does not require the &lfs-user; user to - have a password), you need to set a password of &lfs-user;. Issue the + have a password), you need to set a password for &lfs-user;. Issue the following command as the &root; user to set the password: passwd lfs From 4e2645304c69a42ce1cfa028904c7aef7db6b975 Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 28 Oct 2022 11:37:59 -0500 Subject: [PATCH 2/3] Standardize spelling of "cross-compile" and its derivatives. Clean up English idiom. Remove some superfluous verbiage here and there. --- chapter04/settingenviron.xml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index a57246217..d801aa9ab 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -19,9 +19,9 @@ exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF - When logged on as user lfs - or switched to the &lfs-user; user using a su command - with - option, + When logged on as user lfs, + or when switched to the &lfs-user; user using an su command + with the - option, the initial shell is a login shell which reads the /etc/profile of the host (probably containing some settings and environment variables) and then .bash_profile. @@ -30,8 +30,7 @@ EOF one with a completely empty environment, except for the HOME, TERM, and PS1 variables. This ensures that no unwanted and potentially hazardous environment variables from the host system - leak into the build environment. The technique used here achieves the goal of - ensuring a clean environment. + leak into the build environment. The new instance of the shell is a non-login shell, which does not read, and execute, the contents of the /etc/profile or @@ -100,7 +99,7 @@ EOF programs, making their messages follow the conventions of a specified country. Setting LC_ALL to POSIX or C (the two are equivalent) ensures that everything will work as expected in - the chroot environment. + the cross-compilation environment. @@ -108,8 +107,8 @@ EOF LFS_TGT=(uname -m)-lfs-linux-gnu The LFS_TGT variable sets a non-default, but compatible machine - description for use when building our cross compiler and linker and when cross - compiling our temporary toolchain. More information is contained in + description for use when building our cross-compiler and linker and when + cross-compiling our temporary toolchain. More information is provided by . @@ -132,7 +131,7 @@ EOF if [ ! -L /bin ]; then PATH=/bin:$PATH; fi If /bin is not a symbolic - link, then it has to be added to the PATH variable. + link, it must be added to the PATH variable. @@ -163,7 +162,7 @@ EOF export ... - While the above commands have set some variables, in order + While the preceding commands have set some variables, in order to make them visible within any sub-shells, we export them. @@ -172,7 +171,7 @@ EOF - Several commercial distributions add a non-documented instantiation + Several commercial distributions add an undocumented instantiation of /etc/bash.bashrc to the initialization of bash. This file has the potential to modify the lfs @@ -185,9 +184,9 @@ EOF [ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE - After use of the lfs - user is finished at the beginning of , you can restore + When the lfs + user is no longer needed (at the beginning of ), you may safely restore /etc/bash.bashrc (if desired). Note that the LFS Bash package we will build in @@ -196,7 +195,7 @@ EOF completed LFS system. - Finally, to have the environment fully prepared for building the + Finally, to ensure the environment is fully prepared for building the temporary tools, force the bash shell to read the new user profile: From c389124842d6d6d857e3a2b454c6b69fa2b6e2aa Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 28 Oct 2022 13:46:11 -0500 Subject: [PATCH 3/3] Orthography: spell cross-compile and its derived forms consistently. Add some paragraph breaks to enhance readability. Correct English idiom here and there. Capitalize titles consistently, fix punctuation. --- part3intro/toolchaintechnotes.xml | 115 +++++++++++++++--------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/part3intro/toolchaintechnotes.xml b/part3intro/toolchaintechnotes.xml index 53c1f4a23..820da0ada 100644 --- a/part3intro/toolchaintechnotes.xml +++ b/part3intro/toolchaintechnotes.xml @@ -40,8 +40,8 @@ The LFS book is not (and does not contain) a general tutorial to - build a cross (or native) toolchain. Don't use the commands in the - book for a cross toolchain for some purpose other + build a cross- (or native) toolchain. Don't use the commands in the + book for a cross-toolchain for some purpose other than building LFS, unless you really understand what you are doing. @@ -74,7 +74,7 @@ As an example, let us imagine the following scenario (sometimes - referred to as Canadian Cross): we have a + referred to as Canadian Cross). We have a compiler on a slow machine only, let's call it machine A, and the compiler ccA. We also have a fast machine (B), but no compiler for (B), and we want to produce code for a third, slow machine (C). We will build a @@ -145,32 +145,36 @@ Implementation of Cross-Compilation for LFS - All packages involved with cross compilation in the book use an + All the packages involved with cross-compilation 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 + referred to as the system triplet. Since the vendor field is often + irrelevant, autoconf lets you omit it. + + An astute reader may wonder why a triplet refers to a four component name. The - reason is the kernel field and the os field originated from one + kernel field and the os field began as a single system field. Such a three-field form is still valid - today for some systems, for example - x86_64-unknown-freebsd. 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 + today for some systems, for example, + x86_64-unknown-freebsd. But + two systems can share the same kernel and still be too different to + use the same triplet to describe them. For example, Android running on a mobile phone is completely different from Ubuntu running on an ARM64 - server, despite they are running on the same type of CPU (ARM64) and - using the same kernel (Linux). - Without an emulation layer, you cannot run an - executable for the server on the mobile phone or vice versa. So the - system field is separated into kernel and os fields to - designate these systems unambiguously. For our example, the Android + server, even though they are both running on the same type of CPU (ARM64) and + using the same kernel (Linux). + + Without an emulation layer, you cannot run an + executable for a server on a mobile phone or vice versa. So the + system field has been divided into kernel and os fields, to + designate these systems unambiguously. In our example, the Android system is designated aarch64-unknown-linux-android, and the Ubuntu system is designated - aarch64-unknown-linux-gnu. The word - triplet remained. A simple way to determine your + aarch64-unknown-linux-gnu. + + The word triplet remains embedded in the lexicon. A simple way to determine your system triplet is to run the config.guess script that comes with the source for many packages. Unpack the binutils - sources and run the script: ./config.guess and note + sources, run the script ./config.guess, and note the output. For example, for a 32-bit Intel processor the output will be i686-pc-linux-gnu. On a 64-bit system it will be x86_64-pc-linux-gnu. On most @@ -193,11 +197,11 @@ tree. - In order to fake a cross compilation in LFS, the name of the host triplet + In order to fake a cross-compilation in LFS, the name of the host triplet is slightly adjusted by changing the "vendor" field in the LFS_TGT variable so it says "lfs". We also use the - --with-sysroot option when building the cross linker and - cross compiler to tell them where to find the needed host files. This + --with-sysroot option when building the cross-linker and + cross-compiler to tell them where to find the needed host files. This ensures that none of the other programs built in can link to libraries on the build machine. Only two stages are mandatory, plus one more for tests. @@ -237,11 +241,11 @@ Now, there is more about cross-compiling: the C language is not just a compiler, but also defines a standard library. In this book, the GNU C library, named glibc, is used (there is an alternative, "musl"). This library must - be compiled for the LFS machine; that is, using the cross compiler cc1. - But the compiler itself uses an internal library implementing complex + be compiled for the LFS machine; that is, using the cross-compiler cc1. + But the compiler itself uses an internal library providing complex subroutines for functions not available in the assembler instruction set. This internal library is named libgcc, and it must be linked to the glibc - library to be fully functional! Furthermore, the standard library for + library to be fully functional. Furthermore, the standard library for C++ (libstdc++) must also be linked with glibc. The solution to this chicken and egg problem is first to build a degraded cc1-based libgcc, lacking some functionalities such as threads and exception handling, and then @@ -249,36 +253,35 @@ degraded), and also to build libstdc++. This last library will lack some of the functionality of libgcc. - This is not the end of the story: the upshot of the preceding + The upshot of the preceding paragraph is that cc1 is unable to build a fully functional libstdc++, but this is the only compiler available for building the C/C++ libraries - during stage 2! Of course, the compiler built during stage 2, cc-lfs, + during stage 2. Of course, the compiler built by stage 2, cc-lfs, would be able to build those libraries, but (1) the build system of - gcc does not know that it is usable on pc, and (2) using it on pc + gcc does not know cc-lfs can run on pc, and (2) using cc-lfs on pc would create a risk of linking to the pc libraries, since cc-lfs is a native compiler. So we have to re-build libstdc++ later as a part of gcc stage 2. - In &ch-final; (or stage 3), all packages needed for - the LFS system are built. Even if a package is already installed into - the LFS system in a previous chapter, we still rebuild the package - unless we are completely sure it's unnecessary. The main reason for - rebuilding these packages is to settle them down: if we reinstall a LFS + In &ch-final; (or stage 3), all the packages needed for + the LFS system are built. Even if a package has already been installed into + the LFS system in a previous chapter, we still rebuild the package. The main reason for + rebuilding these packages is to make them stable: if we reinstall a LFS package on a complete LFS system, the installed content of the package - should be same as the content of the same package installed in + should be the same as the content of the same package when installed in &ch-final;. The temporary packages installed in &ch-tmp-cross; or - &ch-tmp-chroot; cannot satisfy this expectation because some of them - are built without optional dependencies installed, and autoconf cannot - perform some feature checks in &ch-tmp-cross; because of cross - compilation, causing the temporary packages to lack optional features + &ch-tmp-chroot; cannot satisfy this requirement, because some of them + are built without optional dependencies, and autoconf cannot + perform some feature checks in &ch-tmp-cross; because of cross-compilation, + causing the temporary packages to lack optional features, or use suboptimal code routines. Additionally, a minor reason for - rebuilding the packages is allowing to run the testsuite. + rebuilding the packages is to run the test suites. - Other procedural details + Other Procedural Details The cross-compiler will be installed in a separate $LFS/tools directory, since it will not @@ -300,11 +303,11 @@ its library search order. Detailed information can be obtained from ld by passing it the --verbose flag. For example, $LFS_TGT-ld --verbose | grep SEARCH - will illustrate the current search paths and their order. Note that this - example can be run as shown only while being user + will illustrate the current search paths and their order. (Note that this + example can be run as shown only while logged in as user lfs. If you come back to this - page later, replace $LFS_TGT-ld with just - ld. + page later, replace $LFS_TGT-ld with + ld). The next package installed is gcc. An example of what can be seen during its run of configure is: @@ -317,28 +320,28 @@ checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ldgcc itself, the same search paths are not necessarily used. To find out which standard linker gcc - will use, run: $LFS_TGT-gcc -print-prog-name=ld. Again, - remove the $LFS_TGT- part if coming back to this - later. + will use, run: $LFS_TGT-gcc -print-prog-name=ld. (Again, + remove the $LFS_TGT- prefix if coming back to this + later.) Detailed information can be obtained from gcc by passing it the -v command line option while compiling a program. For example, $LFS_TGT-gcc -v example.c (or without - $LFS_TGT- if coming back later to this) will show + $LFS_TGT- if coming back later) will show detailed information about the preprocessor, compilation, and assembly stages, including gcc's search paths for included headers and their order. - Next installed are sanitized Linux API headers. These allow the + Next up: sanitized Linux API headers. These allow the standard C library (glibc) to interface with features that the Linux kernel will provide. - The next package installed is glibc. The most important + Next comes glibc. The most important considerations for building glibc are the compiler, binary tools, and kernel headers. The compiler is generally not an issue since glibc will always use the compiler relating to the --host - parameter passed to its configure script; e.g. in our case, the compiler + parameter passed to its configure script; e.g., in our case, the compiler will be $LFS_TGT-gcc. The binary tools and kernel headers can be a bit more complicated. Therefore, we take no risks and use the available configure switches to enforce the correct selections. After @@ -350,12 +353,12 @@ checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld-nostdinc and -isystem flags to control the compiler's include search path. These items highlight an important aspect of the glibc - package—it is very self-sufficient in terms of its build machinery + package—it is very self-sufficient in terms of its build machinery, and generally does not rely on toolchain defaults. As mentioned above, the standard C++ library is compiled next, followed in - by other programs that need - to be cross compiled for breaking circular dependencies at build time. + by other programs that must + be cross-compiled to break circular dependencies at build time. The install step of all those packages uses the DESTDIR variable to force installation in the LFS filesystem. @@ -377,7 +380,7 @@ checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld, final versions of all the - packages needed for a fully functional system are built, tested and + packages needed for a fully functional system are built, tested, and installed.