Gentoo Logo

[ << ] [ < ] [ Home ] [ > ] [ >> ]


5. Installing the Gentoo Installation Files

Content:

5.a. Installing a Stage Tarball

Setting the Date/Time Right

Before you continue you need to check your date/time and update it. A misconfigured clock may lead to strange results in the future!

To verify the current date/time, run date:

Code Listing 1.1: Verifying the date/time

# date
Fri Mar 29 16:21:18 CEST 2013

If the date/time displayed is wrong, update it using the date MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year). For instance, to set the date to March 29th, 16:21 in the year 2013:

Code Listing 1.2: Setting the date/time

# date 032916212013

Making your Choice

The next step you need to perform is to install the stage tarball of your choice onto your system.

5.b. Downloading the Stage Tarball

Go to the Gentoo mountpoint at which you mounted your filesystems (most likely /mnt/gentoo):

Code Listing 2.1: Going to the Gentoo mountpoint

# cd /mnt/gentoo

The table below specifies exactly which stages you need for your system. Stages may be downloaded off the official Gentoo mirrors under the experimental/mips/stages directory.

Endianness CPU Notation
Big Endian
(SGI Users)
R4000
R4400
R4600
mips3
Big Endian
(SGI Users)
R5000
RM5200
RM7000
R10000
R12000
R14000
mips4
Little Endian
(Cobalt Users)
RM5230
RM5231
mipsel4
Little Endian
(Others)
All Standard CPU Types mipsel1

Warning: Although we provide stages for little-endian MIPS1, support for little endian MIPS systems is still restricted to the Cobalt server range. They are provided for those who may wish to experiment with Gentoo on presently unsupported platforms, thus it is assumed that you know what you're doing.

If you need to go through a proxy, export the http_proxy and ftp_proxy variables:

Code Listing 2.2: Setting proxy information for wget

# export http_proxy="http://proxy.server.com:port"
# export ftp_proxy="http://proxy.server.com:port"

The Gentoo/MIPS netboot images provide wget as a means of downloading files. Due to space constraints, it is not possible to provide more capable browsers on SGI netboot images. LiveCD users may use elinks.

Code Listing 2.3: Fetching the tarball via wget

# wget -c http://distfiles.gentoo.org/releases/mips/mips4/stage3-mips4-2008.0.tar.bz2

If you want to check the integrity of the downloaded stage tarball, use md5sum or sha1sum and compare the output with the MD5 checksum provided on the mirror. For instance, to check the validity of the mips4 stage tarball:

Code Listing 2.4: Example checking integrity of a stage tarball

# md5sum -c stage3-mips4-2008.0.tar.bz2.DIGESTS
stage3-mips4-2008.0.tar.bz2: OK
# sha1sum -c stage3-mips4-2008.0.tar.bz2.DIGESTS
stage3-mips4-2008.0.tar.bz2: OK

Unpacking the Stage Tarball

Now unpack your downloaded stage onto your system. We use GNU's tar to proceed as it is the easiest method:

Code Listing 2.5: Unpacking the stage

# tar -xjpf stage?-*.tar.bz2

Make sure that you use the same options (-xjpf). The x stands for Extract, the j for Decompress with bzip2, the p for Preserve permissions and the f to denote that we want to extract a file, not standard input.

Now that the stage is installed, continue with Configuring the Compile Options.

5.c. Configuring the Compile Options

Introduction

To optimize Gentoo, you can set a couple of variables which impact Portage behaviour. All those variables can be set as environment variables (using export) but that isn't permanent. To keep your settings, Portage provides you with /etc/make.conf, a configuration file for Portage. It is this file we will edit now.

Note: A commented listing of all possible variables can be found in /mnt/gentoo/etc/make.conf.example. For a successful Gentoo installation you'll only need to set the variables which are mentioned beneath.

Fire up a text editor so we can alter the optimization variables we will discuss hereafter. Two editors are provided, vi (part of Busybox) and nano. We will assume you're using nano.

Code Listing 3.1: Opening /etc/make.conf

# nano -w /mnt/gentoo/etc/make.conf

As you probably noticed, the make.conf.example file is structured in a generic way: commented lines start with "#", other lines define variables using the VARIABLE="content" syntax. The make.conf file uses the same syntax. Several of those variables are discussed next.

CFLAGS and CXXFLAGS

The CFLAGS and CXXFLAGS variables define the optimization flags for the gcc C and C++ compiler respectively. Although we define those generally here, you will only have maximum performance if you optimize these flags for each program separately. The reason for this is because every program is different.

In make.conf you should define the optimization flags you think will make your system the most responsive generally. Don't place experimental settings in this variable; too much optimization can make programs behave bad (crash, or even worse, malfunction).

We will not explain all possible optimization options. If you want to know them all, read the GNU Online Manual(s) or the gcc info page (info gcc -- only works on a working Linux system). The make.conf.example file itself also contains lots of examples and information; don't forget to read it too.

A first setting is the -march= flag, which specifies the name of the target architecture. Possible options are described in the make.conf.example file (as comments). Examples include ISA levels (mips1 ... mips4) and CPU models (r4400, r4600 ... etc). For pure ISA level architectures, one can simply specify -mips3 rather than -march=mips3.

Code Listing 3.2: The GCC -march and -mips# settings

(For an R4600 system...)
-march=r4600

(Any MIPS4-class CPU...)
-march=mips4

(Or just specify the ISA level directly...)
-mips4

A second one is the -O flag (that is a capital O, not a zero), which specifies the gcc optimization class flag. Possible classes are s (for size-optimized), 0 (zero - for no optimizations), 1, 2 or even 3 for more speed-optimization flags (every class has the same flags as the one before, plus some extras). -O2 is the recommended default. -O3 is known to cause problems when used system-wide, so we recommend that you stick to -O2.

Code Listing 3.3: The GCC O setting

-O2

A very important setting in the MIPS world is the -mabi= flag. MIPS has 3 different ABIs: 32 (pure 32-bit, aka o32), 64 (full 64-bit, aka n64) and n32 (a mix of 32-bit data structures with 64-bit instructions). This flag selects which of these you wish to use. Note you need libraries for the ABI you select. In layman's terms, this means, for example, you can't use -mabi=64 on a 32-bit userland (or even an n32 userland).

Another popular optimization flag is -pipe (use pipes rather than temporary files for communication between the various stages of compilation).

Using -fomit-frame-pointer (which doesn't keep the frame pointer in a register for functions that don't need one) might have serious repercussions on the debugging of applications.

When you define the CFLAGS and CXXFLAGS, you should combine several optimization flags, like in the following example:

Code Listing 3.4: Defining the CFLAGS and CXXFLAGS variable

CFLAGS="-mabi=32 -mips4 -pipe -O2"
CXXFLAGS="${CFLAGS}"                  # Use the same settings for both variables

Note: You may also want to view the Compilation Optimization Guide for more information on how the various compilation options can affect your system.

MAKEOPTS

With MAKEOPTS you define how many parallel compilations should occur when you install a package. A good choice is the number of CPUs (or CPU cores) in your system plus one, but this guideline isn't always perfect.

Code Listing 3.5: MAKEOPTS for a regular, 1-CPU system

MAKEOPTS="-j2"

Ready, Set, Go!

Update your /mnt/gentoo/etc/make.conf to your own preference and save (nano users would hit Ctrl-X). You are now ready to continue with Installing the Gentoo Base System.


[ << ] [ < ] [ Home ] [ > ] [ >> ]


Print

View all

Page updated December 17, 2013

Summary: Gentoo installs work through a stage3 archive. In this chapter we describe how you extract the stage3 archive and configure Portage.

Sven Vermeulen
Author

Grant Goodyear
Author

Roy Marples
Author

Daniel Robbins
Author

Chris Houser
Author

Jerry Alexandratos
Author

Seemant Kulleen
Gentoo x86 Developer

Tavis Ormandy
Gentoo Alpha Developer

Jason Huebel
Gentoo AMD64 Developer

Guy Martin
Gentoo HPPA developer

Pieter Van den Abeele
Gentoo PPC developer

Joe Kallar
Gentoo SPARC developer

John P. Davis
Editor

Pierre-Henri Jondot
Editor

Eric Stockbridge
Editor

Rajiv Manglani
Editor

Jungmin Seo
Editor

Stoyan Zhekov
Editor

Jared Hudson
Editor

Colin Morey
Editor

Jorge Paulo
Editor

Carl Anderson
Editor

Jon Portnoy
Editor

Zack Gilburd
Editor

Jack Morgan
Editor

Benny Chuang
Editor

Erwin
Editor

Joshua Kinard
Editor

Stuart Longland
Editor

Tobias Scherbaum
Editor

Xavier Neys
Editor

Joshua Saddler
Editor

Gerald J. Normandin Jr.
Reviewer

Donnie Berkholz
Reviewer

Ken Nowack
Reviewer

Lars Weiler
Contributor

Donate to support our development efforts.

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