16.Final steps: kernel and system logger
Note: If you haven't done so, please edit /etc/make.conf to your flavor.
You now need to merge Linux source ebuilds. Here are the ones we currently offer:
ebuild description
gentoo-sources Our own performance and functionality-enhanced kernel based on -ac.
xfs-sources A snapshot of the SGI XFS CVS Linux source tree; this is the kernel to run if you want bleeding edge(cvs) xfs support.
openmosix-sources A stock Linux kernel source tree patched with support for the GPL openMosix load-balancing/clustering technology
usermode-sources A stock Linux kernel source tree patched with support for User-Mode Linux. ("Linux inside Linux" technology)
vanilla-sources A stock Linux kernel source tree, just like you'd get from kernel.org
Warning: Please note that gentoo-sources is heavily patched and may not be stable. Using vanilla-sources might be a better idea if you encounter numerous problems. If you are using gentoo-sources beware of grsecurity, especially with X. It is best to disable grsecurityunless you are absolutely sure that you need it.
Choose one and then merge as follows:
Code listing 16.1: Emerging Kernel Sources
# emerge sys-kernel/gentoo-sources
Once you have a Linux kernel source tree available, it's time to compile your own custom kernel.
Code listing 16.2: Compiling the Linux Kernel
# cd /usr/src/linux
# make menuconfig
# make dep && make clean bzImage modules modules_install
# mv /boot/bzImage /boot/bzImage.orig
[if bzImage already exists]
# cp /usr/src/linux/arch/i386/boot/bzImage /boot
Warning: For your kernel to function properly, there are several options that you will need to ensure are in the kernel proper -- that is, they should be enabled and not compiled as modules. You will need to enable the "Code maturity level options --> Prompt for development and/or incomplete code/drivers" option to see several of these selections. Under the "File systems" section, be sure to enable the "Device File System" (note that you don't need to enable the "/dev/pts file system support" option). You'll also need to enable the "Virtual Memory Filesystem". Be sure to enable "ReiserFS" if you have any ReiserFS partitions; the same goes for "Ext3". If you're using XFS, enable the "SGI XFS filesystem support" option. It's always a good idea to leave ext2 enabled whether you are using it or not. Also, most people using IDE hard drives will want to enable the "USE DMA by default" option; otherwise, your IDE drives may perform very poorly. Of course, remember to enable "IDE disk" support as well -- otherwise your kernel won't be able to see your IDE disks.
If you are using hardware RAID you will need to enable a couple more options in the kernel: For Highpoint RAID controllers select hpt366 chipset support, support for IDE RAID controllers and Highpoint 370 software RAID.For Promise RAID controllers select PROMISE PDC202{46|62|65|67|68|69|70} support, support for IDE RAID controllers and Support Promise software RAID (Fasttrak(tm))
If you use PPPoE to connect to Internet, you will need the following options in the kernel (built-in or as preferably as modules) : "

PP (point-to-point protocol) support", "

PP support for async serial ports", "

PP support for sync tty ports". The two compression options won't harm but are not definitely needed, neither does the "

PP over Ethernet" option, that might only be used by rp-pppoe when configured to do kernel mode PPPoE.
If you have an IDE cd burner, then you need to enable SCSI emulation in the kernel. Turn on "ATA/IDE/MFM/RLL support" ---> "IDE, ATA and ATAPI Block devices" ---> "SCSI emulation support" (I usually make it a module), then under "SCSI support" enable "SCSI support", "SCSI CD-ROM support" and "SCSI generic support" (again, I usually compile them as modules). If you also choose to use modules, then echo -e "ide-scsi\nsg\nsr_mod" >> /etc/modules.autoload to have them automatically added at boot time.
Note: For those who prefer it, it is now possible to install Gentoo Linux with a 2.2 kernel. Such stability will come at a price: you will lose many of the nifty features that are new to the 2.4 series kernels (such as XFS and tmpfs filesystems, iptables, and more), although the 2.2 kernel sources can be patched with Reiserfs and devfs support. Gentoo linux bootscripts require either tmpfs or ramdisk support in the kernel, so 2.2 kernel users need to make sure that ramdisk support is compiled in (ie, not a module). It is vital that a gentoo=notmpfs flag be added to the kernel line in /boot/grub/grub.conf for the 2.2 kernel so that a ramdisk is mounted for the bootscripts instead of tmpfs. If you choose not to use devfs, then gentoo=notmpfs,nodevfs should be used instead.
Your new custom kernel (and modules) are now installed. Now you need to choose a system logger that you would like to install. We offer sysklogd, which is the traditional set of system logging daemons. We also have msyslog and syslog-ng as well as metalog. Power users seem to gravitate away from sysklogd (not very good performance) and towards the newer alternatives. If in doubt, you may want to try metalog, since it seems to be quite popular. To merge your logger of choice, type one of the next four lines:
Code listing 16.3: Emerging System Logger of Choice
# emerge app-admin/sysklogd
# rc-update add sysklogd default
or
# emerge app-admin/syslog-ng
# rc-update add syslog-ng default
or
# emerge app-admin/metalog
# rc-update add metalog default
or
# emerge app-admin/msyslog
# rc-update add msyslog default
Warning: In the case of syslog-ng you need to create /etc/syslog-ng/syslog-ng.conf. See /etc/syslog-ng for a sample configuration file.
Important: Metalog flushes output to the disk in blocks, so messages aren't immediately recorded into the system logs. If you are trying to debug a daemon, this performance-enhancing behavior is less than helpful. When your Gentoo Linux system is up and running, you can send metalog a USR1 signal to temporarily turn off this message buffering (meaning that tail -f /var/log/everything/current will now work in real time, as expected), and a USR2 signal to turn buffering back on again.
Now, you may optionally choose a cron package that you'd like to use. Right now, we offer dcron, fcron and vcron. If you don't know which one to choose, you might as well grab vcron. They can be installed as follows:
Code listing 16.4: Choosing a CRON Daemon
# emerge sys-apps/dcron
# crontab /etc/crontab
or
# emerge sys-apps/fcron
# crontab /etc/crontab
or
# emerge sys-apps/vcron
You do not need to run crontab /etc/crontab if using vcron.
Don't forget to add your *cron to the proper init level.
# rc-update add *cron default
For more information how how cron works under Gentoo Linux, see this announcement.
For more information on starting programs and daemons at startup, see the rc-script guide.
17.Final steps: Install Additional Packages
If you need rp-pppoe to connect to the net, be aware that at this point it has not been installed. It would be the good time to do it.
Code listing 17.1: Installing rp-pppoe
# emerge rp-pppoe
Note: Please note that the rp-pppoe is built but not configured. You will have to do it again using adsl-setup when you boot into your Gentoo system for the first time.
You may need to install some additional packages in the Portage tree if you are using any optional features like XFS, ReiserFS or LVM. If you're using XFS, you should emerge the xfsprogs ebuild:
Code listing 17.2: Emerging Filesystem Tools
# emerge sys-apps/xfsprogs
If you'd like to use ReiserFS, you should emerge the ReiserFS tools:
# emerge sys-apps/reiserfsprogs
If you're using LVM, you should emerge the lvm-user package:
# emerge --usepkg sys-apps/lvm-user
If you're a laptop user and wish to use your PCMCIA slots on your first real reboot, you'll want to make sure you install the pcmcia-cs package.
Code listing 17.3: Emerging PCMCIA-cs
# emerge sys-apps/pcmcia-cs
Warning: You will have to re-emerge pcmcia-cs after installation to get PCMCIA to work.
18.Final steps: /etc/fstab
Your Gentoo Linux system is almost ready for use. All we need to do now is configure a few important system files and install the GRUB boot loader. The first file we need to configure is /etc/fstab. Remember that you should use the notail option for your boot partition if you chose to create a ReiserFS filesystem on it. Remember to specify ext2, ext3 or reiserfs filesystem types as appropriate.
Use something like the /etc/fstab listed below, but of course be sure to replace "BOOT", "ROOT" and "SWAP" with the actual block devices you are using (such as hda1, etc.)
Code listing 18.1: Editing fstab
# /etc/fstab: static file system information.
#
# noatime turns of atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency). It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.
# <fs> <mountpoint> <type> <opts> <dump/pass>
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/BOOT /boot ext2 noauto,noatime 1 2
/dev/ROOT / ext3 noatime 0 1
/dev/SWAP none swap sw 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
proc /proc proc defaults 0 0
Warning: Please notice that /boot is NOT mounted at boottime. This is to protect the data in /boot from corruption. If you need to access /boot, please mount it!