On Sun, 2020-07-26 at 12:18 -0500, Bruce Dubbs via lfs-dev wrote: > On 7/26/20 6:35 AM, Kevin Buckley via lfs-dev wrote: > > At present, the LFS Book, at Revision r12002, says > > > > 4.2. Creating the Minimal directory layout in LFS filesystem > > > > The first task performed in the LFS partition is to create a > > minimal > > directory hierarchy so that programs compiled in Chapter 6 may be > > installed in their final location. This is needed so that those > > temporary programs be overwritten when rebuilding them in Chapter > > 8. > > > > Create the required directory layout by running the following as > > root: > > > > mkdir -pv $LFS/{usr,lib,var,etc,bin,sbin} > > case $(uname -m) in > > x86_64) mkdir -pv $LFS/lib64 ;; > > esac > > > > however, the "This is needed ..." statement is not actually true. > > > > I've noticed that when building the Chapter 5 tools, that you only > > really need > > > > $LFS/usr > > > > so as to allow Linux Headers to do this > > > > cp -rv usr/include $LFS/usr > > > > and > > > > $LFS/lib > > $LFS/lib64 > > > > because of the compatibility links that get added at the start of > > Chapter 5's Glibc. > > > > The install of Chapter 5's Glibc creates the following "top-level" > > directories > > > > lib, var, etc, sbin > > > > when it does, amongst other "mkdir -p" invocations, the following > > > > mkdir -p -- /media/lfs10/lib > > mkdir -p -- /media/lfs10/var/lib/nss_db > > mkdir -p -- /media/lfs10/etc > > mkdir -p -- /media/lfs10/sbin > > > > and indeed, at the end of Chapter 5, there is still no /bin below > > $LFS. > > > > As I see it, it's not until Chapter 6's Bash, where the bash binary > > gets moved to /bin, that that directory is required, so perhaps the > > minimal directory list could just be > > > > mkdir -pv $LFS/{bin,lib,usr} > > case $(uname -m) in > > x86_64) mkdir -pv $LFS/lib64 ;; > > esac > > > > and even then the lib and lib64 directories are only required in > > the Glibc > > section because explicit links are made there, so the creation of > > those > > directories could be made part of Chapter 5's Glibc. > > > > Note also that Chapter 6's Bash install, doesn't require $LFS/bin: > > it's > > the "by-hand" move of the bash binary that requires it. > > > > If the creation of /bin was made a part of the Chapter 6 Bash > > install, > > as that is the first place that /bin is required, that would leave > > Chapter 4 > > with just this > > > > mkdir -pv $LFS/usr > > > > Just some observations that might be of use to some though, > > I haven't checked, but I think you may be taking the word 'minimal' > too > literally. Perhaps we should just change the description to: > > Creating a Limited directory layout in LFS filesystem > > Whether or not all the directories created in Chapter 4 are needed > in > Chapters 5 and 6, they are certainly needed in Chapters 7 and > 8. When > they are created is really not very important. >
The LFS root directory ($LFS), is supposed to be owned by the root user, and to have permissions rwxr-xr-x, so that user lfs cannot create anything in it. That's the reason why we create the hierarchy as root and chown the dirs to lfs later. I think Kevin has $LFS owned by lfs (or different permissions), which is of course ok, provided ownership or permissions are changed at the end. Right now, this is not what is done in the book. Pierre -- http://lists.linuxfromscratch.org/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page