mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-01-19 13:37:39 +00:00
21ba4e3570
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@2958 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
59 lines
2.5 KiB
XML
59 lines
2.5 KiB
XML
<sect1 id="ch05-settingenviron">
|
|
<title>Setting up the environment</title>
|
|
<?dbhtml filename="settingenvironment.html" dir="chapter05"?>
|
|
|
|
<para>While logged in as user <emphasis>lfs</emphasis>, issue the
|
|
following commands to set up a good work environment:</para>
|
|
|
|
<screen><userinput>cat > ~/.bash_profile << "EOF"</userinput>
|
|
set +h
|
|
umask 022
|
|
LFS=/mnt/lfs
|
|
LC_ALL=POSIX
|
|
PATH=/tools/bin:$PATH
|
|
export LFS LC_ALL PATH
|
|
unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
|
|
<userinput>EOF
|
|
|
|
source ~/.bash_profile</userinput></screen>
|
|
|
|
<para>The <userinput>set +h</userinput> command turns off
|
|
<userinput>bash</userinput>'s hash function. Normally hashing is a useful
|
|
feature: <userinput>bash</userinput> uses a hash table to remember the
|
|
full pathnames of executable files to avoid searching the PATH time and time
|
|
again to find the same executable. However, we'd like the new tools to be
|
|
used as soon as they are installed. By switching off the hash function, our
|
|
"interactive" commands (<userinput>make</userinput>,
|
|
<userinput>patch</userinput>, <userinput>sed</userinput>,
|
|
<userinput>cp</userinput> and so forth) will always use
|
|
the newest available version during the build process.</para>
|
|
|
|
<para>Setting the user file-creation mask to 022 ensures that newly created
|
|
files and directories are only writable for their owner, but readable and
|
|
executable for anyone.</para>
|
|
|
|
<para>The LFS variable should of course be set to the mount point you
|
|
chose.</para>
|
|
|
|
<para>The LC_ALL variable controls the localization of certain programs,
|
|
making their messages follow the conventions of a specified country. If your
|
|
host system uses a version of Glibc older than 2.2.4,
|
|
having LC_ALL set to something other than "POSIX" or "C" during this chapter
|
|
may cause trouble if you exit the chroot environment and wish to return later.
|
|
By setting LC_ALL to "POSIX" (or "C", the two are equivalent) we ensure that
|
|
everything will work as expected in the chroot environment.</para>
|
|
|
|
<para>We prepend <filename>/tools/bin</filename> to the standard PATH so
|
|
that, as we move along through this chapter, the tools we build will get used
|
|
during the rest of the building process.</para>
|
|
|
|
<para>The CC, CXX, CPP, LD_LIBRARY_PATH and LD_PRELOAD environment variables all
|
|
have the potential to cause havoc with our Chapter 5 toolchain. We therefore
|
|
unset them to prevent any chance of this happening.</para>
|
|
|
|
<para>Now, after sourcing the just-created profile, we're all set to begin
|
|
building the temporary tools that will support us in later chapters.</para>
|
|
|
|
</sect1>
|
|
|