Monday, August 08, 2005

HOW-TO for Gentoo Linux

Configure a bootloader for dual booting (Window and Linux):

Boot loader is a program that fires up your kernel when you start up your system. There are two choices available for Gentoo Linux: GRUB and LILO. I tried GRUB but unfortunately it did not work for me. Currently, I am using LILO and it works very nicely for me. These are the steps which you need to do for configuring LILO in your system.

* Install LILO

$ emerge lilo

* Configure LILO (/etc/lilo.conf)

I have two hard disks in my system (/dev/hda and /dev/hdb). The first drive (/dev/hda) has Window 2000 installed and the Second drive(/dev/hdb) has Gentoo Linux installed. At Linux side I have created three partitions:
/dev/hdb1 : /boot
/dev/hdb2: Swap
/dev/hdb3: /root
Following is my (/etc/lilo.conf) file. You can change parameters according to your system configuration. Additionally I have used default frame buffer size and other optional parameters which you can change according to your need.
boot = /dev/hdb #MBR of my Linux drive
prompt
timeout= 100 # in ms
default=Gentoo

image = /boot/kernel-2.6.7-gentoo-r11 # full path of your linux kernel image
root = /dev/hdb3
label = Gentoo
read-only

other = /dev/hda1
label = Windows2K

* Finish the LILO installation.

$ /sbin/lilo
By running this command you make LILO to write boot options and kernel image path (as specified in your lilo.conf ) in the MBR.

* For dual booting you need to copy your linux side MBR options to your window side (Check your boot.ini file).

$ dd if=/dev/hdb of=linux.bin bs=512 count=1
$ mount /dev/fd0 /mnt/floppy
$ cp linux.bin /mnt/floppy/

Configure X Server and ATI driver:

Almost every ATI board is supported by xorg-X11 at least for the 2D accelerated features. The 3D support is provided either by the DRI project, which is already present inside the xorg-x11, or by closed source drivers provided by ATI. If you are using an ati board you do not need to worry about anything since ATI-driver ebuild provides the ATI closed source X drivers and kernel modules.

* Kernel Configuration

Loadable Module Support --->
[*] Enable loadable module support
[*] Module unloading

Processor type and features --->
[*] MTRR (Memory Type Range Register) support

Device Drivers --->
Character Devices --->
<*> /dev/agpgart (AGP Support)
<*> Your_AGP_Chipset_Here
[ ] Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)

* Install ati-driver on your system

$ emerge --sync
$ emerge-websync (Nore: if you are behind a firewall)
$ emerge ati-driver

* Switch to the ATI OpenGl System.

$ opengl-update ati

* Configure X

$ fglrxconfig
This will ask a bunch of questions and will accordingly generate a config file for your system. You should save the configuration file to /etc/X11/xorg.conf. Here is my /etc/X11/xorg.conf file.

* Start X

$ startx
For starting X just after the boot you need to configure a display manager (xdm/gdm/kdm) and create ~/.xinitrc and ~/.xsession files. I am using xdm as my display manager and xfce4 as my desktop manager. Here are my ~/.xinitrc and ~/.xsession files.

* Testing hardware acceleration

$ fglrxinfo
$ fglrxinfo |grep direct
$ glxgears

Configure Sound using ALSA (Advanced Linux Sound Architecture):

ALSA has replaced OSS (Open Sound System) as default sound subsystem in the 2.6 kernel series. In 2.6 kernel you may use the drivers provided in the kernel or you may use media-sound/alsa-driver. I have built ALSA in my kernel and use the same. These are the steps for configuring the sound in your system.

* Find out your soundcard

$ lspci | grep -i audio
You will have to "emerge pciutils" for using lspci command.

* Install the alsa-utils on your system

$ emerge -deep alsa-utils

* Automatically load the kernel module.

Edit the /etc/modules.d/alsa for adding your soundcard.
alias snd-card-0 snd-via82xx
Note: via-82xx is my sound card. You can change it according to the output of your lspci command.
$ modules-update

* Activate ALSA at boot

$ rc-update add alsasound boot
$ /etc/init.d/alsasound start

* Unmute the channels

$ amixer set Master 100% unmute
$ amixer set PCM 100% unmute
$ amixer set Center 100% unmute
$ amixer set Surround 100% unmute
$ amixer set Headphone 100% unmute

Configure Joystick/Wheel:

Joystick/Wheel may use either USB or gameport. Here I am covering the setup for USB one.

* Turn on USB support and joystick support in your kernel.

Device Drivers -->
Input Device Support -->
<*> Joystick Interface
<*> Event Interface
[*] Joysticks
USB Support -->
<*> Support for Host-side USB
[*] USB device filesystem
<*> EHCI HCD (USB 2.0) support
<*> OHCI HCD support
<*> UHCI HCD (most Intel and VIA) support
<*> USB Human Interface Device (full HID) support
[*] HID input layer support

* Joystick/Wheel test

$ dmesg | grep -i joystick (Note: you should see joystick related messages)
$ emerge libjsw (Note: For jscalibrator)
$ jscalibrator (Note: It may require you to make a link " ln -s /dev/input/js0 /dev/js0" )

Configure Webcam:

* Turn on video for linux support in your Kernel

Device Drivers -->
Multimedia Devices -->
<*> Video For Linux

* emerge driver for your webcam.

I have "Aiptek Pocket DV" so I installed "spca5xx" for it. Many webcams require "qc-usb" as their driver. Please check your webcam and find out your driver.
$ emerge spca5xx

* Webcam test

$ emerge gqcam
$ gqcam

Configure CD RW:

* Check for ide-scsi module in your system

$ modprobe -l|grep ide-scsi

if ide-scsi module is not present in your kernel, rebuild your kernel with ide-scsi support.
$ cd /usr/src/linux
$ make menuconfig
Device Drivers --->
ATA/ATAPI/MFM/RLL Support --->
SCSI Emulation Support
SCSI device support --->
SCSI disk support
SCSI CDROM support
SCSI generic support
$ make && make modules_install

* make sure that bootloader config file contains the entry for your CD RW.

I have two CD RW (/dev/hdc and/dev/hdd so I have added the following line in the Gentoo section of /etc/lilo.conf
append="hdc=ide-scsi hdd=ide-scsi"

* Add ide-scsi module at boot

Add an entry for ide-scsi in /etc/modules.autoload.d/kernel-2.6 file.
ide-scsi

* CD RW test

$ emerge cdrtools
$ cdrecord -scanbus