HOWTO Gentoo 2004.2 for linux 2.6 and NPTL
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
- This page is a candidate for deletion
- Reason given: Obsolete.
- If you disagree with its deletion, please explain why on its discussion page.
- If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
- Make sure no other pages link here and check the page's history before deleting.
Contents |
[edit] Intro
This guide is intended to help those wanting to build a Gentoo system using NPTL and a 2.6 kernel.
[edit] 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 Handbook for more information about obtaining and burning a Gentoo 2004.2 LiveCD.
[edit] Boot Option
Now boot from the LiveCD and type smp at the boot prompt.[Only applies to OLD Live CDs]
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. This is necessary in order for glibc to be compiled with NPTL support. Refer to the Gentoo Handbook for options passable to the kernel during boot.
[edit] Hard Drive Preparation
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
[edit] Time Check
Check to ensure your PC has the correct time.
date
[edit] 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.
/bin/tar -xvjpf stage?-*.tar.bz2 && rm stage?-*.tar.bz2
[edit] Configuring make.conf
Open make.conf for editing.
| File: /mnt/gentoo/etc/make.conf |
|
Included as an example:
Code:
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
USE="nptl nptlonly"
|
[edit] Optional
Selecting mirrors.
mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf
This command will populate GENTOO_MIRRORS in /etc/make.conf.
Note: I prefer using mirrorselect -i -o >> /mnt/gentoo/etc/make.conf. In my opinion choosing the mirror(s) closest to you manually will bring better results than a small, one time test done by mirrorselect -a -s4 -o
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.
[edit] Chrooting
- Copy resolv.conf so networking continues to function after chroot'ing.
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
- Mount /proc
mount -t proc none /mnt/gentoo/proc
- OPTIONAL: Changing the root password
If you want to change virtual terminals (Alt-F1 through Alt-F6) to do other cmd-line tasks while installing gentoo, you need to do this command in order to be able to login. This only changes the root password for the LiveCD environment.
passwd
- Chroot'ing into the new Gentoo environment.
chroot /mnt/gentoo /bin/bash env-update && source /etc/profile
[edit] Updating Portage
Sync the portage tree.
emerge sync
Note: To avoid killing rsync servers and avoid getting stuck forever on a slow rsync server it might be easier and faster if you download a snapshot of the portage tree and then sync it.
emerge-webrsync && emerge sync
[edit] Stage1 to Stage2
- Merging the Linux 2.6 headers
emerge --nodeps --oneshot linux26-headers
- Bootstrapping the system: (Stage1 to Stage2)
cd /usr/portage scripts/bootstrap.sh && env-update && source /etc/profile
- bootstrap-cascade.sh is nolonger a valid option
- If you experience problems with installing documentation after compiling glibc try to do that:
echo ">=sys-libs/glibc-2.3.4.20041102-r1" >> /etc/portage/package.mask; scripts/bootstrap.sh && env-update && source /etc/profile
- To check if NPTL support was compiled into glibc type:
/lib/libc.so.6
- This holds true for x86 users however if you're an ~x86 user you will not see this properly
"You should see 'Native POSIX Threads' in the output." the NPTL libraries are moved to a new dir refer to the ebuild to see the command you need to run.
[edit] Stage2 to Stage3
Building the system: (Stage2 to Stage3)
emerge system && env-update && source /etc/profile && etc-update
[edit] 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-sources
[edit] Optional
- Installing udev.
emerge udev
Don't forget to take devfs support out of the kernel configuration, since udev does the job.
- Installing hotplug.
emerge hotplug && rc-update add hotplug boot
- Installing alsa.
emerge alsa-utils && rc-update add alsasound boot && nano -w /etc/modules.d/alsa && modules-update
If your soundcard is directly supported by the kernel, just emerge alsa-utils.
[edit] Configuring your System:
Refer to the Gentoo Handbook on editing fstab, network configuration files, and rc.conf.
[edit] 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
[edit] Optional
- Installing gentoolkit.
emerge gentoolkit
- Contains tools for working with portage.
- Installing ufed.
emerge ufed
- An application to simplify selecting/deselecting USE variables.
[edit] Configuring the Bootloader:
Installing grub.
emerge grub
Refer to the Gentoo Handbook on configuring grub.
- 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
[edit] Getting NPTL to work on already running systems
This is already covered in HOWTO Migrate to NPTL, however, for completeness, we will also discuss it in this article.
So, begin by editing your /etc/make.conf
- Add the following two USE Flags:
| File: /etc/make.conf |
nptl nptlonly |
If you use not-so-recent binary only commercial applications (for example Matlab 6.5) that don't work with NPTL, re-emerge glibc without the nptlonly USE flag, so you will be able to use linuxthreads with
export LD_ASSUME_KERNEL=2.4.1 $COMMAND
- Remove your current headers.
emerge -C linux-headers
- Grab the latest 2.6 kernel (NPTL support any version of the 2.6 kernel, gentoo-sources are used as an example).
emerge gentoo-sources
- Emerge the linux26 headers.
emerge linux26-headers
- Now begin recompiling your system to work with NPTL.
emerge glibc
Restart, and you're done.
