Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in xml/htdocs/proj/en/gentoo-alt/prefix: bootstrap-linux.xml
Date: Fri, 07 Sep 2007 16:12:33
grobian     07/09/07 16:05:07

  Added:                bootstrap-linux.xml
  Add a preliminary linux bootstrapping guide.  Not linked yet, will first
  throw it in the group for some testing.

Revision  Changes    Path
1.1                  xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-linux.xml

file :

Index: bootstrap-linux.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-linux.xml,v 1.1 2007/09/07 16:05:07 grobian Exp $ -->

<guide link="/proj/en/gentoo-alt/prefix/bootstrap-linux.xml" lang="en">
  <title>Gentoo Prefixed Portage Bootstrap Process for Linux</title>

  <author title="Author">
    <mail link="grobian@g.o">Fabian Groffen</mail>

    How to bootstrap Prefixed Portage on your Linux system

  <!-- The content of this document is licensed under the CC-BY-SA license -->
  <!-- See -->


    <title>Bootstrapping on OS X</title>

    <section><!-- {{{ Introduction -->
          Bootstrapping on Linux gets simpler with the freshness of the
		  Linux distribution.  An old linux distribution requires more
		  bootstrapping.  Because the huge variety of Linux
		  distributions, this guide can only considered to be a mere
		  guideline; the actual bootstrap process might require some
		  additional steps based on what goes wrong.  When problems
		  occur, please search and post to the <c>gentoo-alt</c> mailing
		  list for additional help.
    </section><!-- }}} -->

    <section><!-- {{{ Bootstrapping -->
          As prerequisite, you need a GCC compiler, the GNU binutils
		  linker and system headers, such that source code can be
		  compiled into workin executables.
          The first step is to chose a path to install into.  We refer
          to this path as "prefix path", stored in the variable
          <c>$EPREFIX</c>.  A suggestion for your prefix path is
          Whatever you chose, make sure you set it in your environment:
        <pre caption="Export EPREFIX variable">
$ <i>export EPREFIX="$HOME/gentoo"</i>
          tcsh users can use <c>setenv EPREFIX "$HOME/gentoo"</c>
          Next, add the following paths in your soon to be prefix to
          your <c>PATH</c> environment.
          <path>$EPREFIX/tmp/bin</path> and
          Adding these paths makes sure that they will be available
          later on in the process.
        <pre caption="Add prefix paths to your PATH">
$ <i>export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:$PATH"</i>
          Now the path is set, start with downloading the bootstrap
          script from
          From the directory where the bootstrap script was stored execute
          the following commands:
        <pre caption="Use the bootstrap script">
$ <i>chmod 755</i>
$ <i>./ $EPREFIX tree</i>
$ <i>./ $EPREFIX/tmp python</i>
$ <i>./ $EPREFIX portage</i>
		<note>Please note that <c>python</c> is installed in
			<path>$EPREFIX/tmp</path>!  You can skip bootstrapping
			python if you already have a working Python 2.4 in your
          The script will setup the <path>$EPREFIX</path>
          directory, download a portage tree snapshot, unpack it and
          download and install portage.  Afterwards it will try to setup
          some sane defaults.  We continue with a little hack necessary
          for a successful bootstrap:
        <pre caption="Setup ld directions">
$ <i>export LDFLAGS="-L${EPREFIX}/usr/lib -Wl,-rpath=${EPREFIX}/usr/lib -L${EPREFIX}/lib -Wl,-rpath=${EPREFIX}/lib"</i>
$ <i>export CPPFLAGS="-I${EPREFIX}/usr/include"</i>
          Because we installed some new applications, we will instruct
          bash to reconsider all paths we have:
        <pre caption="rehash in bash">
$ <i>hash -r</i>
          tcsh users can use the <c>rehash</c> command.
          We continue adding some necessary tools which will deal with
          many errors and warnings you might see during emerging.
        <pre caption="emerge sed">
$ <i>emerge --oneshot sed</i>
          Next, we emerge the <c>bash</c> shell and its dependency
          ncurses.  <c>bash</c> is used extensively within portage and
          other applications.
        <pre caption="emerge bash">
$ <i>emerge --oneshot bash</i>
          It is safe to ignore the "1 config files in XXX need updating"
          message that appears till the end of the bootstrap process.
          We continue getting some autotools stuff into our prefix.
        <pre caption="emerge autotools">
$ <i>emerge --oneshot --nodeps "m4"</i>
$ <i>emerge --oneshot --nodeps "=autoconf-2.1*" "=autoconf-2.6*" "autoconf-wrapper"</i>
$ <i>emerge --oneshot --nodeps "=automake-1.4*" "=automake-1.5*" "=automake-1.6*" "=automake-1.7*" "=automake-1.8*" "automake-wrapper"</i>
        <note><c>>=automake-1.9</c> and <c>libtool</c> are not (yet)
          installed at this stage.</note>
          Next, we have to get some tools in order to finalise getting
          the autotools in our prefix.  Because we installed <c>wget</c>
          in a temporary location, let's not forget to install it
          properly by emerging it now:
        <pre caption="emerge wget">
$ <i>emerge --oneshot --nodeps wget</i>
          After this we can emerge texinfo, which <c>automake-1.9</c>
        <pre caption="emerge texinfo">
$ <i>emerge --oneshot --nodeps texinfo</i>
          Now we can finish installing the autotools:
        <pre caption="finalise emerge autotools">
$ <i>emerge --oneshot --nodeps "=automake-1.9*" "=automake-1.10*"</i>
$ <i>emerge --oneshot --nodeps libtool</i>
          Now we have some decent autotooling stuff around, we can get
          some decent core utilities in our prefix.
        <pre caption="emerge coreutils">
$ <i>emerge --oneshot --nodeps sys-apps/coreutils</i>
          Finally we emerge <c>python</c>, <c>findutils</c> and
          <c>tar</c> in our prefix.  These are the last packages that we
          temporarily installed to bootstrap our system.
        <pre caption="emerge python">
$ <i>emerge --oneshot --nodeps python</i>
$ <i>emerge --oneshot --nodeps findutils</i>
$ <i>emerge --oneshot --nodeps tar</i>
          Before we continue to emerge all ebuilds from <c>system</c>,
          we first install <c>portage</c>.  We need to overwrite the
          version that was installed by the bootstrap script.
          Installing a new portage will make sure it uses the tools
          provided by the prefix, and forget about the temporary
          installed tools.
        <pre caption="emerge portage">
$ <i>env FEATURES="-collision-protect" emerge --oneshot --nodeps portage</i>
          Next, we get GNU <c>awk</c>, as most ebuild expect this
          <c>awk</c> when they use it.
        <pre caption="emerge gawk">
$ <i>emerge --oneshot gawk</i>
          Some, if not many, scripts and tools within a Gentoo system
          assume the availability of the <c>baselayout</c> package.  We
          make sure here we have it, for this reason.  In fact, it would
          be emerged too late if we wouldn't do it manually now:
        <pre caption="emerge baselayout-prefix">
$ <i>emerge --oneshot --nodeps baselayout-prefix</i>
          Now we're about to start the big work, we remove the temporary
          directory and its use as we got it all in our prefix now.  You
		  may have not used this directory if you didn't bootstrap
        <pre caption="remove tmp directory">
$ <i>rm -Rf $EPREFIX/tmp/*</i>
$ <i>hash -r</i>
          Next, we do the real work where all packages get reemerged in
          such an order that they make use of packages in the prefix
        <pre caption="emerge system">
$ <i>emerge -e system</i>
          This will happily install a lot of stuff and reinstall what
          you emerged before.  This is necessary to avoid compilation
          failures due to dependencies.
          Since we have some basic stuff now, we might want the benefit
          of an updated tree.  To use it, emerge <c>subversion</c>:
        <pre caption="emerge subversion">
$ <i>emerge subversion</i>
          We can now update the tree.  Since snapshots now are actually
          (anonymous) SVN checkouts of the tree, we can immediately use
          SVN commands on the tree instead of checking a tree out first.
          Because Portage knows how to deal with the SVN tree, and the
          bootstrap script has set a correct <c>SYNC</c> variable in
          your <path>etc/make.conf</path>, updating the tree is done
        <pre caption="Updating the tree">
$ <i>emerge --sync</i>
          To really do this properly, after emerging <c>system</c>, one
          should re-emerge <c>world</c>, because now all packages can
          be compiled with all tools from the prefix, instead of based
          on tools in the system root.  Before you do though, this is
          the good time to set your general <c>USE</c>-flags, such as
          <c>nls</c> to get localised messages in
          <path>$EPREFIX/etc/make.conf</path>.  In that file, you
          can also set <c>CFLAGS</c> for your compilation.  Be
          conservative with <c>CFLAGS</c>!  Note that the code below is
          an example, and is meant for inspiration only.
        <pre caption="Customising the prefix installation - example">
$ <i>echo 'USE="unicode nls"' >> $EPREFIX/etc/make.conf</i>
$ <i>echo 'CFLAGS="-O2 -pipe"' >> $EPREFIX/etc/make.conf</i>
          Since we're about to rebuild our system for the last time, we
          can unset all hacks we made to help the bootstrap process.
          This time we emerge <c>world</c> to include the packages
          necessary for <c>subversion</c>.
        <pre caption="Unsetting LDFLAGS and CPPFLAGS variables">
$ <i>unset LDFLAGS</i>
$ <i>unset CPPFLAGS</i>
$ <i>emerge -e world</i>
          tcsh users can use <c>unsetenv LDFLAGS</c> and alike for
          After <c>world</c> has emerged successfully, your prefix will
          be set up properly, and you can emerge the whichever tools you
          choose from the prefix tree.
    </section><!-- }}} -->

    <section><!-- {{{ Using the Prefix -->
      <title>Using the Prefix</title>
          To use your bootstrapped prefix environment, you best start a
          shell from the prefix, such that your path and other
          environment variables are set correctly.  To facilitate in
          this, a small helper script can be created by the bootstrap
        <pre caption="Creating a start-script">
$ <i>cd $EPREFIX/usr/portage/scripts</i>
$ <i>./ $EPREFIX startscript</i>
          After running this, a script <c>startprefix</c> will be
          present in <c>$EPREFIX</c>.  You can freely move the script to
          e.g. your homedir for convenience.  Running the script will
          drop you into a prefix shell, where for example <c>emerge</c>
          is directly at your disposal.  Enjoy your prefix!



<!-- vim: set expandtab ts=2 sw=2 foldmethod=marker foldenable spell spelllang=en_gb: -->
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->

gentoo-commits@g.o mailing list