diff options
-rw-r--r-- | chapter05/creatingstaticdir.xml | 20 | ||||
-rw-r--r-- | chapter05/findutils-exp.xml | 9 | ||||
-rw-r--r-- | chapter05/findutils-inst.xml | 15 | ||||
-rw-r--r-- | chapter05/findutils.xml | 14 | ||||
-rw-r--r-- | chapter05/utillinux-inst.xml | 15 | ||||
-rw-r--r-- | chapter05/utillinux.xml | 11 | ||||
-rw-r--r-- | chapter06/createfiles.xml | 17 | ||||
-rw-r--r-- | chapter06/creatingdirs.xml | 60 | ||||
-rw-r--r-- | chapter06/kernel-exp-headers.xml | 35 | ||||
-rw-r--r-- | chapter06/kernel-exp.xml | 36 | ||||
-rw-r--r-- | chapter06/kernel-inst.xml | 24 | ||||
-rw-r--r-- | chapter06/kernel.xml | 15 | ||||
-rw-r--r-- | chapter06/mountproc.xml | 22 | ||||
-rw-r--r-- | chapter06/pwdgroup.xml | 41 | ||||
-rw-r--r-- | index.xml | 4 |
15 files changed, 336 insertions, 2 deletions
diff --git a/chapter05/creatingstaticdir.xml b/chapter05/creatingstaticdir.xml new file mode 100644 index 000000000..480b0d86e --- /dev/null +++ b/chapter05/creatingstaticdir.xml @@ -0,0 +1,20 @@ +<sect1 id="ch05-creatingstaticdir"> +<title>Creating the $LFS/static directory</title> +<?dbhtml filename="creatingstaticdir.html" dir="chapter05"?> + +<para>As explained in this chapter's introduction, everything we install +from this chapter will be installed under the <filename +class="directory">$LFS/static</filename> directory. This way it won't +pollute the LFS partition with a bunch of temporary files. All we need to +do is create this directory so we can start installing. Simply run this +command to create the directory:</para> + +<para><screen><userinput>mkdir $LFS/static</userinput></screen></para> + +<para>You may want to move the packages you downloaded in chapter 3 to this +<filename class="directory">$LFS/static</filename> directory, perhaps +create a subdirectory <filename +class="directory">$LFS/static/src</filename> to keep them in.</para> + +</sect1> + diff --git a/chapter05/findutils-exp.xml b/chapter05/findutils-exp.xml new file mode 100644 index 000000000..d7eba25bb --- /dev/null +++ b/chapter05/findutils-exp.xml @@ -0,0 +1,9 @@ +<sect2> +<title>Command explanations</title> + +<para><userinput>patch -Np1 -i ../findutils-4.1.patch</userinput>: This +patch is to fix some compilation errors by +avoiding a variable conflict and changing some bad syntax.</para> + +</sect2> + diff --git a/chapter05/findutils-inst.xml b/chapter05/findutils-inst.xml new file mode 100644 index 000000000..51c7c5197 --- /dev/null +++ b/chapter05/findutils-inst.xml @@ -0,0 +1,15 @@ +<sect2> +<title>Installing Findutils</title> + +<para>This package requires its patch to be applied before you can +install it. Make sure it's unpacked before running the installation +commands.</para> + +<para>Install Findutils by running the following commands:</para> + +<para><screen><userinput>patch -Np1 -i ../findutils-4.1.patch && +./configure --prefix=$LFS/static && +make libexecdir=/static/bin LDFLAGS=-static && +make libexecdir=/static/bin install</userinput></screen></para> + +</sect2> diff --git a/chapter05/findutils.xml b/chapter05/findutils.xml new file mode 100644 index 000000000..9f25462a0 --- /dev/null +++ b/chapter05/findutils.xml @@ -0,0 +1,14 @@ +<sect1 id="ch05-findutils"> +<title>Installing Findutils-&findutils-version;</title> +<?dbhtml filename="findutils.html" dir="chapter05"?> + +<screen>Estimated build time: &findutils-time; +Estimated required disk space: &findutils-compsize;</screen> + +&c5-findutils-inst; +&c5-findutils-exp; +&aa-findutils-desc; +&aa-findutils-dep; + +</sect1> + diff --git a/chapter05/utillinux-inst.xml b/chapter05/utillinux-inst.xml new file mode 100644 index 000000000..781ee2c84 --- /dev/null +++ b/chapter05/utillinux-inst.xml @@ -0,0 +1,15 @@ +<sect2> +<title>Installation of Util-Linux</title> + +<para>We only need the mount and umount programs at the moment, so we won't +be compiling the entire package.</para> + +<para>Install Util-Linux by running the following commands:</para> + +<para><screen><userinput>./configure && +make -C lib && +make -C mount LDFLAGS=-static mount umount && +cp mount/{mount,umount} $LFS/static/bin</userinput></screen></para> + +</sect2> + diff --git a/chapter05/utillinux.xml b/chapter05/utillinux.xml new file mode 100644 index 000000000..a97f9b9c9 --- /dev/null +++ b/chapter05/utillinux.xml @@ -0,0 +1,11 @@ +<sect1 id="ch05-utillinux"> +<title>Installing Util-linux-&util-linux-version;</title> +<?dbhtml filename="util-linux.html" dir="chapter05"?> + +<screen>Estimated build time: &util-linux-time; +Estimated required disk space: &util-linux-compsize;</screen> + +&c5-utillinux-inst; +&aa-utillinux-dep; + +</sect1> diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml new file mode 100644 index 000000000..ac3076c7a --- /dev/null +++ b/chapter06/createfiles.xml @@ -0,0 +1,17 @@ +<sect1 id="ch06-createfiles"> +<title>Creating a few missing files</title> +<?dbhtml filename="createfiles.html" dir="chapter06"?> + +<para>A few files need to be created because programs hard-wire paths +that don't exist yet. The most frequently ones used are +<filename>/bin/sh</filename> and <filename>/dev/null</filename> so we'll be +creating those for the time being and replace them properly when the file's +package is (re)installed.</para> + +<para>Create the files by running the following commands:</para> + +<para><screen><userinput>ln -s /static/bin/bash /bin/sh && +mknod -m 0666 /dev/null c 1 3</userinput></screen></para> + +</sect1> + diff --git a/chapter06/creatingdirs.xml b/chapter06/creatingdirs.xml new file mode 100644 index 000000000..c0d8b1270 --- /dev/null +++ b/chapter06/creatingdirs.xml @@ -0,0 +1,60 @@ +<sect1 id="ch06-creatingdirs"> +<title>Creating directories</title> +<?dbhtml filename="creatingdirs.html" dir="chapter06"?> + +<para>Let's now create the directory tree on the LFS partition based on +the FHS standard, which can be found at +<ulink url="http://www.pathname.com/fhs/"/>. +Issuing the following commands will create a default directory layout:</para> + +<para><screen><userinput>mkdir -p /{bin,boot,dev/pts,etc/opt,home,lib,mnt,proc} && +mkdir -p /{root,sbin,tmp,usr,usr/local,var,opt} && +for dirname in /usr /usr/local + do + mkdir $dirname/{bin,etc,include,lib,sbin,share,src} + ln -s share/{man,doc,info} $dirname + mkdir $dirname/share/{dict,doc,info,locale,man} + mkdir $dirname/share/{nls,misc,terminfo,zoneinfo} + mkdir $dirname/share/man/man{1,2,3,4,5,6,7,8} +done && +mkdir /var/{lock,log,mail,run,spool} && +mkdir -p /var/{tmp,opt,cache,lib/misc,local} && +mkdir /opt/{bin,doc,include,info} && +mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}} && +ln -s ../var/tmp /usr</userinput></screen></para> + +<para>Normally, directories are created with permission mode 755, which isn't +desired for all directories. The first change is a mode 0750 for the +$LFS/root directory. This is to make sure that not just everybody can +enter the /root directory (the same a user would do with /home/username +directories). The second change is a mode 1777 for the tmp +directories. This way, any user can write data to the /tmp or /var/tmp +directory but cannot remove another user's files (the latter is caused +by the so-called "sticky bit" - bit 1 of the 1777 bit mask).</para> + +<para><screen><userinput>cd $LFS && +chmod 0750 root && +chmod 1777 tmp var/tmp</userinput></screen></para> + +<para>Now that the directories are created, copy the source files that were +downloaded in chapter 3 to some subdirectory under $LFS/usr/src (you +will need to create the desired directory yourself).</para> + +<sect2> +<title>FHS compliance notes</title> + +<para>The FHS stipulates that the /usr/local directory should contain the +bin, games, include, lib, man, sbin, and share subdirectories. You can +alter your /usr/local directory yourself if you want your system to be +FHS-compliant.</para> + +<para>Also, the standard says that there should exist a /usr/share/games +directory, which we don't much like for a base system. But feel free to +make your system FHS-compliant if you wish. The FHS isn't precise as +to the structure of the /usr/local/share subdirectories, so we took the +liberty of creating the directories that we felt were needed.</para> + +</sect2> + +</sect1> + diff --git a/chapter06/kernel-exp-headers.xml b/chapter06/kernel-exp-headers.xml new file mode 100644 index 000000000..de1256f3c --- /dev/null +++ b/chapter06/kernel-exp-headers.xml @@ -0,0 +1,35 @@ +<sect2> +<title>Why we copy the kernel headers and don't symlink them</title> + +<para>In the past, it was common practice for people to symlink the +/usr/include/linux and asm directories to /usr/src/linux/include/linux +and asm respectively. This is a <emphasis>bad</emphasis> idea as +this extract from a post by Linus Torvalds to the Linux Kernel +Mailing List points out:</para> + +<screen>I would suggest that people who compile new kernels should: + + - not have a single symbolic link in sight (except the one that the + kernel build itself sets up, namely the "linux/include/asm" symlink + that is only used for the internal kernel compile itself) + +And yes, this is what I do. My /usr/src/linux still has the old 2.2.13 +header files, even though I haven't run a 2.2.13 kernel in a _loong_ +time. But those headers were what glibc was compiled against, so those +headers are what matches the library object files. + +And this is actually what has been the suggested environment for at +least the last five years. I don't know why the symlink business keeps +on living on, like a bad zombie. Pretty much every distribution still +has that broken symlink, and people still remember that the linux +sources should go into "/usr/src/linux" even though that hasn't been +true in a _loong_ time.</screen> + +<para>The relevant part here is where he states that the headers should +be the ones which <emphasis>glibc was compiled against</emphasis>. These are +the headers which should remain accessible and so by copying them, we ensure +that we follow these guidelines. Also note that as long as you don't have +those symlinks, it is perfectly fine to have the kernel sources +in <filename>/usr/src/linux</filename>.</para> + +</sect2> diff --git a/chapter06/kernel-exp.xml b/chapter06/kernel-exp.xml new file mode 100644 index 000000000..c01f32364 --- /dev/null +++ b/chapter06/kernel-exp.xml @@ -0,0 +1,36 @@ +<sect2> +<title>Command explanations</title> + +<para><userinput>ln -s /static/bin/pwd /bin/pwd</userinput>: The kernel +source hard-wires the path to <filename>pwd</filename> to be +<filename>/bin/pwd</filename> so we create a temporary symlink to deal with +it.</para> + +<para><userinput>make mrproper:</userinput> This will ensure that the kernel +tree is absolutely clean. We do this because the kernel team recommend +that this is done prior to <emphasis>each</emphasis> kernel compilation, +and that we shouldn't rely on the source tree being automatically clean +after untarring.</para> + +<para><userinput>make include/linux/version.h</userinput> and +<userinput>make symlinks</userinput>: This creates the +<filename>include/linux/version.h</filename>, as well as the <filename +class="symlink">include/asm</filename> symlink.</para> + +<para><userinput>mkdir $LFS/usr/include/asm</userinput> +and <userinput>cp include/asm/* $LFS/usr/include/asm</userinput>: +This copies the platform-specific assembler kernel header files to +<filename>$LFS/usr/include/asm</filename></para> + +<para><userinput>cp -R include/linux $LFS/usr/include</userinput>: +This command copies the cross-platform kernel header files to +<filename>$LFS/usr/include</filename></para> + +<para><userinput>touch $LFS/usr/include/linux/autoconf.h</userinput>: Some +kernel header files include this <filename>autoconf.h</filename> file, but +outside the Linux source tree, that file has no meaning so we just create +an empty one so we don't get compile errors whenever it happens to be a +dependency of another kernel header file.</para> + +</sect2> + diff --git a/chapter06/kernel-inst.xml b/chapter06/kernel-inst.xml new file mode 100644 index 000000000..340335526 --- /dev/null +++ b/chapter06/kernel-inst.xml @@ -0,0 +1,24 @@ +<sect2> +<title>Installation of the Linux Kernel</title> + +<para>We won't be compiling a new kernel image yet. We'll do that after we +have finished the installation of the basic system software in this +chapter. But because certain software needs the kernel header files, we're +going to unpack the kernel archive now and set it up so that we can +compile the packages that need the kernel.</para> + +<para>The kernel configuration file is created by running the following +command:</para> + +<para><screen><userinput>ln -s /static/bin/pwd /bin/pwd && +make mrproper && +make include/linux/version.h && +make symlinks && +mkdir /usr/include/asm && +cp include/asm/* /usr/include/asm && +cp -R include/linux /usr/include && +touch /usr/include/linux/autoconf.h && +rm /bin/pwd</userinput></screen></para> + +</sect2> + diff --git a/chapter06/kernel.xml b/chapter06/kernel.xml new file mode 100644 index 000000000..797769381 --- /dev/null +++ b/chapter06/kernel.xml @@ -0,0 +1,15 @@ +<sect1 id="ch06-kernel"> +<title>Installing Linux-&kernel-version;</title> +<?dbhtml filename="kernel.html" dir="chapter06"?> + +<screen>Estimated build time: &kernel-time-static; +Estimated required disk space: &kernel-compsize-static;</screen> + +&c6-kernel-inst; +&c6-kernel-exp; +&c6-kernel-exp-headers; +&aa-kernel-desc; +&aa-kernel-dep; + +</sect1> + diff --git a/chapter06/mountproc.xml b/chapter06/mountproc.xml new file mode 100644 index 000000000..953a57822 --- /dev/null +++ b/chapter06/mountproc.xml @@ -0,0 +1,22 @@ +<sect1 id="ch06-proc"> +<title>Mounting $LFS/proc file system</title> +<?dbhtml filename="proc.html" dir="chapter06"?> + +<para>In order for certain programs to function properly, the proc file +system must be mounted and available from within the chroot'ed environment +as well. It's not a problem to mount the proc file system (or any other +file system for that matter) twice or even more than that.</para> + +<para>If you're still logged in as user "lfs", you should log out and log +in again as user root. The reason for this is simple: only root is allowed +to mount filesystems and to run chroot.</para> + +<para>The proc file system is mounted under $LFS/proc by running the +following command. We'll also chown it to user root/group root while we're +at it (the rest of the filesystem is chown'ed to root:root in a minute when +we start with chapter 6).</para> + +<para><screen><userinput>mount proc /proc -t proc</userinput></screen></para> + +</sect1> + diff --git a/chapter06/pwdgroup.xml b/chapter06/pwdgroup.xml new file mode 100644 index 000000000..942281c2b --- /dev/null +++ b/chapter06/pwdgroup.xml @@ -0,0 +1,41 @@ +<sect1 id="ch06-pwdgroup"> +<title>Creating passwd and group files</title> +<?dbhtml filename="pwdgroup.html" dir="chapter06"?> + +<para>In order for the user and group root to be recognized and to be able to +login, there needs to be an entry in the /etc/passwd and /etc/group file. +Besides the group root, a couple of other groups are recommended and needed by +packages. The groups created below aren't part of any standard. +The LSB only recommends a group bin with GID 1 to be present besides +group root. Other group names and GID's can be chosen by the user. Well +written packages don't depend on GID numbers but just use the group +name, so it doesn't matter which GID a group has. Since there +aren't any standards for groups the groups created here are the groups the +MAKEDEV script (the script that creates the device files in the /dev +directory) mentions.</para> + +<para>Create a new file <filename>/etc/passwd</filename> by running the +following command:</para> + +<para><screen><userinput>echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd</userinput></screen></para> + +<para>Create a new file <filename>/etc/group</filename> by running the +following command:</para> + +<para><screen><userinput>cat > /etc/group << "EOF"</userinput> +root:x:0: +bin:x:1: +sys:x:2: +kmem:x:3: +tty:x:4: +tape:x:5: +daemon:x:6: +floppy:x:7: +disk:x:8: +lp:x:9: +dialout:x:10: +audio:x:11: +<userinput>EOF</userinput></screen></para> + +</sect1> + @@ -4,8 +4,8 @@ <!ENTITY book SYSTEM "book/book.xml"> -<!ENTITY version "20020523"> -<!ENTITY releasedate "May 23rd, 2002"> +<!ENTITY version "20020524"> +<!ENTITY releasedate "May 24th, 2002"> <!ENTITY ftp-root "ftp://ftp.linuxfromscratch.org"> <!ENTITY http-root "http://ftp.linuxfromscratch.org"> |