From fcc027677da55c41dcaea045f5b9ff8b088e6495 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 7 Jun 2020 20:16:00 +0000 Subject: Initial commit of alternative cross LFS git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter07/createfiles.xml | 204 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 chapter07/createfiles.xml (limited to 'chapter07/createfiles.xml') diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml new file mode 100644 index 000000000..aed8d79da --- /dev/null +++ b/chapter07/createfiles.xml @@ -0,0 +1,204 @@ + + + %general-entities; +]> + + + + + Creating Essential Files and Symlinks + + + /etc/passwd + + + + /etc/group + + + + /var/run/utmp + + + + /var/log/btmp + + + + /var/log/lastlog + + + + /var/log/wtmp + + + Historically, Linux maintains a list of the mounted file systems in the + file /etc/mtab. Modern kernels maintain this list + internally and exposes it to the user via the /proc filesystem. To satisfy utilities that + expect the presence of /etc/mtab, create the following + symbolic link: + +ln -sv /proc/self/mounts /etc/mtab + + In order for user root to be + able to login and for the name root to be recognized, there + must be relevant entries in the /etc/passwd and + /etc/group files. + + Create the /etc/passwd file by running the following + command: + +cat > /etc/passwd << "EOF" +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/dev/null:/bin/false +daemon:x:6:6:Daemon User:/dev/null:/bin/false +messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false +nobody:x:99:99:Unprivileged User:/dev/null:/bin/false +EOF + +cat > /etc/passwd << "EOF" +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/dev/null:/bin/false +daemon:x:6:6:Daemon User:/dev/null:/bin/false +messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false +systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false +systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false +systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false +systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false +systemd-network:x:76:76:systemd Network Management:/:/bin/false +systemd-resolve:x:77:77:systemd Resolver:/:/bin/false +systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false +systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false +nobody:x:99:99:Unprivileged User:/dev/null:/bin/false +EOF + + The actual password for root + (the x used here is just a placeholder) will be set later. + + Create the /etc/group file by running the following + command: + +cat > /etc/group << "EOF" +root:x:0: +bin:x:1:daemon +sys:x:2: +kmem:x:3: +tape:x:4: +tty:x:5: +daemon:x:6: +floppy:x:7: +disk:x:8: +lp:x:9: +dialout:x:10: +audio:x:11: +video:x:12: +utmp:x:13: +usb:x:14: +cdrom:x:15: +adm:x:16: +messagebus:x:18: +input:x:24: +mail:x:34: +kvm:x:61: +wheel:x:97: +nogroup:x:99: +users:x:999: +EOF + +cat > /etc/group << "EOF" +root:x:0: +bin:x:1:daemon +sys:x:2: +kmem:x:3: +tape:x:4: +tty:x:5: +daemon:x:6: +floppy:x:7: +disk:x:8: +lp:x:9: +dialout:x:10: +audio:x:11: +video:x:12: +utmp:x:13: +usb:x:14: +cdrom:x:15: +adm:x:16: +messagebus:x:18: +systemd-journal:x:23: +input:x:24: +mail:x:34: +kvm:x:61: +systemd-bus-proxy:x:72: +systemd-journal-gateway:x:73: +systemd-journal-remote:x:74: +systemd-journal-upload:x:75: +systemd-network:x:76: +systemd-resolve:x:77: +systemd-timesync:x:78: +systemd-coredump:x:79: +wheel:x:97: +nogroup:x:99: +users:x:999: +EOF + + The created groups are not part of any standard—they are groups + decided on in part by the requirements of the Udev configuration in the next + chapter, and in part by common convention employed by a number of existing + Linux distributions. In addition, some test suites rely on specific users + or groups. The Linux Standard Base (LSB, available at ) recommends only that, besides the group + root with a Group ID (GID) of 0, + a group bin with a GID of 1 be + present. All other group names and GIDs can be chosen freely by the system + administrator since well-written programs do not depend on GID numbers, but + rather use the group's name. + + Some tests in need a regular + user. We add this user here and delete this account at the end of that + chapter. + +echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd +echo "tester:x:101:" >> /etc/group +install -o tester -d /home/tester + + To remove the I have no name! prompt, start a new + shell. Since the + /etc/passwd and /etc/group + files have been created, user name and group name resolution will now + work: + +exec /bin/bash --login +h + + Note the use of the +h directive. This tells + bash not to use its internal path hashing. Without this + directive, bash would remember the paths to binaries it has + executed. To ensure the use of the newly compiled binaries as soon as they are + installed, the +h directive will be used for the duration + of this chapter. + + The login, agetty, and + init programs (and others) use a number of log + files to record information such as who was logged into the system and + when. However, these programs will not write to the log files if they + do not already exist. Initialize the log files and give them + proper permissions: + +touch /var/log/{btmp,lastlog,faillog,wtmp} +chgrp -v utmp /var/log/lastlog +chmod -v 664 /var/log/lastlog +chmod -v 600 /var/log/btmp + + The /var/log/wtmp file records all logins and + logouts. The /var/log/lastlog file records when each + user last logged in. The /var/log/faillog file records + failed login attempts. The /var/log/btmp file records + the bad login attempts. + + The /run/utmp file records the users that + are currently logged in. This file is created dynamically in the boot + scripts. + + -- cgit v1.2.3-54-g00ecf From 387a32af4bff50363c15788cf25f10ed26cfabd3 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Thu, 11 Jun 2020 03:13:43 +0000 Subject: Update initial Chapter 7 pages for cross2 branch git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11918 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter07/changingowner.xml | 5 +---- chapter07/chroot.xml | 19 ++++++++++--------- chapter07/createfiles.xml | 24 ++++++++++++------------ chapter07/creatingdirs.xml | 6 +++--- chapter07/introduction.xml | 20 ++++++++------------ chapter07/kernfs.xml | 11 ++++++----- chapter08/grep.xml | 2 +- chapter08/make.xml | 3 +-- 8 files changed, 42 insertions(+), 48 deletions(-) (limited to 'chapter07/createfiles.xml') diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml index 43a902821..e376f9f6b 100644 --- a/chapter07/changingowner.xml +++ b/chapter07/changingowner.xml @@ -28,10 +28,7 @@ the files under $LFS, thus exposing these files to possible malicious manipulation. - To avoid this issue, you could add the lfs user to the new LFS system later when - creating the /etc/passwd file, taking care to assign it - the same user and group IDs as on the host system. Better yet, change the + To address this issue, change the ownership of the $LFS/* directories to user root by running the following command: diff --git a/chapter07/chroot.xml b/chapter07/chroot.xml index 5b6310af7..c0cd4fc96 100644 --- a/chapter07/chroot.xml +++ b/chapter07/chroot.xml @@ -10,14 +10,15 @@ Entering the Chroot Environment - Now that all the packages which depend on themselves for being built - are on the system, it is time to enter the chroot environment to finish - installing the remaining temporary tools. This environment will be in use - also for installing the final system. As user Now that all the packages which are required to build the rest of the + needed tools are on the system, it is time to enter the chroot environment to + finish installing the remaining temporary tools. This environment will be in + use also for installing the final system. As user root, run the following command to enter the - realm that is, at the moment, populated with only the temporary tools: + environment that is, at the moment, populated with only the temporary + tools: -chroot "$LFS" /usr/bin/env -i \ +chroot "$LFS" /usr/bin/env -i \ HOME=/root \ TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ @@ -31,18 +32,18 @@ TERM=$TERM construct will set the TERM variable inside chroot to the same value as outside chroot. This variable is needed for programs like vim and less - to operate properly. If other variables are needed, such as + to operate properly. If other variables are desired, such as CFLAGS or CXXFLAGS, this is a good place to set them again. From this point on, there is no need to use the - LFS variable anymore, because all work will be restricted + LFS variable anymore because all work will be restricted to the LFS file system. This is because the Bash shell is told that $LFS is now the root (/) directory. Notice that /tools/bin is not - anymore in the PATH. This means that a temporary tool will no longer be + in the PATH. This means that a temporary tool will no longer be used once its final version is installed. This occurs when the shell does not remember the locations of executed binaries—for this reason, hashing is switched off by passing the +h option diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml index aed8d79da..3f5698438 100644 --- a/chapter07/createfiles.xml +++ b/chapter07/createfiles.xml @@ -76,7 +76,7 @@ nobody:x:99:99:Unprivileged User:/dev/null:/bin/false EOF The actual password for root - (the x used here is just a placeholder) will be set later. + will be set later. Create the /etc/group file by running the following command: @@ -145,16 +145,16 @@ users:x:999: EOF The created groups are not part of any standard—they are groups - decided on in part by the requirements of the Udev configuration in the next - chapter, and in part by common convention employed by a number of existing - Linux distributions. In addition, some test suites rely on specific users - or groups. The Linux Standard Base (LSB, available at ) recommends only that, besides the group - root with a Group ID (GID) of 0, - a group bin with a GID of 1 be - present. All other group names and GIDs can be chosen freely by the system - administrator since well-written programs do not depend on GID numbers, but - rather use the group's name. + decided on in part by the requirements of the Udev configuration in Chapter + 9, and in part by common convention employed by a number of existing Linux + distributions. In addition, some test suites rely on specific users or + groups. The Linux Standard Base (LSB, available at ) only recommends that, + besides the group root with a + Group ID (GID) of 0, a group bin + with a GID of 1 be present. All other group names and GIDs can be chosen + freely by the system administrator since well-written programs do not depend + on GID numbers, but rather use the group's name. Some tests in need a regular user. We add this user here and delete this account at the end of that @@ -177,7 +177,7 @@ install -o tester -d /home/tester directive, bash would remember the paths to binaries it has executed. To ensure the use of the newly compiled binaries as soon as they are installed, the +h directive will be used for the duration - of this chapter. + of this and the next chapter. The login, agetty, and init programs (and others) use a number of log diff --git a/chapter07/creatingdirs.xml b/chapter07/creatingdirs.xml index 359717ff7..91b43a3a0 100644 --- a/chapter07/creatingdirs.xml +++ b/chapter07/creatingdirs.xml @@ -15,12 +15,12 @@ mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt} mkdir -pv /{media/{floppy,cdrom},srv,var} -install -dv -m 0750 /root -install -dv -m 1777 /tmp /var/tmp mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} -mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} +mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv /usr/{,local/}share/man/man{1..8} +install -dv -m 1777 /tmp /var/tmp +install -dv -m 0750 /root mkdir -v /var/{log,mail,spool} ln -sv /run /var/run diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml index 0445878d5..1d53f6987 100644 --- a/chapter07/introduction.xml +++ b/chapter07/introduction.xml @@ -10,28 +10,24 @@ Introduction - This chapter shows how to build the last missing bits of the - temporary system: first, the tools needed by the build machinery of - various packages, then three packages needed to run tests. - Now that all circular dependencies have been resolved, - we can use a chroot environment, completely isolated - from the computer used for the build, except for the running kernel. + This chapter shows how to build the last missing bits of the temporary + system: first, the tools needed by the build machinery of various packages, + then three packages needed to run tests. Now that all circular dependencies + have been resolved, we can use a chroot environment, + completely isolated the host operating system used for the build, except + for the running kernel. For proper operation of the isolated environment, some communication with the running kernel must be established. This is done through the so-called Virtual Kernel File Systems, which must be mounted when entering the chroot environment. You may want to check - that they are mounted by issuing ls $LFS/dev, - ls $LFS/proc, or ls $LFS/sys. - Note that mounting the virtual kernel file systems must be done - each time you want to enter the chroot - environment. + that they are mounted by issuing findmnt. Until , the commands must be run as root, with the LFS variable set. After entering chroot, all commands are run as root, fortunately without access to the OS of the computer - you build LFS on. Be careful anyway, as it is easy to destroy the whole + you built LFS on. Be careful anyway, as it is easy to destroy the whole LFS system with badly formed commands. diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml index dd6b8991c..6173e63a1 100644 --- a/chapter07/kernfs.xml +++ b/chapter07/kernfs.xml @@ -30,9 +30,10 @@ When the kernel boots the system, it requires the presence of a few device nodes, in particular the console and null devices. The device nodes must be created - on the hard disk so that they are available before udevd - has been started, and additionally when Linux is started with + class="devicefile">null devices. The device nodes must be + created on the hard disk so that they are available before the kernel + populates /dev), and + additionally when Linux is started with init=/bin/bash. Create the devices by running the following commands: @@ -72,7 +73,7 @@ mknod -m 666 $LFS/dev/null c 1 3 mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys mount -vt tmpfs tmpfs $LFS/run - + In some host systems, /dev/shm is a symbolic link to /run/shm. The /run tmpfs was mounted above so in this case only a diff --git a/chapter08/grep.xml b/chapter08/grep.xml index c911d9e06..44707152c 100644 --- a/chapter08/grep.xml +++ b/chapter08/grep.xml @@ -23,7 +23,7 @@ - <para>The Grep package contains programs for searching through teh contents of files.</para> + <para>The Grep package contains programs for searching through the contents of files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> diff --git a/chapter08/make.xml b/chapter08/make.xml index b996469c3..561bdd812 100644 --- a/chapter08/make.xml +++ b/chapter08/make.xml @@ -24,8 +24,7 @@ <title/> <para>The Make package contains a program for controlling the generation of - executables and other non-source files of a program from the program's - source files. .</para> + executables and other non-source files of a package from source files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> -- cgit v1.2.3-54-g00ecf From 6e18f2f842f2395e20ae1891e10c28beb47d5aa3 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pieere@linuxfromscratch.org> Date: Sun, 14 Jun 2020 20:03:03 +0000 Subject: Move iana-etc and the creation of a test /etc/hosts earier in the build, so that 2 more gcc tests pass. git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11940 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter07/createfiles.xml | 6 ++++++ chapter08/chapter08.xml | 2 +- chapter08/gcc.xml | 3 ++- chapter08/perl.xml | 6 ------ general.ent | 8 ++++---- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'chapter07/createfiles.xml') diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml index 3f5698438..c81ec9b1c 100644 --- a/chapter07/createfiles.xml +++ b/chapter07/createfiles.xml @@ -43,6 +43,12 @@ <screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen> + <para>Create a basic <filename>/etc/hosts</filename> file to be + referenced in some test suites, and in one of Perl's configuration files + as well:</para> + +<screen><userinput>echo "127.0.0.1 localhost $(hostname)" > /etc/hosts</userinput></screen> + <para>In order for user <systemitem class="username">root</systemitem> to be able to login and for the name <quote>root</quote> to be recognized, there must be relevant entries in the <filename>/etc/passwd</filename> and diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index cbdb39963..2e2bc799e 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -14,6 +14,7 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pkgmgt.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="man-pages.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="iana-etc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zlib.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bzip2.xml"/> @@ -37,7 +38,6 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ncurses.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sed.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="psmisc.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="iana-etc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grep.xml"/> diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index f771c135d..6aaf633da 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -124,10 +124,11 @@ su tester -c "PATH=$PATH make -k check"</userinput></screen> <para>Six tests related to get_time are known to fail. These are apparently related to the en_HK locale.</para> +<!-- don't fail anymore after the move of iana-etc and /etc/hosts <para>Two tests named lookup.cc and reverse.cc in experimental/net are known to fail in LFS chroot environment because they require /etc/hosts and iana-etc.</para> - +--> <para>A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet. Unless the test results are vastly different from those at the above URL, diff --git a/chapter08/perl.xml b/chapter08/perl.xml index 1841b819e..fd5e07f06 100644 --- a/chapter08/perl.xml +++ b/chapter08/perl.xml @@ -41,12 +41,6 @@ <sect2 role="installation"> <title>Installation of Perl - First create a basic /etc/hosts file to be - referenced in one of Perl's configuration files as well as the optional - test suite: - -echo "127.0.0.1 localhost $(hostname)" > /etc/hosts - This version of Perl now builds the Compress::Raw::Zlib and Compress::Raw::BZip2 modules. By default Perl will use an internal copy of the sources for the build. diff --git a/general.ent b/general.ent index b0cb1e91f..c5845df39 100644 --- a/general.ent +++ b/general.ent @@ -1,13 +1,13 @@ - + - + - + - + -- cgit v1.2.3-54-g00ecf