[5e40325] | 1 | <sect1 id="ch05-settingenviron">
|
---|
| 2 | <title>Setting up the environment</title>
|
---|
| 3 | <?dbhtml filename="settingenviron.html" dir="chapter05"?>
|
---|
| 4 |
|
---|
| 5 | <para>While logged in as user <emphasis>lfs</emphasis>, issue the
|
---|
| 6 | following commands to set up a good work environment:</para>
|
---|
| 7 |
|
---|
| 8 | <para><screen><userinput>cat > ~/.bash_profile << "EOF"
|
---|
[bc82645e] | 9 | set +h
|
---|
[5e40325] | 10 | umask 022
|
---|
| 11 | LFS=/mnt/lfs
|
---|
| 12 | LC_ALL=POSIX
|
---|
[bc82645e] | 13 | PATH=/stage1/bin:$PATH
|
---|
[148c207] | 14 | export LFS LC_ALL PATH
|
---|
[5e40325] | 15 | EOF
|
---|
| 16 | source ~/.bash_profile</userinput></screen></para>
|
---|
| 17 |
|
---|
[bc82645e] | 18 | <para><userinput>set +h</userinput> turns off Bash's hash function. Hash
|
---|
| 19 | normally is a useful feature where Bash uses a hash table to remember the
|
---|
| 20 | full pathnames of executable files to avoid multiple `PATH' searches.
|
---|
| 21 | However, we'd like the new tools to become available as soon as they are
|
---|
| 22 | installed. By switching off the hash function, our "interactive" commands
|
---|
| 23 | (make, patch, sed, cp and so forth) will always use the newest available
|
---|
| 24 | during the build process.</para>
|
---|
| 25 |
|
---|
[f8a5e31d] | 26 | <para>This profile sets the umask to 022, so newly created files and
|
---|
[5e40325] | 27 | directories will have the correct permissions. To be more specific, only
|
---|
| 28 | the file owner will have write permission to new files and directories.
|
---|
| 29 | Other users of the system will be have read permission, and executable
|
---|
| 30 | permission to directories. It is advisable to keep this setting throughout
|
---|
| 31 | your LFS installation.</para>
|
---|
| 32 |
|
---|
[e4b9338] | 33 | <para>The LFS variable should of course be set to the mount point you
|
---|
| 34 | chose.</para>
|
---|
[5e40325] | 35 |
|
---|
| 36 | <para>The LC_ALL variable controls the localization of certain programs,
|
---|
| 37 | making their messages follow the conventions of a specified country. If your
|
---|
| 38 | host system uses a version of <emphasis>glibc</emphasis> older than 2.2.4,
|
---|
[f47f9cd] | 39 | having LC_ALL set to something other than "C" or "POSIX" during this chapter
|
---|
[5e40325] | 40 | may cause trouble if you exit the chroot environment and wish to return later.
|
---|
| 41 | By setting LC_ALL to "POSIX" ("C" is an alias for "POSIX") we ensure that
|
---|
| 42 | everything will work as expected in the chroot environment.</para>
|
---|
| 43 |
|
---|
[bc82645e] | 44 | <para>LDFLAGS is a variable we set in order to prevent debugging symbols from
|
---|
[5e40325] | 45 | being compiled into our static packages. By omitting these symbols during
|
---|
| 46 | the linking stage of compilation, we save hard drive space and decrease our
|
---|
| 47 | build time.</para>
|
---|
| 48 |
|
---|
| 49 | <para>We are now prepared to begin building the temporary tools which will
|
---|
| 50 | support us in later chapters.</para>
|
---|
| 51 |
|
---|
| 52 | </sect1>
|
---|
| 53 |
|
---|