Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing Gentoo 2004.3: Stage 1 NPTL on a Stage 3 Tarball
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3 ... 16, 17, 18  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 1:35 am    Post subject: Installing Gentoo 2004.3: Stage 1 NPTL on a Stage 3 Tarball Reply with quote

NOTICE: This version of the Stage 1/3 Guide is DEPRECATED. The current version is located >> HERE <<.

---------------------------

The Text of This Tutorial is Copyright 2005 by Bob P and The Jackass! Project. All Rights Reserved.

:arrow: Stage 1/3 Guide for 2005.0 Now Available. Click Here.



----------------------------------------------------------------------------------------------------------------

Stage 1/3 Installation for Gentoo 2004.3

WARNING: This is an ADVANCED installation method. The amount of time required for you to complete this type of installation will equal or exceed that of any other Gentoo installation method. Your time will be well invested, though, as the result will be a very stable Gentoo system. This installation method may prove to be somewhat difficult and cumbersome for users who are new to Gentoo. It will prove especially painful for users who plan to install Gentoo old hardware.

NOTE: The Documentation, Tips & Tricks Forum is NOT a support forum. If you should encounter problems during your Gentoo installation, please DO NOT post requests for assistance to this thread. Please seek help in the support thread that is dedicated to this installation method.


Faster than a Speeding Bullet... More Powerful than a Locomotive!

How To Build a Fast and Bulletproof Gentoo System -- Stage 1 NPTL Installation on a Stage 3 Tarball Using GCC 3.4.3

Introduction

Any Gentoo installation that is performed with anything other than a Stage 3 tarball suffers from two problems: They suffer from circular dependencies within the base system, and they have the potential to leave behind unwanted files from the stage tarball because /var/db/pkg is incomplete.

As rac noted, "There are some 80+ packages in a stage1ball that are not listed in /var/db/pkg. Why? When you do your "emerge system", you would want your new toolchain to be used to compile all software. If portage sees that a particular version from the stageball is still current, it will omit it. The solution that somebody apparently chose was to make portage forget that most of this software is installed at all, which has the unfortunate side effect of making portage be unable to clean it when your "emerge system" finishes."

So it seems that there are some good reasons to never install from a Stage 1 tarball, and some good reasons to always install from a Stage 3 tarball. The good news is that you can perform a Stage 1 installation using a Stage 3 tarball and have the best of both worlds.

Objective

This Installation Guide will describe how to perform a "Stage 1 on 3" installation of Gentoo on a Pentium-class x86 platform using 2004.3 installation media, a single CD-ROM drive and a single EIDE hard disk. It will take advantage of the latest 2.6 kernels, NPTL threading, udev, and the latest GCC 3.4.3 compiler.

As you read this, you might be thinking: "Why a Pentium-class PC?" Depending upon how you look at it, the answer can be simple or complex; The simple answer is that a Pentium-class PC is the only computer that I have left that doesn't already have Gentoo installed on it, and as I write this Guide I'm working on a project to turn that PC into a linux-based a router. The complex answer relates to compatability of this installation method on a heterogeneous group of PCs; A pentium processor is probably the most recent platform that is a common ancestor for all of the x86-class processors (AMD or Intel) that Gentoo is likely to run upon.

This guide is loosely based upon a combination of the Gentoo Installation Handbook, ali3nx's Stage 1 and NPTL tutorial, and a collection of tweaks to modify these installation methods to make them compatible for installation using a Stage 3 tarball. The adaptations that were required to make these methods work well with a Stage 3 tarball became extensive enough that it seemed worthwhile to create this thread as an independent installation guide. Although most of this should look familiar, I'm adding my own ideas about specific optimizaitons that need to be made to take advantage of new features offered by the GCC 3.4.3 compiler.


To perform a Stage 1 Installation on a Stage 3 Tarball, follow these steps:


1. Download and Burn the Minimal Installation CD. The .ISO image required for the hardware used in this example is
Code:
http://gentoo.osuosl.org/releases/x86/2004.3/livecd/install-x86-minimal-2004.3-r1.iso


2. Boot using the Minimal Installation CD. At the "boot:" prompt, press <Enter> to select the default gentoo kernel.


3. Configure LAN Card. We're assuming that your LAN card has been recognized and that you can obtain a LAN connection via DHCP.

Code:
# dhcpcd eth0


4. Configure Your Hard Disk

4.1 View the Hard Drive's Operational Parameters. In this example we will assume that only one hard disk will be installed on the system. It will be recognized by Gentoo as /dev/hda. We will start off by viewing the default disk parameters at boot:

Code:
 # hdparm /dev/hda

/dev/hda:
multcount    = 16 (on)
IO_support   = 0 (default 16-bit)
unmaskirq    = 0 (off)
using_dma    = 1 (on)
keepsettings = 0 (off)
readonly     = 0 (off)
readahead    = 256 (on)
geometry     = 16383/255/63, sectors = 120034123776, start = 0


 # hdparm -i /dev/hda

/dev/hda:

Model=WDC WD1200JB-00GVA0, FwRev=08.02D08, SerialNo=WD-WMAL92634373
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq}
RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=74
BuffType=DualPortCache, BuffSize=8192kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=234441648
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes:  pio0 pio1 pio2 pio3 pio4
DMA modes:  mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=no, WriteCache=enabled
Drive conforms to: device does not report version:

* signifies the current active mode


4.2 Tweak the Hard Disk Parameters with Hdparm. In this example we're using a WD1200JB. Its possible to get a little better performance out of this drive by issuing a few parameters with hdparm. The following parameters work well with this drive:

Code:
# hdparm -a256A1c1d1m16u1 /dev/hda

/dev/hda:
setting fs readahead to 256
setting 32-bit IO_support flag to 1
setting multcount to 16
setting unmaskirq to 1 (on)
setting using_dma to 1 (on)
setting drive read-lookahead to 1 (on)
multcount    = 16 (on)
IO_support   =  1 (32-bit)
unmaskirq    =  1 (on)
using_dma    =  1 (on)
readahead    = 256 (on)


4.3 Test the Hard Drive's Performance.

Typical results for a Pentium-class PC without UDMA:

Code:
# hdparm -tT /dev/hda

/dev/hda:
Timing cached reads:   144 MB in  2.04 seconds =  70.60 MB/sec
Timing buffered disk reads:   26 MB in  2.65 seconds =    9.81  MB/sec


Typical results for a Pentium 3 with UDMA66:

Code:
# hdparm -tT /dev/hda

/dev/hda:
Timing cached reads:   520 MB in  2.01 seconds =  258.75 MB/sec
Timing buffered disk reads:   114 MB in   3.01 seconds =  37.90  MB/sec


4.4 Partition the Hard Drive

4.4.1 Display the Partition Information

Technically, the syntax of this command is used to change the partition information, but on an unpartitioned drive it will display the partition information that is available:

Code:
# fdisk /dev/hda

The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and in certain setups could cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)


Command (m for help): p

Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System

Command (m for help):


4.4.2 Plan Our Partition Scheme:

To keep it simple, we're going to use the following partition scheme. I'll leave out the details, assuming that you know how to partition your hard disk.

Code:
Partition File System    ID  Size      Description
/dev/hda1 ReiserFS 3.6   83  100 MB    Boot partition
/dev/hda2 (swap)         82  512 MB    Swap partition
/dev/hda3 ReiserFS 3.6   83  Remainder Root Partition


4.4.3 Partition the Hard Disk (Boring details omitted in the interest of brevity)

4.4.4 Verify the partition configuration.

Code:
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device     Boot   Start    End     Blocks    Id  System
/dev/hda1    *        1     13     104391    83  Linux
/dev/hda2            14     76     506047+   82  Linux swap
/dev/hda3            77  14593  116607802+   83  Linux


4.4.5 Exit Fdisk and Save the Partition Layout Press "w" to write the partition table to disk and exit fdisk.

Code:
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks


4.5 Installing File Systems. This example covers the installation of Reiser FS 3.6 on the /boot and /root partitions, and swap on the /swap partition.

4.5.1 Install Reiser FS on /dev/hda1 and /dev/hda3:

Code:
# mkreiserfs /dev/hda1 && mkreiserfs /dev/hda3

You will need to answer "Y" when asked if you want to continue installing Reiser FS on the hard disk.

4.5.2 Install the swap partition on /dev/hda2:

Code:
# mkswap /dev/hda2 && swapon /dev/hda2


4.6 Mounting the File Systems. Mount the partitions using the "mount" command.

Code:
# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot



5. Installing the Gentoo Installation Files.

5.1 Download the Stage 3 Tarball from the Internet.

Go to the gentoo mount point on your hard disk:

Code:
# cd /mnt/gentoo


We will need to download 2 files from the mirrors: The Stage 3 tarball and its checksum file. These files are located on the mirrors in the following directory: /releases/x86/2004.3/stages/x86/

We will download the following four files using the "wget" command at the bash prompt. The entire command must be typed on one line:

Code:
# wget http://gentoo.osuosl.org/releases/x86/2004.3/stages/x86/stage3-x86-2004.3.tar.bz2

# wget http://gentoo.osuosl.org/releases/x86/2004.3/stages/x86/stage3-x86-2004.3.tar.bz2.md5


If you need to check the list of Gentoo Mirrors, Click Here.
(If your architecture is not x86 you will need to change the path and filename to suit your needs.)


5.2 Verify the md5sum of the Tarballs.

Code:
# md5sum -c stage3-x86-2004.3.tar.bz2.md5
stage3-x86-2004.3.tar.bz2: OK


5.3 Unpack the Stage 3 Tarball. Unpack the Stage 3 tarball using the following command.

Code:
tar -xjpvf stage3-x86-2004.3.tar.bz2


Now is a good time to take a break to re-dose with some caffeine, as this will take a little while...


5.4 Installing Portage

5.4.1 Download a Fresh Portage Snapshot from the Internet.

Code:
# wget http://gentoo.osuosl.org/snapshots/<most_recent_snapshot>.tar.bz2

5.4.2 Extract the Portage Snapshot

Code:
tar -xjvf /mnt/gentoo/<portage_snapshot>.tar.bz2 -C /mnt/gentoo/usr

The Portage snapshot files are named in the format "portage-YYYYMMDD.tar.bz2", where YYYY, MM, and DD represent the numbers of the year, month, and day that the snapshot was created. As I write this Installation Guide, the most recent portage snapshot is portage-20050101.tar.bz2, so the commands to download, verify and extract the snapshot would look like this:

Code:
# wget http://gentoo.osuosl.org/snapshots/portage-20050101.tar.bz2
# wget http://gentoo.osuosl.org/snapshots/portage-20050101.tar.bz2.md5sum
# md5sum -c portage-20050101.tar.bz2.md5sum
# tar -xjvf /mnt/gentoo/portage-20050101.tar.bz2 -C /mnt/gentoo/usr

Some of these steps will take a while to complete.



6. Installing the Gentoo Base System

6.1 Copy DNS Information Copy the DNS information in /etc/resolv.conf to ensure that networking works in our new Gentoo environment.

Code:
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf



6.2 Mount the proc filesystem We will mount the /proc file system to allow our Gentoo installation to use kernel-provided information within the chrooted environment.

Code:
# mount -t proc none /mnt/gentoo/proc
# cp /proc/mounts /mnt/gentoo/etc/mtab



6.3 Chroot into the New Environment

Code:
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile



6.4 Set the Date and Time

6.4.1 Set the Correct Date and Time. The date command uses the syntax MMDDHHMMYYYY, where MM is the month, DD is the day, HHMM is the time, and YYYY is the year. As I type this, it is Sunday January 2, 2005 at 19:30:

Code:
# date 010219302005
Sun Jan  2 19:30:00 Local time zone must be set--see zic manual page 2005


6.4.2 Set the Time Zone Symlink. This example displays the available time zone selections for the Western Hemisphere:

Code:
# ls /usr/share/zoneinfo/America

I'll set the local time zone to Central Time because I live in Chicago. To do this, I first remove the symlink to the default time zone, and then replace it with a symlink to my local time zone:

Code:
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Sun Jan  2 19:32:50 CST 2005



6.5 Configuring the USE Flags, Portage Options, and Compile Options: /etc/make.conf

In this example, we're compiling for the x86 architecture and a Pentium-class i586 subarchitecture. Our CHOST setting will be i586-pc-linux-gnu.

We will use a small collection of USE flags in building our base system. You are free to add additional USE flags as needed to meet your specific system requirements.

Please note: The inclusion of the nptl USE flag and the exclusion of the nptlonly USE flag is intentional, in order to provide both NPTL threading support in glibc as well as fallback support for linuxthreads. The ithreads USE flag is used for the perl and libperl ebuilds.

Note that this Installation Guide recommends the stable software branch as default. If you choose to use the testing branch, proceed at your own risk.

Code:
# cat /etc/make.conf

CHOST="i586-pc-linux-gnu"
CFLAGS="-O2 -march=pentium -pipe"
CXXFLAGS=${CFLAGS}
#  "x86" refers to the stable  software branch
# "~x86" refers to the testing software branch
ACCEPT_KEYWORDS="x86"
PORTAGE_TMPDIR=/var/tmp
PORTDIR=/usr/portage
DISTDIR=${PORTDIR}/distfiles
PKGDIR=${PORTDIR}/packages
PORT_LOGDIR=/var/log/portage
PORTDIR_OVERLAY=/usr/local/portage
GENTOO_MIRRORS="<your mirror goes here> http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
RSYNC_RETRIES="3"
RSYNC_TIMEOUT=180
MAKEOPTS="-j2"
PORTAGE_NICENESS=3
AUTOCLEAN="yes"
FEATURES="sandbox ccache distlocks"
CCACHE_SIZE="512M"
USE="ithreads nptl"



6.6 Additional Portage Configuration

6.6.1 Create Portage Directories

The sample /etc/make.conf listed above specifies directories for Portage log files and overlays that are not included as part of a standard Gentoo installation. If you are going to use the logging and overlay functions listed in the sample make.conf file, then you will need to create two additional directories on your system.

Code:
# mkdir /var/log/portage
# mkdir /usr/local/portage


6.6.2 Package Keywords - Enabling GCC 3.4.3 in the Stable Branch

Skip this step and proceed to the next section if you have configured your system to use the "~x86" testing branch.

At the time that I write this guide, GCC 3.4.3 is part of the unstable or "testing" branch in Portage. Because we are using the "x86" stable branch of the software, then we need to configure Portage to enable the use of GCC 3.4.3 and some other toolkit components, even though they are currently classified in the testing branch.

To configure a stable branch system to utilize a testing branch ebuild, we need to let Portage know that we have approved this subset of the testing branch for use on our system. This is accomplished by specifying the name of the package and the applicable keyword in the /etc/portage/package.keywords file. We will enable support for four testing branch ebuilds in our system.

Code:
# cat /etc/portage/package.keywords

sys-devel/gcc ~x86
sys-devel/gcc-config ~x86
sys-libs/libstdc++-v3 ~x86
sys-libs/glibc ~x86


6.6.3 Update the Portage Tree

We will now update our portage snapshot to include the current portage tree.

Code:
emerge --sync



6.7 Activate User Locales

When compiling glibc (we'll do this in an upcoming step), Gentoo's default behavior is to compile a full set of all of the available user locales. We will activate the userlocales local USE flag to limit the compilation of userlocales to those that we specify. Limiting the scope of userlocales will save us a tremendous amount of time while compiling glibc.

6.7.1 Activate the userlocales USE flag for glibc

Code:
# cat /etc/portage/package.use

sys-libs/glibc userlocales


6.7.2 Specify the user locales to build.

Create the /etc/locales.build file with your favorite editor. I'm located in the USA, so I'll use the following values.

Code:
# cat /etc/locales.build

en_US/ISO-8859-1
en_US.UTF-8/UTF-8


7. Building the Toolkit

7.1 Building the Toolkit: GCC 3.3.4

To enable NPTL support we are required to use a 2.6 kernel and linux26-headers. Unfortunately, the 2004.3 Stage 3 tarball includes linux-headers, which act as a blocker when attempting to emerge linux26-headers. In building the toolkit, we will first unmerge linux-headers and then emerge linux26-headers.

The linux kernel headers are typically updated only when updating a version of glibc. As a result, we should recompile glibc after emerging linux26-headers. We will also emerge new versions of binutils and upgrade to the current version of gcc when building our toolkit.

Code:
# env-update && source /etc/profile
# emerge -C linux-headers
# emerge linux26-headers
# emerge gcc-config glibc binutils gcc


Or if you prefer a one-liner:

Code:
# env-update && source /etc/profile && emerge -C linux-headers && emerge linux26-headers && emerge gcc-config glibc binutils gcc

This is a good opportunity to take an extended break, as these instructions will take quite some time to complete.



7.2 Re-Building the Toolkit: GCC 3.4.3

After emerging a new version of GCC, we need to pause for a moment and think about what we've done. We've just used GCC 3.3.4 and a toolchain built with GCC 3.3.4 to compile GCC 3.4.3. Before we spend any more time building our Gentoo system we should rebuild the entire toolchain, re-compiling it so that we have GCC 3.4.3 that was built with GCC 3.4.3.

Before we do this we need to examine /etc/make.conf and make changes to the CFLAGS statements in order to take advantage of the new performance-enhancing features of GCC 3.4.3. After making necessary updates to /etc/make.conf we need to rebuild the toolkit using the new GCC 3.4.3 compiler. The result will be a 3.4.3 tooklit, compiled by a 3.4.3 toolkit that was built with a 3.3.4 toolkit. Clear as mud? :roll:


7.2.1 Updating make.conf

Here are some settings for /etc/make.conf that may be worth considering. They are the actual CFLAGS that I used to build my systems and have proven reliable on multiple installations. They include extreme levels of code optimization (notice the -O3 flag), and some very safe and stable performance-enhancing CFLAGS. Depending upon your individual hardware, you may have to simplify some of the CFLAGS settings. Note that the referenced architecture in this example is Intel Pentium.

Code:
CFLAGS="-O3 -march=pentium -mtune=pentium -fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -ftracer -pipe"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"


If you don't feel comfortable using such extreme levels of optimization, you can ease-up on the CFLAGS settings and fall back to a less-optimized system. This will save you some compile time, at the expense of some system performance. You'll still be getting most of the benefits of GCC 3.4.3, so this isn't a bad compromise. This may be a better approach for those who don't want to be on the bleeding edge or don't want to spend time troubleshooting.

Code:
CFLAGS="-O2 -march=pentium -mtune=pentium -pipe"
CXXFLAGS=${CFLAGS}


7.2.2 Configuring the Default C Compiler

Although we have emerged GCC 3.4.3, it has not been automatically installed as our default compiler. If you have any doubts about this, take a quick peek at the output of "emerge info" or "gcc-config -l". Although GCC 3.4.3 has already been ermerged, GCC 3.3.4 is still installed as out default compiler:

Code:
# gcc-config -l
[1] i386-pc-linux-gnu-3.3.4 *
[2] i386-pc-linux-gnu-3.4.3
[3] i386-pc-linux-gnu-3.4.3-hardened
[4] i386-pc-linux-gnu-3.4.3-hardenednopie
[5] i386-pc-linux-gnu-3.4.3-hardenednossp



Change the default compiler to gcc 3.4.3 by issuing the following command:

Code:
# gcc-config 2


7.2.3 Updating the System Environment

An additional command updates our system environment:

Code:
# env-update && source /etc/profile


7.2.4 Rebuilding the System Toolkit

Now its time to rebuild the toolkit. We'll start off by recompiling glibc, binutils, gcc, and by updating portage. This will rebuild our GCC 3.4.3 compiling toolkit (which had previuosly been compiled with GCC 3.3.4) with the GCC 3.4.3 compiler, taking advantage of our new USE flags and CFLAGS compiler settings.

Code:
# emerge glibc binutils gcc portage


Upon completion of the rebuild of the compiling toolkit, we will recompile the entire system to assure that our entire toolkit has been compiled using GCC 3.4.3 and our hardware-specific settings.

The result will be a 3.4.3 tooklit and an entire system that is built with a 3.4.3 toolkit, that was built with a 3.4.3 toolkit. :wink:

Code:
# emerge -e system 


7.2.5 Summary

Although these command have been broken down into separate steps for the purpose of clarity, they can be concatenated into three steps. The one-liners in Steps 1 and 3 will take quite some time to complete, and represent good opportunities for you to take an extended break while Gentoo does its thing.

Step 1:
Code:
# env-update && source /etc/profile && emerge -C linux-headers && emerge linux26-headers && emerge gcc-config glibc binutils gcc

Step 2: update your USE flags and CFLAGS in /etc/make.conf

Step 3:
Code:
# gcc-config 2 && env-update && source /etc/profile && emerge glibc binutils gcc portage && emerge -e system




8.0 Building the World

8.1 Emerge Ccache (Optional)

Now that our toolkit has been built, we'll emerge the ccache program. Ccache is a compiler cache that will help to reduce compile times when previously compiled programs are being recompiled. It will not effect the time required to compile programs on the first pass, so this is an optional step. (Note: the ccache_size was set to 512 MB in the sample make.conf. If you have sufficient disk space, and you're planning on emerging a bloated window manager like Gnome or KDE (or if you are performing an emerge -e system or an emerge -e world), then you may want to increase the to something like ccache_size="2G".)

Code:
# emerge ccache


8.2 Emerging Programs

Now its time to add a few useful packages to our world profile:

Code:
# emerge syslog-ng xinetd grub vixie-cron reiserfsprogs sysfsutils udev dhcpcd hotplug coldplug gentoolkit

# emerge --nodeps acpid ntp


8.3 Updating the Environment

Now we'll add these services to the default runlevel. Here two ways to accomplish this task that are functionally equivalent. Choose the one you like best.

Code:
# rc-update add syslog-ng default
# rc-update add net.eth0 default
# rc-update add vixie-cron default
# rc-update add xinetd default
# rc-update add sshd default
# rc-update add hotplug default
# rc-update add coldplug default
# rc-update add acpid default
# rc-update add ntp-client default

or if you're an ub3r-g33k, try this cool bash loop :cool: that saves alot of typing:

Code:
for x in syslog-ng net.eth0 vixie-cron xinetd sshd hotplug coldplug acpid ntp-client ; do rc-update add $x default ; done


8.4 Configuring the NTP Client

In the previous steps we emerged a Network Time Protocol client to allow us to use NTP time servers to synchronize our system clock. In this step we'll configure the ntp-client to eliminate clock skew:

Code:
# ntpdate -b -u pool.ntp.org



9. Kernel

9.1 Downloading the Kernel

The decision to enable NPTL support requires that we use a 2.6 kernel. You are free to choose any flavor of 2.6 kernel that you like. In this example, we’ll be using the Gentoo Development Sources kernel. Note that a 2.4 kernel will not work properly with this Installation Guide.

Code:
# emerge gentoo-dev-sources


9.2 Building the Kernel Symlink

Code:
# rm /usr/src/linux
# cd /usr/src
# ln -s linux-2.6.10-gentoo-r2 linux


9.3 Configuration

9.3.1 Enable udev Support

Edit your /etc/conf.d/rc file so that it contains the following statements:

Code:
RC_NET_STRICT_CHECKING="no"
RC_DEVICES="udev"
RC_DEVICE_TARBALL="no" 


9.3.2 Configure Kernel Options

If you're following this Installation Guide, we're going to assume that you want the best performance from your system, and that you'll be using a custom-compiled kernel instead of genkernel. When configuring your kernel, be sure to include support for hotplug firmware loading. Also be sure to remove devfs filesystem support, as we are designing udev support into our system.

Configure the kernel:

Code:
# cd /usr/src/linux
# make menuconfig 


9.3.3 Compiling the Kernel

To compile your kernel and install the kernel and selected modules, issue the following command. I find that this one works a bit better than some of the other one-liner kernel compilation commands. If you should run into a problem where kernel compilation fails, its easy to determine where the problem was. In addition, this command will also install the kernel for you:

Code:
# make && make modules && make modules_install && make install 




10. Configuring the System

10.1 Configure Network Adapters

Configure your network adapters as recommended in the Gentoo Installation Handbook. In our case, we'll use DHCP:

Code:
# cat /etc/conf.d/net
iface_eth0="dhcp"
dhcpcd_eth0="-t 10"


If this isn't suitable for you, consider these options as listed in the GIH:

Code:
# (For DHCP)
iface_eth0="dhcp"
# Some network admins require that you use the
# hostname and domainname provided by the DHCP server.
# In that case, add the following to let dhcpcd use them.
# That will override your own hostname and domainname definitions.
dhcpcd_eth0="-HD"
# If you intend on using NTP to keep your machine clock synchronized, use
# the -N option to prevent dhcpcd from overwriting your /etc/ntp.conf file
dhcpcd_eth0="-N"

#(For static IP)
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"

#(For rp-pppoe)
iface_eth0="up"



10.2 Set Hostnames and Domainnames

The following hostname and domainname locations referenced in the Gentoo Installation Handbook and some of the other HowTo appear to have been deprecated. The first example in each of the following two sections uses the old configuration method, which has been deprecated but this is not yet reflected in many of the installation guides. The second option in each of the following two examples is more current:

10.2.1 Set Your Hostname

The following examples provide instruction for setting the hostname on your Gentoo box. Since we're installing Gentoo on an old Pentium-class PC, we'll use the "boatanchor" as the hostname in this example.

Code:
# echo boatanchor > /etc/hostname

or
Code:
# cat /etc/conf.d/hostname
HOSTNAME="boatanchor"


10.2.2 Set Your Domainname


Code:
# echo mydomain.com > /etc/dnsdomainname
# echo nis.mydomain.com > /etc/nisdomainname

or
Code:
# cat /etc/conf.d/domainname
OVERRIDE=1
DNSDOMAIN="mydomain.com"
NISDOMAIN="nis.mydomain.com"


10.2.3 Update /etc/hosts

If nameservers on your network handle all name resolution, then you can skip this step.

If your PC is a standalone system, or if your PC has a static IP address and you don't have DNS entries for your machine in a nameserver somwehere on your network, then you should specify the following information in the /etc/hosts file.

Code:
127.0.0.1             localhost.localdomain       localhost
static.ip.addr.ess    boatanchor.mydomain.com     boatanchor

The value of "static.ip.addr.ess" needs to be substituted with the IP address of your Gentoo box. For example, if your Gentoo box's IP address is 192.168.0.5, your /etc/hosts file should contain the following lines.

Code:
127.0.0.1        localhost.localdomain       localhost
192.168.0.5      boatanchor.mydomain.com     boatanchor


10.2.4 Add domainname to the Default Runlevel

Code:
# rc-update add domainname default


10.3 Gensplash

For all of you eye-candy addicts who can't live without it, here's the section where we add gensplash to give us those ultra-cool :cool: framebuffer images in our consoles. Because some of us have really big monitors, we'll configure splash screens at your choice of 1024x768, 1280x1024 and 1600x1200 resolutions:

Code:
# emerge splashutils && splash_geninitramfs -v -g /boot/fbsplash-emergence-1024x768 -r 1024x768 emergence && splash_geninitramfs -v -g /boot/fbsplash-emergence-1280x1024 -r 1280x1024 emergence && splash_geninitramfs -v -g /boot/fbsplash-emergence-1600x1200 -r 1600x1200 emergence && rc-update add splash default



10.4 Grub Bootloader

10.4.1 Grub.conf

To boot our installation of Gentoo Linux we'll need to configure a boot menu for the Grub Bootloader. Use your favorite text editor to create the /boot/grub/grub.conf file. In this case we'll use nano:

Code:
# cd /boot/grub
# nano -w grub.conf


You can either cut and paste the following text into the file, or type it in manually. Note that the lines beginning with the word "kernel" and ending with the words "splash=verbose,theme:emergence" need to be typed on one line. In this example, we're using the vesafb-tng video driver, and the video= statements are formatted accordingly.

Code:
# Grub boot menu configuration file
#
# Boot automatically after 30 secs.
timeout 30

# By default, boot the second entry.
default 1

# Fallback to the first entry.
fallback 0

# Use default Grub Splash image
# splashimage=(hd0,0)/grub/splash.xpm.gz
#
# Use custom (downloaded) Gentoo Splash Image
splashimage=(hd0,0)/grub/gentoo.xpm.gz

# Boot Gentoo Linux (no framebuffer)
title Gentoo-2.6.10-r2 
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-16@85

# Boot Gentoo Linux at 1024x768 framebuffer resolution
title Gentoo-2.6.10-r2, 1024x768
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-24@85 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1024x768

# Boot Gentoo Linux at 1280x1024 framebuffer resolution
title Gentoo-2.6.10-r2, 1280x1024
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1280x1024-24@85 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1280x1024

# For installing GRUB into the hard disk
title Install GRUB into the hard disk
root (hd0,0)
setup (hd0)



10.4.2 Installing Grub onto the Hard Disk

Start Grub from the command prompt and use the following commands to embed grub into the hard disk. Remember, when counting hard disks we like to start at 1, but Grub likes to start at 0, so /dev/hda1 corresponds to hard disk 0, partition 0 in Grub.

Code:
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit


10.4.3 Download a Cool :cool: Grub Splash Screen

We'll also download a cool Gentoo-specific splash screen for Grub.

Code:
wget http://www.schultz-net.dk/downloads/grub/gentoo.xpm.gz



10.5 Filesystem - Configuring fstab

This is a sample /etc/fstab file that reflects the disk partition scheme used earlier in this Installation Guide. Make changes as appropriate if your partition scheme is different.


Code:
# <fs>               <mountpoint>  <type>       <opts>               <dump/pass>
/dev/hda1            /boot         reiserfs     noauto,notail        1 2
/dev/hda3            /             reiserfs     notail               0 1
/dev/hda2            none          swap         sw                   0 0

/dev/cdroms/cdrom0   /mnt/cdrom    iso9660      user,noauto,ro,exec  0 0
/dev/fd0             /mnt/floppy   auto         noauto,users         0 0

# NOTE: The next line is critical for boot!
none                 /proc         proc         defaults             0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files)
# Adding the following line to /etc/fstab should take care of this:

none                 /dev/shm      tmpfs        nodev,nosuid         0 0



10.6 Setting HD Paramaters

Back in Section 4 we developed optimized operating parameters for our hard disk. Now that we're in the chrooted environment of our newly designed Gentoo system, we need to make these configuration changes permanent. To do this, we'll write the HD parameters to the /etc/conf.d/hdparm file:

Code:
# cat /etc/conf.d/hdparm

disc0_args="-a256A1c1d1m16u1"
cdrom0_args="-d1c1u1"


After editing the contents of /etc/conf.d/hdparm type the following command to add hdparm to the boot runlevel.

Code:
# rc-update add hdparm boot



10.7 Set-Up User Accounts

We must change the password of the root user in our newly installed system. Then we will add non-root users to the system. Substitute the username examples "bob" and "mary" with your own usernames.

First, change the root password:

Code:
# passwd
New password: (Enter your new password)
Re-enter password: (Re-enter your password)


Now add users who will be allowed to "su" their way to temporary root status. These users must be added to the "wheel" user group:

Code:
# useradd -m -G users,wheel bob
# passwd bob
New password: (Enter bob's password)
Re-enter password: (Re-enter bob's password)


Now add non-root users to the system:

Code:
# useradd -m -G users mary
# passwd mary
New password: (Enter mary's password)
Re-enter password: (Re-enter mary's password)



10.8 Toggle NUMLOCK ON at Boot

If you'd like the NUMLOCK key to be toggled ON at system boot, execute the following command.

Code:
# rc-update add numlock default



10.9 Define Console Screen Blanking Interval

If you’re not happy with the standard screen blanking interval for the console (to me the screen always seems to blank too quickly), you can specify the desired interval (from 1 to 60 minutes) using the following command. Substitute “n” with the value of the desired blanking interval in minutes. A value of zero will disable screen blanking.

Code:
# setterm -blank n

This setting is only temporary; after rebooting the screen will resume blanking at the default interval. To make your changes permanent, issue the following command:

Code:
# echo “setterm –blank n” >> /etc/conf.d/local.start



10.10 Exiting Chroot and Unmounting Partitions

We will now exit the chrooted environment and unmount all of the mounted partitions.


Code:
exit
cd ~/
umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
swapoff /dev/hda2



11. REBOOT!

And now, the moment you've been waiting for!

Code:
# shutdown -r now

When the system reboots, you should be welcomed with the following greeting.

Code:
This is boatanchor.mydomain.com (Linux i586 2.6.10-gentoo-r2) HH:MM:SS

boatanchor login:

Have fun with your new Gentoo system!



12. If You Should Encounter Problems

The Documentation, Tips & Tricks forum is not a support forum:

Quote:
Documentation, Tips & Tricks
Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Moderator: Global Moderators

Please bear in mind that this thread is located in the Documentation, Tips & Tricks Forum, which is not a support forum. For this reason I would like to ask that we limit the context of this thread to posts that discuss problems with the Installation Guide that need to be corrected, or to ideas about how to improve the Stage 1 on 3 installation procedure itself. If you have a problem and you need help, please post your support request in the Official Stage 1 on 3 Support Thread in the Installing Gentoo forum.

At this time this Installation Guide has evolved to a fairly mature state, such that most problems that are likely to be encountered during an install are likely to be related to individual factors not attributable to the Installation Guide. It would seem fair if those who encountered problems with architecture specification, CFLAGS, etc. could post their requests for help in the appropriate support forums. (That way, once your personal support request is resolved, your problem will scroll off into oblivion instead of being preserved here forever, interspersed with this documentation.)

NOTE: Documentation, Tips & Tricks is NOT a support forum. Please do not post installation support requests into this thread. Please post in the support thread that is dedicated to this installation method.



13. Another Essential Tool: Emerge Wrapper for System Updates

This installation guide is focused on how to install Gentoo, and it specifically avoids the issue of how to maintain your Gentoo installation. Hielvc and MindEraser have developed a fabulous emerge wrapper for system updates that his highly recommended. Check out the following thread: An emerge wrapper for correctly building the toolchain.



14. Acknowledgements

Special thanks to kimchi_sg for his many comments that have helped to refine this Guide and for all of his help in the support thread.

Special thanks go to ali3nx for his helpful tutorial on building a Gentoo Stage 1 system using NPTL.

Special thanks also go to rac for sharing with us the great idea of building Stage 1 Gentoo installations using a Stage 3 tarball.

Thanks to the following people who have contributed to my understanding of Gentoo and helped me solve problems as I was learning my way around: hardcore, NeddySeagoon

The following people's comments on the Gentoo Forums on related threads have also contributed indirectly in the writing of this Installation Guide. Their names are listed in alphabetical order: heilvc, Hobbit-HK, irf2003, kimchi_sg, Oktane

My sincere apologies if I've left anyone out!



14. Corrections, Errors, Omissions

Please let me know if there are any errors or omissions in this document by sending me a personal message through the Gentoo Forums by clicking the link below.



15. Downloadable PDF Now Available

A copy of this Installation Guide is now available in PDF format. Click Here. Please note that it may not be updated as often as the on-line version of this guide.



16. Revision History

01-05-05: Corrected typos, Added relaxed CFLAGS statements, Added PDF document
01-06-05: Corrected typos, Added sample /etc/make.conf, Added NUMLOCK toggle at Boot
01-08-05: Reordered Portage Config to follow Chroot, Added "Gentoo" Grub Splash Screen
01-09-05: Create non-Standard Portage Directories
01-12-05: Cleaned up redundant CFLAGS, Reverted to Stable Branch
01-17-05: PDF Synchronized with On-Line Installation Guide
01-19-05: Corrected typos
02-20-05: PDF Sync, grub.conf, adduser to wheel group, plug for hielvc/MindEraser emerge wrapper
02-23-05: Link added to Support Thread
03-08-05: Emerge ccache, Setterm -blank
03-22-05: Revised proc mounting
03-28-05: Fixed localhost IP address typos
04-01-05: Removed superfluous USE flags
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks


Last edited by Bob P on Sat Feb 18, 2006 3:35 pm; edited 51 times in total
Back to top
View user's profile Send private message
/dev/random
l33t
l33t


Joined: 26 Nov 2004
Posts: 704
Location: Austin, Texas, USA

PostPosted: Wed Jan 05, 2005 3:08 am    Post subject: Reply with quote

In section 4.4.1 I think it should be fdisk /dev/hda instead of hdparm also if it's titled display partition information instead of create partitions then it really should be
fdisk -l
Other than that good job man.

Edit: Also to stay consistent with the handbook I suggest putting the kernel section before section 7.3 but that's entirely up to you.
Back to top
View user's profile Send private message
landon
Apprentice
Apprentice


Joined: 09 Mar 2004
Posts: 159

PostPosted: Wed Jan 05, 2005 3:25 am    Post subject: Reply with quote

ehe, you mentioned yourself in the list of acknowledgements. :lol:
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 3:47 am    Post subject: Reply with quote

landon wrote:
ehe, you mentioned yourself in the list of acknowledgements. :lol:

hey, i really like that guy -- he helped ALOT! :wink:
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2966

PostPosted: Wed Jan 05, 2005 3:22 pm    Post subject: Reply with quote

Bob: the cflags u put here are really too extreme. I'm afraid some n00b will use them and find that building of toolchain b0rks on "compiler cannot create c executables". Try toning them down a lot? :-)
Back to top
View user's profile Send private message
Insanity5902
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1228
Location: Fort Worth, Texas

PostPosted: Wed Jan 05, 2005 5:08 pm    Post subject: Reply with quote

Bob - nice how-to, i was thinking of writing one just like it as this is how I installed my last server.

I think you shouldn't suggest using all those CFLAGS. They are too extreme to be used in a How-To. You should only suggest
Code:
CFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe"

anything more might cause more trouble then it is worth.
_________________
Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 5:39 pm    Post subject: Reply with quote

Insanity5902 wrote:
Bob - nice how-to, i was thinking of writing one just like it as this is how I installed my last server.

Well, its the way that i reconfigured my P3-800 desktop and set-up my P-133 that will soon be a router. I figured that I might as well strike while the iron was hot, as if I hadn't written the tutorial sooner than later, somebody else might have beaten me to it. ;)


Insanity5902 wrote:
I think you shouldn't suggest using all those CFLAGS. They are too extreme to be used in a How-To.

Wow, I hadn't expected to take so much heat on the subject of CFLAGS. I guess I have a couple of points to say about them:

First, there's really no point in upgrading from GCC 3.3 to GCC 3.4 if you're not going to take advandage of the performance enhancing features that are available in 3.4. By upgrading to 3.4 and using the CFLAGS I've listed, you'll notice a significant performance increase on Intel architecture. (I haven't tried it on anything else). As others have noted in the GCC 3.4 thread, upgrading to 3.4.3, using these CFLAGS, and recompiling your system feels like you've had a hardware upgrade. If you're trying to get state of the art performance out of your box (that's why we're here, isn't it?), you're really doing yourself a disservice by not using optimization level 3 and the CFLAGS listed in this tutorial.

Second, these CFLAGS are well-tested on Intel architecture and are very stable. They've been tested by many people on Pentium, Pentium2, Pentium3 and Pentium4 systems without any problems. In spite of the fact that they look imposing, they really are not as bad as they seem! Experience has shown that they're indeed very safe ways to optimize your system. In addition, some of them are only enabled at optimization level -O3, so backing down to -O2 may be advisable for those that encounter problems or just don't want to deal with extreme levels of code optimization. But I think its only fair to mention that going from -O3 to -O2 and omitting some of those CFLAGS iis going to result in a tangible performance hit.

Third, its important to remember that by following this tutorial, the user is committing to the "~x86" branch, not "x86". We all know that "~x86" is not a branch for n00bs, so IMHO there's a limited amount of n00b friendliness that needs to be built into this tut. If I were still a n00b (some might argue that I am :)), I wouldn't think of a Stage 1 on 3 install as something reasonable to underake -- if you look at the Stage 1 NPTL thread, even the Gurus and L33ts missed some of the subtleties of performing the GCC upgrade in the Stage 1 on 3 context. In all respects, we're pushing the envelope to the maximal extent possible while keeping the system stable. For some people this approach may be over their heads. If that's the case, maybe a more traditional installation following the guidelines in the Gentoo Installation Handbook is a better idea. You know the saying: "If they can't run with the big dogs, they might as well stay on the porch." (Sorry, I just couldn't resist!)

Finally, I didn't say that anyone had to use those CFLAGS -- I only recommended them as being worth considering. I wouldn't have any objections if anyone decided to pare them down to the simpler set that you've recommended -- they just won't find their way onto my system because i'm trying to wring as much performance out of the code as possible. After all, I'm pushing some old hardware as far as it will go, and my intent is to be merciless in that regard. But following your suggestions, I think I'll upgrade the tutorial to mention a more conservative CFLAGS setting for those who aren't as gung-ho.

Thanks again for your compliments! ;)
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
Hauser
l33t
l33t


Joined: 27 Dec 2003
Posts: 650
Location: 4-dimensional hyperplane

PostPosted: Wed Jan 05, 2005 6:41 pm    Post subject: Reply with quote

I've recently built a system with gcc-3.4.3 (mainly because I want to use the '-march=pentium-m' flag) for my new laptop, the performance turns out to be quite impressive; the system was initially built on my AMD desktop (and runs on it! :wink: ), the laptop runs just as fast (pentium-m 725 1.6GHz) as the desktop system (actually the laptop feels a little bit faster for me, perhaps because it has 1G RAM!), even though my CFLAGS are pretty conservative ("-O2 -march=pentium-m -fomit-frame-pointer")
Of course I also use nptl, linux26-headers, but I've only got a few ~x86 packages:
Code:
 $ cat /etc/portage/package.keywords
=sys-devel/gcc-3.4.3-r1
=sys-libs/libstdc++-v3-3.3.3-r1

=sys-kernel/nitro-sources-2.6.9-r3

=x11-terms/mrxvt-0.3.11

=app-office/openoffice-ximian-1.3.6

=media-libs/freetype-2.1.7

media-gfx/855resolution ~x86

media-video/ffmpeg ~x86

Besides, I built from stage1. Before the bootstrap, I did (as far as I can remember):
Code:
# emerge --nodeps --oneshot linux26-headers
# USE="bootstrap" emerge --nodeps --oneshot gcc

This one was emerged with p3 flag, after gcc-3.4.3 was installed , I changed the flag to p-m and started the bootstrapping process.
I did 'gcc-config -c' several times to make sure portage was using 3.4.3, the whole process turned out to be quite smooth, and I'm quite happy with the result. :D
_________________
AMD Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro4, reiser4, linux26-headers+nptl

Do I like to compile everything?
Positive definite!


Last edited by Hauser on Wed Jan 05, 2005 8:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hobbit_HK
n00b
n00b


Joined: 11 Nov 2004
Posts: 54
Location: Israel

PostPosted: Wed Jan 05, 2005 7:06 pm    Post subject: Reply with quote

IIRC, opensp (and now also gettext) won't compile with (some of) these CFLAGS.. I don't know which one caused it to die, but when I returned to the conservative flags, everything went smooth...
Also, -fvisibility-inlines-hidden and -fvisibility=hidden are only valid for C++, and should be in CXXFLAGS

EDIT: Well, well! As soon as I moved the C++ flags to CXXFLAGS gettext compiles! You should fix that in your CFLAGS section..
_________________
- Hobbit HK :)

Don't use stage1\2 tarballs
Do a stage1 install from a stage3 tarball
Back to top
View user's profile Send private message
Insanity5902
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1228
Location: Fort Worth, Texas

PostPosted: Wed Jan 05, 2005 8:38 pm    Post subject: Reply with quote

Bob - I haven't read that much about the 3.4 cflags but according to what you said, you should pug a disclaimer that this is for the intel arch and that it might or might not cause problems.

There are a lot of threads around the forum now with the Devs saying they are going basically disregard all bugs with agressive cflags. They say if you want to get help you will have to recompile your program with the basic flags see if the problem still exists and then post a bug on it.


I didn't mention this up there but great article.
_________________
Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 9:06 pm    Post subject: Reply with quote

Hobbit_HK wrote:
EDIT: Well, well! As soon as I moved the C++ flags to CXXFLAGS gettext compiles! You should fix that in your CFLAGS section..

most of those CFLAGS were stolen from irf2003's contribution to the GCC thread. ;)
irf2003 wrote:
Code:

CFLAGS="-O2 -mtune=pentium4 -march=pentium4 -fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -frename-registers -fweb -ftracer -pipe "
CXXFLAGS=${CFLAGS}-fvisibility-inlines-hidden

my typing skills being what they are, i managed to get the cflags right on my testbed PC, but i mistyped them into the tutorial. D'Oh! :oops: Thanks for pointing out the error.

BTW, I'm happy to hear that putting these 'aggressive' CFLAGS into your make.conf solved some of your problems. :cool: ... and thanks for putting a link to this tutorial in your tag line! 8O
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Wed Jan 05, 2005 9:14 pm    Post subject: Reply with quote

Ok Bob_Ping on my parade :lol: nice Howto. But I agree with kimchi_sg ( tell em to go put solved on rac's thread, that should slow him down some :wink: ) about the CFLAGS. But thats for people to try and see what makes them happy. My 2 cents the fewer the better and on a serious note my first year and a half useing Gentoo was on a P166 and after doing the CFLAGS shuffel many times what I finally ended up wtih was "-march=pentium -Os -pipe". It built faster and was diffently quicker loading X and useing X apps.
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 9:24 pm    Post subject: Reply with quote

Insanity5902 wrote:
There are a lot of threads around the forum now with the Devs saying they are going basically disregard all bugs with agressive cflags. They say if you want to get help you will have to recompile your program with the basic flags see if the problem still exists and then post a bug on it.


this reminds me of a post by robmoss in the sticky GCC thread. Is that what you're referring to? I got the impression that the issue was about "x86" vs. "~x86" and "arch" vs. "~arch", not about compiler flags:
robmoss wrote:
<rant> For all those whinging about how this broke their box - I don't care. ~arch is for testing ebuilds, not packages. If you want an ebuild that we know works, use arch. If that doesn't work, complain! But if a ~arch ebuild doesn't work - for example, the gcc-3.4.3 ebuild screwing up the libtool stuff and gcc-config not running as it should have done - then file a bug. Don't whinge. Don't say you're leaving. You know what the risks are of running the testing tree is - instability. The packages themselves will be stable, but the ebuilds will not. That's what happened - the ebuild was still meant to be tested by people other than the one developer who'd had the chance to use it, and was himself only upgrading from one gcc-3.4.3 snapshot to another one, meaning he hadn't come across the bugs mentioned. </rant>


regarding the CFLAGS i've used here, robmoss actually called them "quite conservative." in my limited experience they shouldn't cause problems, but i agree they may not be for everyone. i've updated the tutorial to list some very basic CFLAGS as an alternative option.
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2966

PostPosted: Wed Jan 05, 2005 11:11 pm    Post subject: Reply with quote

Bob: I stand corrected on the aggressiveness of these cflags. :-)

Just a little correction to the amended CXXFLAGS... there should be a space after the curly bracket that ends the CFLAGS, and before the - that starts -fvisibility-inlines-hidden. Otherwise -fvisibility-inlines-hidden will be tacked onto the last CFLAGS option as one word. :-(

EDIT: How about putting this one on the gentoo wiki as well?

EDIT 2: You mentioned the command to add ntp-client to the default runlevel as 'ntp-client default'... obvious omission?


Last edited by kimchi_sg on Wed Jan 05, 2005 11:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
seringen
Apprentice
Apprentice


Joined: 03 Aug 2003
Posts: 163
Location: berkeley, california

PostPosted: Wed Jan 05, 2005 11:18 pm    Post subject: Reply with quote

I'm just wondering if people are actually ok with running hotplug and coldplug in the default runlevel. I've found that I've had to load them as boot runlevels as a way to actually get hal to work properly in my udev only system.

e.g. rc-update add coldplug boot #instead of default

am I really the only one with that problem/

p.s. 7.3.3 shouldn't read
Code:
ntp-client default &&
assuming people follow your advice above. Plus a lot of the things you take from the other list are only for servers. does a normal person really need to be running xinetd?

p.p.s. 8.3.1 should be
Code:
/etc/conf.d/[b]rc[/b]

p.p.p.s. 9.6 should be
Code:
rc-update [b]add[/b] hdparm boot
hth

Last edited by seringen on Thu Jan 06, 2005 1:57 am; edited 1 time in total
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Thu Jan 06, 2005 1:55 am    Post subject: Reply with quote

kimchi_sg wrote:
EDIT: How about putting this one on the gentoo wiki as well?

a Wiki? sure, that would be a great idea. but before i do that, i'd like to stomp out all of the little typos and bugs that have found their way into the document, and i'd like to get a few more installations under my belt to work out any kinks that may remain in the system. in the interim, i've posted the document as a print-optimized PDF. this should make it easier for people who need a hard copy during installation.

You can download it HERE.
(Note: it may not be updated as often as this tutorial.)

thanks everyone, for pointing out typos and such!
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
Insanity5902
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1228
Location: Fort Worth, Texas

PostPosted: Thu Jan 06, 2005 2:06 am    Post subject: Reply with quote

This is a very nice tut. I think it has came together quite well. I have been thinking about rebuilding my desktop machine. I might print off the pdf you have and follow it word by word to see how it turns out.

(my desktop needs to be cleaned off, this was my first gentoo install and I was still naive on the ways of portage. I like the way I have my laptop set up, using x86 and only doing ~x86 for specific apps instead of a pure ~x86 and a couple of hard-masked apps :P)
_________________
Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
Hobbit_HK
n00b
n00b


Joined: 11 Nov 2004
Posts: 54
Location: Israel

PostPosted: Thu Jan 06, 2005 1:16 pm    Post subject: Reply with quote

Am I the only one failing to compile opensp with these CFLAGS? I hope I can work this out somehow.. I don't want to emerge opensp seperately with conservative flags and leave it out on every emerge -e (system|world)...
_________________
- Hobbit HK :)

Don't use stage1\2 tarballs
Do a stage1 install from a stage3 tarball
Back to top
View user's profile Send private message
deXtuX
n00b
n00b


Joined: 02 Jan 2005
Posts: 11

PostPosted: Thu Jan 06, 2005 2:25 pm    Post subject: Reply with quote

When emerging media-libs/id3lib-3.8.3-r3, I got unsigned char* errors which resulted in a failed compile. I was using the following cflags/cxxflags (i.e the ones suggested above):

CFLAGS="-O3 -mtune=pentium4 -march=pentium4 -fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -frename-registers -fweb -ftracer -pipe"

CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -fvisibility=hidden"

(and gcc 3.4.3 r1)

I tried removing -fvisibility=hidden from the CXXFLAGS line and it emerged sucessfully.
Anyway, once emerge -e world is done ill try doing it again and seeing if I can post the exact error message, since I 'cleverly' managed to loose it after closing the console and overwriting the log.
Back to top
View user's profile Send private message
Hobbit_HK
n00b
n00b


Joined: 11 Nov 2004
Posts: 54
Location: Israel

PostPosted: Thu Jan 06, 2005 2:30 pm    Post subject: Reply with quote

LOL.. You need to be really good at your work to do BOTH things.. ;)
I would post the error message, but it's several pages long... It kinda repeats itself though..
Code:

: undefined reference to `OpenSP::Allocator::free(void*)'
RastEventHandler.o(.gnu.linkonce.t._ZN6OpenSP21EventHandlerMessengerD1Ev+0x13):
In function `OpenSP::EventHandlerMessenger::~EventHandlerMessenger()':
: undefined reference to `OpenSP::Messenger::~Messenger()'
RastEventHandler.o(.gnu.linkonce.t._ZN6OpenSP21EventHandlerMessengerD0Ev+0x14):
In function `OpenSP::EventHandlerMessenger::~EventHandlerMessenger()':
: undefined reference to `OpenSP::Messenger::~Messenger()'
RastEventHandler.o(.gnu.linkonce.t._ZN6OpenSP10LinkRulePiD1Ev+0x2b): In function
 `OpenSP::LinkRulePi::~LinkRulePi()':
: undefined reference to `OpenSP::Link::~Link()'
RastEventHandler.o(.gnu.linkonce.t._ZN6OpenSP10LinkRulePiD1Ev+0x46): In function
 `OpenSP::LinkRulePi::~LinkRulePi()':
: undefined reference to `OpenSP::Link::~Link()'
RastEventHandler.o(.gnu.linkonce.t._ZN6OpenSP1

And so on and so forth (just with changed functions names)..

EDIT: Ok.. Removing the visibility CXXFLAGS helps.. weird
EDIT2: Ok... -fvisibility=hidden is the problem here... I'll recompile my system w/o it then...
_________________
- Hobbit HK :)

Don't use stage1\2 tarballs
Do a stage1 install from a stage3 tarball
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Thu Jan 06, 2005 4:54 pm    Post subject: Reply with quote

Bob you should add a step somewhere after you untar the stage3 tartball. A good place would be while people are editing thier /etc/make.conf. To get a complete listing of all your emerges, no more lost errors logs you do this.
Code:

# PORT_LOGDIR is the location where portage will store all the logs it
#     creates from each individual merge. They are stored as YYMMDD-$PF.log
#     in the directory specified. This is disabled until you enable it by
#     providing a directory. Permissions will be modified as needed IF the
#     directory exists, otherwise logging will be disabled.
PORT_LOGDIR=/var/log/portage so to add it
echo "PORT_LOGDIR=/var/log/portage" >> /etc/make.conf
mkdir /var/log/portage


This a copy of what you see on the screen as something emerges.

EDIT wheres Thursday Next when you need her to gather up all these words and letters that keep escaping
_________________
An A-Z Index of the Linux BASH command line
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Thu Jan 06, 2005 5:30 pm    Post subject: Reply with quote

thanks to you brave souls who have been testing the tut on your hardware. i haven't had the problems with the CFLAGS on my Pentium or Pentium 3 testbeds, so i wonder if this may be architecture specific. what architecture are you guys running? at any rate, it seems that the problems are consistent enough that i'm going to remove "-fvisibility=hidden" from the CXXFLAGS.

heilvc, thanks for the recommendation about make.conf. i know that i haven't posted any recommendations for make.conf yet, and failure to set it up optimally may be causing problems for people with less experience. in my make conf, i have all of those portage directory options set and the logging directory created, but you're right -- these settings should be added to the guide.

i've hesitated to post my make.conf file, though, as i normally use the "userprivs usersandbox" in FEATURES so that portage doesn't run as root. the problem with doing this, though, is that there are plenty of broken ebuilds right now that generate dyn_test errors because of faulty handling of file privileges. the workaround, at present, is to remove "userprivs usersandbox" from FEATURES, but i consider that bad practice and hard to recommend. its sort of a Catch-22. its bad form to leave those features out, but until the ebuild bugs are squashed you have to do it for the broken ebuilds to compile. i'm going to bite the bullet and post a sample make.conf and add the step for creating the logging directory. thanks.
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
fbeauregard
n00b
n00b


Joined: 30 Dec 2004
Posts: 11

PostPosted: Thu Jan 06, 2005 9:14 pm    Post subject: Typo Reply with quote

I think there is a typo at step 6.6

The use flag userlocales is ok (therefore the content of /etc/portage/package.use is ok) but the file should be /etc/locales.build

Cheers,
François
Back to top
View user's profile Send private message
Hobbit_HK
n00b
n00b


Joined: 11 Nov 2004
Posts: 54
Location: Israel

PostPosted: Thu Jan 06, 2005 9:15 pm    Post subject: Reply with quote

Yeah I noticed that too...
And does anybody else have a problem compiling xorg-6.8.1?
_________________
- Hobbit HK :)

Don't use stage1\2 tarballs
Do a stage1 install from a stage3 tarball


Last edited by Hobbit_HK on Fri Jan 07, 2005 4:21 pm; edited 2 times in total
Back to top
View user's profile Send private message
fbeauregard
n00b
n00b


Joined: 30 Dec 2004
Posts: 11

PostPosted: Thu Jan 06, 2005 10:01 pm    Post subject: nptlonly use flag Reply with quote

I just noticed that http://gentoo-wiki.com/NPTL suggest the nptl and the nptlonly use flags. The howto only suggest nptl. Was this on purpose or an omission?

Cheers,
François
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3 ... 16, 17, 18  Next
Page 1 of 18

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum