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 @@ + +Creating the $LFS/static directory + + +As explained in this chapter's introduction, everything we install +from this chapter will be installed under the $LFS/static 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: + +mkdir $LFS/static + +You may want to move the packages you downloaded in chapter 3 to this +$LFS/static directory, perhaps +create a subdirectory $LFS/static/src to keep them in. + + + 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 @@ + +Command explanations + +patch -Np1 -i ../findutils-4.1.patch: This +patch is to fix some compilation errors by +avoiding a variable conflict and changing some bad syntax. + + + 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 @@ + +Installing Findutils + +This package requires its patch to be applied before you can +install it. Make sure it's unpacked before running the installation +commands. + +Install Findutils by running the following commands: + +patch -Np1 -i ../findutils-4.1.patch && +./configure --prefix=$LFS/static && +make libexecdir=/static/bin LDFLAGS=-static && +make libexecdir=/static/bin install + + 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 @@ + +Installing Findutils-&findutils-version; + + +Estimated build time: &findutils-time; +Estimated required disk space: &findutils-compsize; + +&c5-findutils-inst; +&c5-findutils-exp; +&aa-findutils-desc; +&aa-findutils-dep; + + + 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 @@ + +Installation of Util-Linux + +We only need the mount and umount programs at the moment, so we won't +be compiling the entire package. + +Install Util-Linux by running the following commands: + +./configure && +make -C lib && +make -C mount LDFLAGS=-static mount umount && +cp mount/{mount,umount} $LFS/static/bin + + + 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 @@ + +Installing Util-linux-&util-linux-version; + + +Estimated build time: &util-linux-time; +Estimated required disk space: &util-linux-compsize; + +&c5-utillinux-inst; +&aa-utillinux-dep; + + 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 @@ + +Creating a few missing files + + +A few files need to be created because programs hard-wire paths +that don't exist yet. The most frequently ones used are +/bin/sh and /dev/null so we'll be +creating those for the time being and replace them properly when the file's +package is (re)installed. + +Create the files by running the following commands: + +ln -s /static/bin/bash /bin/sh && +mknod -m 0666 /dev/null c 1 3 + + + 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 @@ + +Creating directories + + +Let's now create the directory tree on the LFS partition based on +the FHS standard, which can be found at +. +Issuing the following commands will create a default directory layout: + +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 + +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). + +cd $LFS && +chmod 0750 root && +chmod 1777 tmp var/tmp + +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). + + +FHS compliance notes + +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. + +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. + + + + + 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 @@ + +Why we copy the kernel headers and don't symlink them + +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 bad idea as +this extract from a post by Linus Torvalds to the Linux Kernel +Mailing List points out: + +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. + +The relevant part here is where he states that the headers should +be the ones which glibc was compiled against. 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 /usr/src/linux. + + 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 @@ + +Command explanations + +ln -s /static/bin/pwd /bin/pwd: The kernel +source hard-wires the path to pwd to be +/bin/pwd so we create a temporary symlink to deal with +it. + +make mrproper: This will ensure that the kernel +tree is absolutely clean. We do this because the kernel team recommend +that this is done prior to each kernel compilation, +and that we shouldn't rely on the source tree being automatically clean +after untarring. + +make include/linux/version.h and +make symlinks: This creates the +include/linux/version.h, as well as the include/asm symlink. + +mkdir $LFS/usr/include/asm +and cp include/asm/* $LFS/usr/include/asm: +This copies the platform-specific assembler kernel header files to +$LFS/usr/include/asm + +cp -R include/linux $LFS/usr/include: +This command copies the cross-platform kernel header files to +$LFS/usr/include + +touch $LFS/usr/include/linux/autoconf.h: Some +kernel header files include this autoconf.h 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. + + + 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 @@ + +Installation of the Linux Kernel + +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. + +The kernel configuration file is created by running the following +command: + +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 + + + 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 @@ + +Installing Linux-&kernel-version; + + +Estimated build time: &kernel-time-static; +Estimated required disk space: &kernel-compsize-static; + +&c6-kernel-inst; +&c6-kernel-exp; +&c6-kernel-exp-headers; +&aa-kernel-desc; +&aa-kernel-dep; + + + 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 @@ + +Mounting $LFS/proc file system + + +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. + +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. + +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). + +mount proc /proc -t proc + + + 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 @@ + +Creating passwd and group files + + +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. + +Create a new file /etc/passwd by running the +following command: + +echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd + +Create a new file /etc/group by running the +following command: + +cat > /etc/group << "EOF" +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: +EOF + + + diff --git a/index.xml b/index.xml index a31a758df..6c5f04cea 100644 --- a/index.xml +++ b/index.xml @@ -4,8 +4,8 @@ - - + +