mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-03-05 22:04:48 +00:00
third wave - remove old files
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@1899 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
1814dcd81e
commit
0515650c1d
@ -1,66 +0,0 @@
|
||||
<sect1 id="ch05-creatingdirs">
|
||||
<title>Creating directories</title>
|
||||
<?dbhtml filename="creatingdirs.html" dir="chapter05"?>
|
||||
|
||||
<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>cd $LFS &&
|
||||
mkdir -p bin boot dev/pts etc/opt home lib mnt proc root sbin tmp var opt &&
|
||||
for dirname in $LFS/usr $LFS/usr/local
|
||||
do
|
||||
mkdir $dirname
|
||||
cd $dirname
|
||||
mkdir bin etc include lib sbin share src
|
||||
ln -s share/man
|
||||
ln -s share/doc
|
||||
ln -s share/info
|
||||
cd $dirname/share
|
||||
mkdir dict doc info locale man nls misc terminfo zoneinfo
|
||||
cd $dirname/share/man
|
||||
mkdir man{1,2,3,4,5,6,7,8}
|
||||
done &&
|
||||
cd $LFS/var &&
|
||||
mkdir -p lock log mail run spool tmp opt cache lib/misc local &&
|
||||
cd $LFS/opt &&
|
||||
mkdir bin doc include info lib man &&
|
||||
cd $LFS/usr &&
|
||||
ln -s ../var/tmp</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>
|
||||
|
@ -1,35 +0,0 @@
|
||||
<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>
|
@ -1,31 +0,0 @@
|
||||
<sect2>
|
||||
<title>Command explanations</title>
|
||||
|
||||
<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>
|
||||
|
@ -1,22 +0,0 @@
|
||||
<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>make mrproper &&
|
||||
make include/linux/version.h &&
|
||||
make symlinks &&
|
||||
mkdir $LFS/usr/include/asm &&
|
||||
cp include/asm/* $LFS/usr/include/asm &&
|
||||
cp -R include/linux $LFS/usr/include &&
|
||||
touch $LFS/usr/include/linux/autoconf.h</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
@ -1,15 +0,0 @@
|
||||
<sect1 id="ch05-kernel">
|
||||
<title>Installing Linux-&kernel-version;</title>
|
||||
<?dbhtml filename="kernel.html" dir="chapter05"?>
|
||||
|
||||
<screen>Estimated build time: &kernel-time-static;
|
||||
Estimated required disk space: &kernel-compsize-static;</screen>
|
||||
|
||||
&c5-kernel-inst;
|
||||
&c5-kernel-exp;
|
||||
&c5-kernel-exp-headers;
|
||||
&aa-kernel-desc;
|
||||
&aa-kernel-dep;
|
||||
|
||||
</sect1>
|
||||
|
@ -1,23 +0,0 @@
|
||||
<sect1 id="ch05-proc">
|
||||
<title>Mounting $LFS/proc file system</title>
|
||||
<?dbhtml filename="proc.html" dir="chapter05"?>
|
||||
|
||||
<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>chown root:root $LFS/proc &&
|
||||
mount proc $LFS/proc -t proc</userinput></screen></para>
|
||||
|
||||
</sect1>
|
||||
|
@ -1,41 +0,0 @@
|
||||
<sect1 id="ch05-pwdgroup">
|
||||
<title>Creating passwd and group files</title>
|
||||
<?dbhtml filename="pwdgroup.html" dir="chapter05"?>
|
||||
|
||||
<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>$LFS/etc/passwd</filename> by running the
|
||||
following command:</para>
|
||||
|
||||
<para><screen><userinput>echo "root:x:0:0:root:/root:/bin/bash" > $LFS/etc/passwd</userinput></screen></para>
|
||||
|
||||
<para>Create a new file <filename>$LFS/etc/group</filename> by running the
|
||||
following command:</para>
|
||||
|
||||
<para><screen><userinput>cat > $LFS/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>
|
||||
|
Loading…
Reference in New Issue
Block a user