setting-environment.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. umask 022
  8. LFS=/mnt/lfs
  9. LC_ALL=POSIX
  10. CC="gcc -s"
  11. export LFS LC_ALL CC
  12. EOF
  13. source ~/.bash_profile</userinput></screen></para>
  14. <para>This profile sets the umask to 022, so newly created files will and
  15. directories will have the correct permissions. To be more specific, only
  16. the file owner will have write permission to new files and directories.
  17. Other users of the system will be have read permission, and executable
  18. permission to directories. It is advisable to keep this setting throughout
  19. your LFS installation.</para>
  20. <para>The LFS, LC_ALL, and CC environment variables are also set. The LFS
  21. variable has been explained in previous chapters. LC_ALL is a variable used
  22. for internationalization.</para>
  23. <para>The LC_ALL variable controls the localization of certain programs,
  24. making their messages follow the conventions of a specified country. If your
  25. host system uses a version of <emphasis>glibc</emphasis> older than 2.2.4,
  26. having LC_ALL set to something other than "C" or "POSIX" during Chapter 5
  27. may cause trouble if you exit the chroot environment and wish to return later.
  28. By setting LC_ALL to "POSIX" ("C" is an alias for "POSIX") we ensure that
  29. everything will work as expected in the chroot environment.</para>
  30. <para>CC is a variable we set in order to prevent debugging symbols from
  31. being compiled into our static packages. By omitting these symbols during
  32. the linking stage of compilation, we save hard drive space and decrease our
  33. build time.</para>
  34. <para>We are now prepared to begin building the temporary tools which will
  35. support us in later chapters.</para>
  36. </sect1>