source: chapter02/aboutlfs.xml@ 40875a9

xry111/clfs-ng
Last change on this file since 40875a9 was 40875a9, checked in by Xi Ruoyao <xry111@…>, 3 years ago

cross-ng: chapter 2: mounting a partition on $LFS is not needed

  • Property mode set to 100644
File size: 3.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-partitioning-aboutlfs">
9 <?dbhtml filename="aboutlfs.html"?>
10
11 <title>Setting The $LFS Variable</title>
12
13 <para>Throughout this book, the environment variable <envar>LFS</envar> will
14 be used several times. You should ensure that this variable is always defined
15 throughout the LFS build process. It should be set to the name of the
16 directory where you will be building your LFS system - we will use
17 <filename class="directory">/mnt/lfs</filename> as an example, but the
18 directory choice is up to you. Choose a directory location and set the
19 variable with the following command:</para>
20
21<screen role="nodump"><userinput>export LFS=<replaceable>/mnt/lfs</replaceable></userinput></screen>
22
23 <para>Having this variable set is beneficial in that commands such as
24 <command>mkdir -v $LFS/tools</command> can be typed literally. The shell
25 will automatically replace <quote>$LFS</quote> with
26 <quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
27 processes the command line.</para>
28
29 <para>Create the directory:</para>
30
31<screen role="nodump"><userinput>mkdir -pv $LFS</userinput></screen>
32
33 <para>If you don't have much space in the partition holding the directory,
34 you can mount another partition on it.</para>
35
36 <caution>
37 <para>Do not forget to check that <envar>LFS</envar> is set whenever
38 you leave and reenter the current working environment (such as when doing a
39 <command>su</command> to <systemitem class="username">root</systemitem> or
40 another user). Check that the <envar>LFS</envar> variable is set up
41 properly with:</para>
42
43<screen role="nodump"><userinput>echo $LFS</userinput></screen>
44
45 <para>Make sure the output shows the path to your LFS system's build
46 location, which is <filename class="directory">/mnt/lfs</filename> if the
47 provided example was followed. If the output is incorrect, use the command
48 given earlier on this page to set <envar>$LFS</envar> to the correct
49 directory name.</para>
50 </caution>
51
52 <note><para>One way to ensure that the <envar>LFS</envar> variable is always
53 set is to edit the <filename>.bash_profile</filename> file in both your
54 personal home directory and in <filename>/root/.bash_profile</filename> and
55 enter the export command above. In addition, the shell specified in the
56 <filename>/etc/passwd</filename> file for all users that need the
57 <envar>LFS</envar> variable needs to be bash to ensure that the
58 <filename>/root/.bash_profile</filename> file is incorporated as a part of
59 the login process.</para>
60
61 <para>Another consideration is the method that is used to log into the
62 host system. If logging in through a graphical display manager, the
63 user's <filename>.bash_profile</filename> is not normally used when
64 a virtual terminal is started. In this case, add the export command to
65 the <filename>.bashrc</filename> file for the user and
66 <systemitem class="username">root</systemitem>. In addition,
67 some distributions have instructions to not run the <filename>.bashrc</filename>
68 instructions in a non-interactive bash invocation. Be sure to add the
69 export command before the test for non-interactive use.</para>
70
71 </note>
72
73</sect1>
Note: See TracBrowser for help on using the repository browser.