Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Fabian Groffen (grobian)" <grobian@g.o>
Subject: gentoo commit in xml/htdocs/proj/en/gentoo-alt/prefix: bootstrap-linux.xml
Date: Fri, 07 Sep 2007 16:05:07 +0000
grobian     07/09/07 16:05:07

  Added:                bootstrap-linux.xml
  Log:
  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 : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-linux.xml?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/proj/en/gentoo-alt/prefix/bootstrap-linux.xml?rev=1.1&content-type=text/plain

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>
  </author>

  <abstract>
    How to bootstrap Prefixed Portage on your Linux system
  </abstract>


  <!-- The content of this document is licensed under the CC-BY-SA license -->
  <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
  <license/>

  <version>1.0</version>
  <date>2007-09-07</date>

  <chapter>
    <title>Bootstrapping on OS X</title>

    <section><!-- {{{ Introduction -->
      <title>Introduction</title>
      <body>
        <p>
          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.
        </p>
      </body>
    </section><!-- }}} -->

    <section><!-- {{{ Bootstrapping -->
      <title>Bootstrapping</title>
      <body>
        <p>
          As prerequisite, you need a GCC compiler, the GNU binutils
		  linker and system headers, such that source code can be
		  compiled into workin executables.
        </p>
        <p>
          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
          <path>$HOME/gentoo</path>.
          Whatever you chose, make sure you set it in your environment:
        </p>
        <pre caption="Export EPREFIX variable">
$ <i>export EPREFIX="$HOME/gentoo"</i>
        </pre>
        <note>
          tcsh users can use <c>setenv EPREFIX "$HOME/gentoo"</c>
          instead.
        </note>
        <p>
          Next, add the following paths in your soon to be prefix to
          your <c>PATH</c> environment.
          <path>$EPREFIX/bin</path>,
          <path>$EPREFIX/usr/bin</path>,
          <path>$EPREFIX/tmp/bin</path> and
          <path>$EPREFIX/tmp/usr/bin</path>.
          Adding these paths makes sure that they will be available
          later on in the process.
        </p>
        <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>
        </pre>
        <p>
          Now the path is set, start with downloading the bootstrap
          script from
          <uri>http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt</uri>.
          From the directory where the bootstrap script was stored execute
          the following commands:
        </p>
        <pre caption="Use the bootstrap script">
$ <i>chmod 755 bootstrap-prefix.sh</i>
$ <i>./bootstrap-prefix.sh $EPREFIX tree</i>
$ <i>./bootstrap-prefix.sh $EPREFIX/tmp python</i>
$ <i>./bootstrap-prefix.sh $EPREFIX portage</i>
        </pre>
		<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
			path.</note>
        <p>
          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:
        </p>
        <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>
        </pre>
        <p>
          Because we installed some new applications, we will instruct
          bash to reconsider all paths we have:
        </p>
        <pre caption="rehash in bash">
$ <i>hash -r</i>
        </pre>
        <note>
          tcsh users can use the <c>rehash</c> command.
        </note>
        <p>
          We continue adding some necessary tools which will deal with
          many errors and warnings you might see during emerging.
        </p>
        <pre caption="emerge sed">
$ <i>emerge --oneshot sed</i>
        </pre>
        <p>
          Next, we emerge the <c>bash</c> shell and its dependency
          ncurses.  <c>bash</c> is used extensively within portage and
          other applications.
        </p>
        <pre caption="emerge bash">
$ <i>emerge --oneshot bash</i>
        </pre>
        <note>
          It is safe to ignore the "1 config files in XXX need updating"
          message that appears till the end of the bootstrap process.
        </note>
        <p>
          We continue getting some autotools stuff into our prefix.
        </p>
        <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>
        </pre>
        <note><c>>=automake-1.9</c> and <c>libtool</c> are not (yet)
          installed at this stage.</note>
        <p>
          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:
        </p>
        <pre caption="emerge wget">
$ <i>emerge --oneshot --nodeps wget</i>
        </pre>
        <p>
          After this we can emerge texinfo, which <c>automake-1.9</c>
          needs.
        </p>
        <pre caption="emerge texinfo">
$ <i>emerge --oneshot --nodeps texinfo</i>
        </pre>
        <p>
          Now we can finish installing the autotools:
        </p>
        <pre caption="finalise emerge autotools">
$ <i>emerge --oneshot --nodeps "=automake-1.9*" "=automake-1.10*"</i>
$ <i>emerge --oneshot --nodeps libtool</i>
        </pre>
        <p>
          Now we have some decent autotooling stuff around, we can get
          some decent core utilities in our prefix.
        </p>
        <pre caption="emerge coreutils">
$ <i>emerge --oneshot --nodeps sys-apps/coreutils</i>
        </pre>
        <p>
          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.
        </p>
        <pre caption="emerge python">
$ <i>emerge --oneshot --nodeps python</i>
$ <i>emerge --oneshot --nodeps findutils</i>
$ <i>emerge --oneshot --nodeps tar</i>
        </pre>
        <p>
          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.
        </p>
        <pre caption="emerge portage">
$ <i>env FEATURES="-collision-protect" emerge --oneshot --nodeps portage</i>
        </pre>
        <p>
          Next, we get GNU <c>awk</c>, as most ebuild expect this
          <c>awk</c> when they use it.
        </p>
        <pre caption="emerge gawk">
$ <i>emerge --oneshot gawk</i>
        </pre>
        <p>
          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:
        </p>
        <pre caption="emerge baselayout-prefix">
$ <i>emerge --oneshot --nodeps baselayout-prefix</i>
        </pre>
        <p>
          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
		  python.
        </p>
        <pre caption="remove tmp directory">
$ <i>rm -Rf $EPREFIX/tmp/*</i>
$ <i>hash -r</i>
        </pre>
        <p>
          Next, we do the real work where all packages get reemerged in
          such an order that they make use of packages in the prefix
          itself.
        </p>
        <pre caption="emerge system">
$ <i>emerge -e system</i>
        </pre>
        <p>
          This will happily install a lot of stuff and reinstall what
          you emerged before.  This is necessary to avoid compilation
          failures due to dependencies.
        </p>
        <p>
          Since we have some basic stuff now, we might want the benefit
          of an updated tree.  To use it, emerge <c>subversion</c>:
        </p>
        <pre caption="emerge subversion">
$ <i>emerge subversion</i>
        </pre>
        <p>
          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
          using:
        </p>
        <pre caption="Updating the tree">
$ <i>emerge --sync</i>
        </pre>
        <p>
          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.
        </p>
        <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>
        </pre>
        <p>
          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>.
        </p>
        <pre caption="Unsetting LDFLAGS and CPPFLAGS variables">
$ <i>unset LDFLAGS</i>
$ <i>unset CPPFLAGS</i>
$ <i>emerge -e world</i>
        </pre>
        <note>
          tcsh users can use <c>unsetenv LDFLAGS</c> and alike for
          <c>CPPFLAGS</c>.
        </note>
        <p>
          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.
        </p>
      </body>
    </section><!-- }}} -->

    <section><!-- {{{ Using the Prefix -->
      <title>Using the Prefix</title>
      <body>
        <p>
          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
          script.
        </p>
        <pre caption="Creating a start-script">
$ <i>cd $EPREFIX/usr/portage/scripts</i>
$ <i>./bootstrap-prefix.sh $EPREFIX startscript</i>
        </pre>
        <p>
          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!
        </p>
      </body>
    </section>

  </chapter>

</guide>

<!-- 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


Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gentoo-x86 commit in app-vim/nerdcommenter: nerdcommenter-2.1.3.ebuild metadata.xml Manifest ChangeLog
Next by thread:
gentoo commit in xml/htdocs/proj/en/gentoo-alt/prefix: bootstrap-linux.xml
Previous by date:
gentoo-x86 commit in app-vim/nerdcommenter: nerdcommenter-2.1.3.ebuild metadata.xml Manifest ChangeLog
Next by date:
gentoo-x86 commit in media-video/winki: ChangeLog winki-0.4.4.ebuild


Updated Apr 06, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.