# HowTo: Using the gcc34-x86-2004.2 profile

## Snooper

This guide is intended to help those wanting to build a Gentoo system using the gcc34-x86-2004.2 profile, NPTL and a 2.6 kernel.

Getting started:

You will need a Gentoo 2004.2 LiveCD, and an internet connection.

Installing Gentoo Linux:

With your LiveCD burned to a disk and your Bios configured to boot from CD go head and restart your PC.

Refer to the Gentoo Hanbook for more information about obtaining and burning a Gentoo 2004.2 LiveCD.

Now boot from the LiveCD and type smp at the boot prompt.

```
boot: smp
```

smp is a 2.6 kernel that will allow proc to be populated with information from a running 2.6 kernel rather than a 2.4 kernel like gentoo.

Refer to the Gentoo Handbook for options passable to the kernel during boot.

Check to ensure your PC has the correct time.

```
date
```

Preparing your hard drive for Gentoo Linux:

In this guide i will use fdisk to partition my hard drive.

```
fdisk /dev/hda
```

You will need atleast a / (root) and swap partition.

Create filesystems and mount partitions.

```
mke2fs /dev/hda1

mke2fs -j /dev/hda5

mkswap /dev/hda6

swapon /dev/hda6

mount /dev/hda5 /mnt/gentoo

mkdir /mnt/gentoo/boot

mount /dev/hda1 /mnt/gentoo/boot
```

It is important that you have booted using the smp kernel at this point in order for glibc to be compiled with NPTL support the kernel loaded must support it ie: 2.6

Installing the Gentoo Installation Files:

Change to the /mnt/gentoo directory.

```
cd /mnt/gentoo
```

Use links to download a stage1 tarball from a gentoo mirror.

```
links http://www.gentoo.org/main/en/mirrors.xml
```

You must have networking configured and enabled.

After downloading the stage1 tarball extract it.

```
tar -xvjpf stage?-*.tar.bz2 && rm stage?-*.tar.bz2
```

Mounting the proc filesystem.

```
mount -t proc none /mnt/gentoo/proc
```

Configuring make.conf.

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

Included as an example:

```
CHOST="i686-pc-linux-gnu"

CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"

CXXFLAGS="${CFLAGS}"

USE="nptl"

ACCEPT_KEYWORDS="~x86"
```

Installing the Gentoo Base System 

Optional

Selecting mirrors.

```
mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf
```

This command will populate GENTOO_MIRRORS in make.conf.

Copy DNS info.

```
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
```

Before we chroot into the new Gentoo environment you may want to run passwd to change the root password so it is possible to log into another vt.

Chrooting into the new Gentoo environment.

```
chroot /mnt/gentoo /bin/bash

env-update && source /etc/profile
```

Syncing the portage tree.

```
emerge sync
```

Changing to the gcc34-x86-2004.2 profile.

```
unlink /etc/make.profile

ln -sf /usr/portage/profiles/gcc34-x86-2004.2 /etc/make.profile
```

Installing the 2.6 kernel headers.

```
emerge -C linux-headers

emerge --oneshot --nodeps linux26-headers
```

Bootstrapping the system.

```
cd /usr/portage

scripts/bootstrap.sh && env-update && source /etc/profile
```

To check if NPTL support was compiled into glibc type: /lib/libc.so.6 you should see NTPL in the output.

Building the base system.

```
emerge system && env-update && source /etc/profile
```

Configuring the Kernel

Configure timezone.

```
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
```

Remember to use your own timezone!

Selecting and configuring a kernel:

```
emerge gentoo-dev-sources
```

Refer to the Gentoo Handbook for other 2.6 kernels available and howto configure and install them.

Optional:

Installing udev.

```
emerge udev
```

Installing hotplug.

```
emerge hotplug && rc-update add hotplug default
```

Installing alsa.

```
emerge alsa-utils && nano -w /etc/modules.d/alsa && rc-update add alsasound boot
```

Refer to the ALSA Handbook for further information on configuring a sound card.

Configuring your System:

Refer to the Gentoo Handbook on editing fstab, rc.conf, and network configuration files.

Installing Necessary System Tools

Install a system logger.

```
emerge metalog && rc-update add metalog default
```

Install a cron daemon.

```
emerge vixie-cron && rc-update add vixie-cron default
```

Optional

Installing gentoolkit.

```
emerge gentoolkit
```

Contains tools for working with portage.

Configuring the Bootloader:

Installing grub.

```
emerge grub
```

Refer to the Gentoo Handbook on configuring grub.

Finishing up:

Setting a root password.

```
passwd
```

Creating a user.

```
useradd username -m -G users,wheel,audio,tty -s /bin/bash

passwd username
```

You can now safely exit and restart your PC and boot into your new Gentoo installation.

```
exit

cd /

umount /mnt/gentoo/boot

umount /mnt/gentoo/proc

umount /mnt/gentoo

reboot
```

----------

## g1um

nice howto, thx!

----------

## cybrjackle

ln -sf  /usr/portage/profiles/gcc34-x86-2004.2 /etc/make.profile

Your symlink is pointing to the wrong place on the profile.

----------

## chimpsky

when I try bootstraping it fails at gettext, I have a pentium-m and I'm using that in the march flag of my CFLAGS. Has anyone else had this problem ???

----------

## cybrjackle

You should probably put that in another forum instead of Tips & Tricks, with the error message you have.   Start up a thread under "Installing" explain your problem and post error message.

----------

## robertmcm

Your instructions worked for me. I am now have kde up and running. It does seem faster. One question though what does the following do at the ent of the profile file 

alias cp='cp -i' 

 alias ls='ls --color' 

 alias mv='mv -i' 

 alias rm='rm -i'

Thanks

Also is there any way to get a base system like this without the  ~x86 in make config?

----------

## Snooper

you can remove the ~x86 and just run emerge -epv system and see what it stops on then add that package to /etc/portage/package.keywords like so: 

sys-libs/glibc ~x86

sys-devel/gcc ~x86

the things added to the end of etc/profile are to turn on color for ls, ask for confirmation before deleting a file, copying and moving. you can do a ls --help or mv --help cp --help etc and see what else ther is and add it there like say ls -l --color=auto this would display long version of file like permissions size and in color... it's not needed i have removed it from my other nptl guide and will update this soon i am working on a new profile with some stage1's that will already have 2.6 headers and compiled with gcc-3.4.1 and glibc-2.3.4 and use udev, nptl, and add gentoolkit to the system...

----------

## OneOfMany

chimpsky:

From one of the 50 something pages in this thread titled GCC 3.4.

 *Quote:*   

>  *Quote:*    *Quote:*   2 robmoss2k: you mean it's better to use pentium-m for pentium4 processors? 
> 
> Heh, no, I mean it's better to use pentium-m for Pentium M processors  -march=pentium4 problems tend to relate to people using the flag on architectures they shouldn't do, such as the P-M. 
> 
> no it isnt, it's better to use -mtune=pentium3, otherwise shit like glibc will break. gcc 3.4 bug :/

 

So I guess it could be related to this (if you're using -march=pentium-m).  Otherwise I'd suggest looking for the first line of text that seems to indicate something is broken and post it  :Wink: .

----------

## St_Andrew

will this work with a 2004.1 live cd too?  :Smile: 

or even 2004.0   :Rolling Eyes: 

----------

## cybrjackle

I would assume YES, as long as you "emerge sync" before you ln gcc-3.4

----------

## PhotonX

Thanks for the guide, ill install tonight and get back with results

----------

## St_Andrew

 *cybrjackle wrote:*   

> I would assume YES, as long as you "emerge sync" before you ln gcc-3.4

 

okay, thanks, for some reason it didn't work to boot with smp so i guess it's a lost case anyway...

----------

## Snooper

You where unable to boot using the smp kernel?

You can even go the route of install gentoo using a gentoo kernel then once your done compiling and booted into the new system emerge glibc again and it will enable nptl. Thats how we did it before the smp kernel came around...

----------

## St_Andrew

 *Snooper wrote:*   

> You where unable to boot using the smp kernel?
> 
> You can even go the route of install gentoo using a gentoo kernel then once your done compiling and booted into the new system emerge glibc again and it will enable nptl. Thats how we did it before the smp kernel came around...

 

yeah i only got a black screen   :Shocked:  perhaps some frambuffer problem... but it worked with the gentoo kernel...

anyway i figured i could do something like that, so i will try it  :Smile:  thanks  :Smile: 

----------

## PhotonX

Some Questions:

1.Shouldnt we make a package.keywords file and include the following in it?

```
 

sys-kernel/linux26-headers -* ~x86

sys-kernel/gentoo-dev-sources -* ~x86

```

and also, do a

```

emerge patch

emerge -C linux-headers

emerge --oneshot linux26-headers

```

followed by a

```

nano -w /etc/make.profile/virtuals

*replace kernel entry with linux26-headers*

*replace os-headers entry with linux26-headers*

```

and use the bootstrap-2.6.sh script??

All of this is kinda confusing me, because of your last guide. Thanks

----------

## Snooper

well if you want to use a package.keywords file over ACCEPT_KEYWORDS="~x86" you will need more than just the headers. You need glibc/gcc/libstdc++v3 and gentoo-dev-sources is already x86.

as for emerge patch, as long as you do an emerge --oneshot --nodeps linux26-headers (nodeps) you do not need to emerge patch and it will get emerged durring bootstrap. --nodeps removes dependencies from the package and patch is a dependencie of linux26-headers.

and for the virtuals file where going to use bootstrap.sh over bootstrap-2.6.sh so changing the virtual file is not needed other than changing devfsd to udev if you want so you don't have to install it later.

----------

## Snooper

ok if anyone really feels strongly against installing gentoo with ~x86 you can add:

sys-kernel/linux26-headers ~x86

sys-devel/gcc ~x86

sys-libs/libstdc++-v3 ~x86

sys-libs/glibc ~x86

to /etc/portage/package.keywords

I've done this on a test machine and have ssen no issue's as of yet, but why on earth you would want gcc-3.4.1 and glibc-2.3.4 and the rest stable is beyond me i'd figure you where in it for the bleeding edge  :Twisted Evil: 

also it should be added and maybe it will as long as you have bootstrapped and not just emerge gcc-3.4 you can emerge -C gcc-3.3.3-r6 i think it is thats in stage1 (libstdc++-v3) takes care of anything built with 3.3 and still on the system. but it won't hurt anything to get rid of it everything has been compiled with gcc-3.4

----------

## dhalsiim

Why --oneshot, won't that stop the package from being updated later on?

Please elaborate.

----------

## karllo

Do I need to modify ebuild of xorg-x11 also? Because I tested in two seperate machine, using xorg-x11 can not start any wm: for example, xfce4 just show desktop for one second and crash back to console, get fatal error signal 11, very limited info in log, start gnome-session and it will crash when close a window, click menu etc, using xfree instead is okay. Anybody ran into the same problem?

----------

## Snooper

Following the GCC3.4 thread --oneshot --nodeps was they way everyone wanted it done, and you can still update your headers when new one's become available they will be listed, and it's not wise to update them unless you plan on recompiling everything again or atleast glibc. and --nodeps is needed so you don't have to install patch before unmerging linux-headers and merging linux26-headers...

I have been using Xorg-X11 with no issues along with the nvidia modules 6111 i think it is along with gnome only issue's i have experienced is with gnome-vfs and samba, oh and mplayer, and xine random crashes.

you have to remember though this setup is for testing only not for a production system. if you want production follow my install for 2.6 and nptl support some where floting around in this furom it uses the stable branch of gentoo with udev, 2.6 kernel/headers and nptl support.

----------

## dhalsiim

Thank you for your prompt answer.

But I had to go ahead and install and couldn't wait, therefore I didn't use "--oneshot" and things are going along pretty well. I used ACCEPT_KEYWORDS="~x86" right from the start :-p (in my make.conf) of course. Things seem to be working fine, 2.6 headers, nptl, gcc 3.4  :Very Happy: 

I just hope the crashes aren't as much, because then this whole endeavour would be in vain  :Sad: .

Thank you for your thread.

--dhalsiim

----------

## Snooper

I have been running it since i made this thread and have had no stability issues other than with the couple apps i said, and if your not trying to connect to a windows domain/workgroup then your don't need samba, i have no issues with nfs, and mplayer i could compile all the codecs i foget witch ones and xine would just freeze from time to time so if you don't use either of those apps you might be fine, and be aware openoffice does not compile on gcc-3.4 as of yet and xine/mplayer may have been fixed already i just found other methods of doing things. i have seen talk of kde not compiling but that might have been fixed also as i use gnome i am not sure and 3.3 what ever was stopped 3.2.3 from compiling might not be resident in 3.3 :Smile: 

but this setup is more for fun like i said your using the unstable branch of gentoo so mileage may vary...

----------

## robertmcm

I have been running this way now since Aug 11, I had a few problems in KDE 3.2.3. Since I am still running ~x86 on this box, emerge world upgraded me to kde 3.3 and the system is stable as rock right now. Again, thanks for the howto.

----------

## mikkelhoegh

very nice guide!

----------

## eXoCooLd

 *chimpsky wrote:*   

> when I try bootstraping it fails at gettext, I have a pentium-m and I'm using that in the march flag of my CFLAGS. Has anyone else had this problem ???

 

I had the same problem. I used -march=pentium4 -O3 -pipe -fomit-frame-pointer for bootstrap, but i forgot the -pipe on the first run

so i made it again but now with -march=pentium-m -O3 -pipe -fomit-frame-pointer

and now gettext works with gcc 3.4.1

looks like some other thing has to be up to date to compile gettext with pentium-m as CFLAGS

EDIT: I set ACCEPT-KEYWORDS="~x86"

----------

## MickKi

Hi Snooper,

 *Snooper wrote:*   

> [snip . . . ]I've done this on a test machine and have ssen no issue's as of yet, but why on earth you would want gcc-3.4.1 and glibc-2.3.4 and the rest stable is beyond me i'd figure you where in it for the bleeding edge  

  I have been running ~x86 for months now, but I'm tired of compiling for days on end the multiple testing packages between the fewer stable releases (PIII 600MHz  :Rolling Eyes:  ).  That's the main reason for me wanting a stable set of all/most applications but perhaps something a bit more racy on the system front.

This (plus I'm running out of space on the old hard drive) is the reason I am planning to reinstall on a new separate drive.  How does your tutorial change if I were to install on the new disk using not a live CD, but my existing Gentoo ~x86 with a gentoo-dev-2.6.8-r10 kernel?

----------

## Bamboe

I don't think that matters. I am bootstrapping a gcc3.4.2/NPTL/~x86 system now from a slackware 10 installation with 2.6.7 kernel by following the instructions posted above in this thread, and it seems to go fine.

You only have to make sure you're running a 2.6 kernel, which you are doing so that is OK.

(I almost never use live cd's, I like to install first slackware to another partition so I have a working system within 20 minutes from which I can browse the web and things and install gentoo)

----------

