setting-environment.xml 2.3 KB

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