View my Blog | Favorites  | Linkedin
dummy
Home Research Linux Coding Fun Movies Pictures Contact
Rashmi
Rashmi Raj
Computer Science Department
Stanford University
Resume [PDF/DOC]
rashmi - 'at' - 'cs' - 'dot' - 'stanford' - 'dot' - 'edu'


HOW-TO Configure
Useful Information
Config Files
Gentoo on Inspiron 6000


HOW-TO for Gentoo Linux




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

Top

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:

Top

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):

Top

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:

Top

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:

Top
  • 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:

Top
  • 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 --->
<M> SCSI Emulation Support
SCSI device support --->
<M> SCSI disk support
<M> SCSI CDROM support
<M> 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



The Linux Boot Sequence

Top



  • The boot loader (Grub/Lilo) loads the kernel image defined in the boot loader configuration into memory after which it tells the CPU to run the kernel.

  • When the kernel is loaded and run, it initializes all kernel-specific structures and tasks and starts the init process.
  • This process then makes sure that all filesystems (defined in /etc/fstab) are mounted and ready to be used. Then it executes several scripts located in /etc/init.d, which will start the services in order to have a successfully booted system.
  • Finally, when all scripts are executed, init activates the terminals (in most cases just the virtual consoles which are hidden beneath Alt-F1, Alt-F2, etc.) attaching a special process called agetty to it. This process will then make sure the user is able to log on through these terminals by running login.



Init Process

Init process executes the actions sequentially defined in a configuration file /etc/inittab. A typical sequence is as follow:


si::sysinit:/sbin/rc sysinit
This line tells init that it must run /sbin/rc sysinit to initialize the system. The /sbin/rc script takes care of the initialisation, so the init doesn't do much -- it delegates the task of initialising the system to another process.


rc::bootwait:/sbin/rc boot
Here init runs all scripts from /etc/init.d that have symbolic links inside /etc/runlevels/boot.


l0:0:wait:/sbin/rc shutdown
l1:S1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc reboot
#z6:6:respawn:/sbin/sulogin
Here init uses the rc script to start the services. Note: The argument of rc is the subdirectory from /etc/runlevels.


c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:12345:respawn:/sbin/agetty 38400 tty2 linux
c3:12345:respawn:/sbin/agetty 38400 tty3 linux
c4:12345:respawn:/sbin/agetty 38400 tty4 linuxM
c5:12345:respawn:/sbin/agetty 38400 tty5 linux
c6:12345:respawn:/sbin/agetty 38400 tty6 linux
Here, init decides what virtual consoles it should activate and what commands need to be run at each console.


Useful Linux Commands

Top



  • delete all partitions of a harddisk including MBR
Top
$ dd if=/dev/zero of=/dev/hdb bs=512 count=1



  • List all kernel modules.
Top
$ modprobe -l|more
$ modprobe -l|grep ide*



  • See Kernel messages.
Top
$ dmesg
$ dmesg|grep -i joystick



  • Bypass DMA mode
Top
$ hdparm -d0 -c1 /dev/hdd (Note: This will bypass DMA mode for /dev/hdd)



  • See your kernel version
Top
$ uname -a



  • Add the specified init script to specified run levels. You must specify atleast one run level.
Top
$ rc-update add -- initscript -- --run level--
(Note: this adds your init script to /etc/init.d/ tree which will be parsed during boot by the init script)
$ rc-update add alsasound default
$ rc-update del alsasound
(Note: Delete the init script)
$ rc-update show (Note: Show all init scripts and their run levels)



  • See your IP configuration
Top
$ ifconfig



  • See all mounted filesystems
Top
$ cat /etc/mtab



  • See all available filesystems
Top
$ cat /etc/filesystems



  • Get your module loaded during boot
Top
$ --your module name-- >>/etc/modules.autoload.d/kernel-2.6
Above file(/etc/modules.autoload.d/kernel-2.6) gets parsed by the init script as follow:
Inittab script runs
$ rc::bootwait:/sbin/rc boot

This tells /sbin/rc to run scripts from /etc/init.d that have symbolic links inside /etc/runlevels/boot. The script "modules" (modules -> /etc/init.d/modules) runs as part of this process that in turn calls /etc/modules.autoload.d/kernel-version for loading modules during boot time.


  • Edit sudoers file
Top
$ visudo (Note: you must run "sudo" for getting your new sudoers file parsed)



  • update the database for "locate"
Top
$ updatedb



  • Add a user to a group
Top
$ gpasswd -a username groupname $ gpasswd -a bv wheel



  • Show files associated with a pid
Top
$ lsof -p PID



  • Print network connections, routing tables and information statistics
Top
$ netstat
$ netstat -ln
$ netstat --route
$ nerstat --statistics



  • grep at network layer
Top
$ ngrep -q GET



  • Print network statistics
Top
$ ntop



  • Change the init runlevel
Top
$ telinit runlevel
When you boot a computer running Linux, it will boot into a default runlevel (this is usually level 3 or level 5). There are six different runlevels most Linux distributions use (RH, Fedora etc)
* 0 - Halt the system
* 1 - Single-user mode
* 2 - Multi-user mode (without NFS)
* 3 - Multi-user mode
* 5 - Multi-user mode, graphical login
* 6 - Reboot the system

But Gentoo uses different runlevels mapping.
* l0:0:wait:/sbin/rc shutdown
* l1:S1:wait:/sbin/rc single
* l2:2:wait:/sbin/rc nonetwork
* l3:3:wait:/sbin/rc default
* l4:4:wait:/sbin/rc default
* l5:5:wait:/sbin/rc default
* l6:6:wait:/sbin/rc reboot
Hence in Gentoo by default the graphical login manager is started at boot when the xdm service is added to the default runlevel with rc-update add xdm default. Additionally, runlevels 3, 4 and 5 all map to the default runlevel. So if you want to make runlevel 3 and 5 behave like RH or Fedora, You can change the map for runlevel 3 to, say, console and then create the console directory in /etc/runlevels then start adding the services you want to start in the console runlevel with rc-update add ... console, minus xdm of course.

When you reboot a Linux system by typing reboot or by pressing CONTROL+ALT+DELETE, you are telling the system to go into runlevel 6 (reboot). You can do the same thing by typing
$ telinit 6
When you shutdown a Linux system with a shutdown -h or poweroff command, you are telling the system to go into runlevel 0. You can do the same thing by typing
$ telinit 0
You can boot into a specific runlevel by including the run level at the Linux boot prompt:
$ LILO: Gentoo 3



  • See all available runscript
Top
$ ls /etc/conf.d



  • Running multiple XServers
Top
$ xinit -- :display-name OtherOptions
$ xinit -- :1 -bpp 16
$ startx :1 -bpp 16 (This is same as the above)
You can configure xdm to start two Xservers at startup.
/etc/X11/xdm/Xservers
:0 local /usr/bin/X :0 vt9 --bpp 8
:1 local /usr/bin/X :1 vt10 --bpp 16
Everytime you need to run an X program, you need to specify to which display it should go for it's execution.


  • See disk usage information of a filesystem
Top
$ df -ha



  • See disk usage of a direcory/file
Top
$ du -hc [file/directory path]



  • Finding installed package information
Top
$ emerge -vp vim #your package name here
$ equery files vim
$ equery list #lists all installed package
$ equery hasuse kde #lists all packages which have used "kde" in theiir USE flag
$ equery depends perl #Lists all direct dependency on perl
$ equery check java #veryfying package integrity of java
$ equery belongs /usr/bin/xmms #finding the package xmms came from

Visit the Gentoolkit page for more information.




  • See packages under world (Gentoo)
Top
$ more /var/lib/portage/world



Troubleshooting (Gentoo Linux)

Top



  • emerge gnome-vfs fails
$ emerge libIDL
$ emerge XML-Parser
$ emerge gnome-vfs
(Note: For gentoo 2005.1, you might need to make some symbolic links for specifying the correct path for gcc-lib.)



  • Joystick does not work properly with some games
$ emerge --sync
$ emerge --update plib



  • Firefox does not recognize my JVM
$ locate javaplugin-oji.so
$ cd ~/.mozilla
$ mkdir plugins
$ ln -s /opt/sun-jdk-1.4.2.08/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so ~/.mozilla/plugins/



  • Hardware clock is not set to local
edit the /etc/rc.conf file and change the CLOCK value from UTC to local.

$ CLOCK="local"



Gentoo on Inspiron 6000

Top



After spending a week, I was able to successfully install and configure Gentoo Linux on my sparking new Inspiron 6000 with nearly everything working optimally. I do not think that it needed more than a day time but due to lack of proper documentation I ended up spending so much time and effort. So I decided to document all the steps necessary for successful installation in my case. The information has been culled from endless Google searches and some trial-and-error. Please use the instructions at your own discretion and your mileage may vary if your components differ. I must also add, that I did nothing to support the modem, 'cause I don't ever plan on using it.

My Inspiron 6000 came with Windows XP Pro installed on a 60 GB HDD. Out of 60 GB, almost 13 GB of space was used for the Dell recovery utility, so that was the first thing to go, though only after I got the OS Reinstallation CD from Dell (which was like pulling teeth from a really mad rhino). Dell "forgot" to include a reinstallation CD in the shipping package and after weeks of wasted call times and fruitless chat sessions I was finally able to get the CD's!!!!

At this point, the first thing was to decide a partition layout for the HDD. I decided to devote 30GB to Windows XP and keep 30GB for Gentoo. Hereafter, I installed Windows XP Pro on the first partition which was set to be the only bootable partition on the drive (This is very key, because NTLDR will not boot otherwise). Nothing very interesting here, other than how painless and straightforward the whole exercise was. I must thank Dell and Microsoft for making a great reinstallation CD, with the sysprep utility doing a great job recognizing nearly all the components. After installing drivers for the ATI Radeon x300 (from Dell Support, thanks again), Intel 2200BG Proset (Dell Support), SigmaTel Audio drivers (Dell Support) and all the necessary software and SP2 updates the whole process was completed in about 4-5 hours. After creating a Restore point and rebooting a couple of times the odyssey began.




 Basic Gentoo Installation:

Top
The first step was to download ISO's for 2005.0 Universal LiveCD and x86 Package CD and create two CD's (done using Roxio Easy CD Creator). I followed the Gentoo Handbook for the installation process. There were a few minor issues along the way, and I have noted them along with any deviations from the Handbook.
  • Network Detection
I was not able to get the Live CD distribution wpa_supplicant to connect to my wireless Network, although the hardware detection was successful in loading the drivers for Intel 2200BG (ipw2200, no NDISWrapper necessary). So for the time being I used my ethernet connection (Broadcom BCM4401-B0), which was recognized automatically (b44) by the hardware detection process. Net.eth0 start was able to negotiate with my router and things worked quite well.
  • Here's my lspci output:


0000:00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controller (rev 03)
0000:00:01.0 PCI bridge: Intel Corporation Mobile 915GM/PM Express PCI Express Root Port (rev 03)
0000:00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1 (rev 03)
0000:00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2 (rev 03)
0000:00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03)
0000:00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4 (rev 03)
0000:00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03)
0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d3)
0000:00:1e.2 Multimedia audio controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)
0000:00:1e.3 Modem: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Modem Controller (rev 03)
0000:00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 03)
0000:00:1f.2 IDE interface: Intel Corporation 82801FBM (ICH6M) SATA Controller (rev 03)
0000:00:1f.3 SMBus: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus Controller (rev 03)
0000:01:00.0 VGA compatible controller: ATI Technologies Inc M22 [Radeon Mobility M300]
0000:03:00.0 Ethernet controller: Broadcom Corporation BCM4401-B0 100Base-TX (rev 02)
0000:03:01.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b3)
0000:03:01.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller (rev 08)
0000:03:01.2 Class 0805: Ricoh Co Ltd SD Card reader (rev 17)
0000:03:03.0 Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)

  • Partitioning Hard Disk
As mentioned earlier, ,I partitioned the drive to create one primary partition for Windows (30GB) and the other half was left for Gentoo. My Inspiron 6000 has a 915PM Express chipset, with an ICH6-M Southbridge (Technically not called a Southbridge anymore, but you get the point) that interfaces the IDE and SATA ports. As a result, my HDD is detected as a SATA drive (sda) and the DVD +/-RW is detected as an IDE device (hdc). I have 1GB of RAM (512MBx2, Kingston), so I created a 1GB swap partition. I partitioned my 30 GB space as follows:

/dev/sda2 : /boot (Note- Do not make it bootable otherwise NTLDR will not be able to boot to Windows)
/dev/sda3: Swap ( Size same as memory which is 1 GB)
/dev/sda3: /root
  • Filesystems
I chose ext2 for /boot and ext3 for /root as suggested by the Handbook.
  • Mounting and installing Portage
For this step I followed the Gentoo Handbook exactly I had already burnt the Univeral CD so I went for "Using a stage from the installation CD" option (Stage 3 in my case).
  • make.conf file for compilation
Here is my make.conf file for compilation options and portage directory settings. Make sure that you set your USE flag properly. I had already specified the Portage log and build directories so I needed to create them before proceeding.
  • Building and installing the Kernel.
After chrooting to the new environment and setting other environment variables and configurations (same as Gentoo Handbook), it was time to choose correct compile options for building the Kernel (gentoo-sources was used as the package for this case). Here is my .config file which builds SATA support, Console Framebuffer, Wireless Connection, CPU throttling and other important functionalities into the kernel. Please read below for details on enabling DVD support through SCSI. The kernel was built and copied to /boot exactly like the Handbook says.
  • fstab file
This is my fstab file. After this, it was time to setup dual-booting capability along with enabling the required modules for default runlevel loading (rc-update add **** default, please add all the modules necessary for your case. I added net.eth0, domainname, syslog-ng & vixie-cron)



 Configure a bootloader for dual booting (Windows XP and Linux):

Top

I am using NTLDR to start the boot process. So I shall not be writing the Linux bootloader to the MBR of my drive. There are two choices available for Linux bootloader: GRUB and LILO. I chose GRUB here and it worked just fine. This is what I did to get GRUB to work:

  • Install GRUB
$ emerge grub
  • Configure GRUB (/boot/grub/grub.conf)
I have two operating systems on my hard disk. /dev/sda1 has Windows XP and the Linux side configuration is as follows:
/dev/sdb2 : /boot
/dev/sdb3: Swap
/dev/sdb4: /root
Following is my (/boot/grub/grub.conf) file. You can change parameters according to your system configuration. Additionally, I have used frame buffer parameters which you can change according to your need.
default 0
prompt
root (hd0,1) #My /boot (/dev/sda2)
title Gentoo kernel /boot/kernel-2.6.12-gentoo-r6 # full path of your linux kernel image
root /dev/sda4
video=vesafb:mtrr,ywrap,1280x1024-32@60
title Windows XP Professional
rootnoverify (hd0,0)
makeactive
chainloader +1
  • Finish the GRUB installation.
$ grub-install /dev/sda2
By running this command I made GRUB to write boot options and kernel image path (as specified in your grub.conf ) in the /dev/sda2, so it copied the boot parameters to the start of the partition and not to the MBR of the drive.
  • For dual booting I copied my Linux /boot options to Windows XP.
$ dd if=/dev/sda2 of=linux.bin bs=512 count=1
$ mount /dev/sdb1 /mnt/USBKey
$ cp linux.bin /mnt/USBKey/
Now I editted my boot.ini on C:\ in Windows (It may be hidden, so you would need to unhide it etc..) and added an entry for Linux bootloader and voila' I was ready to dual-boot.


 Configure X Server and ATI driver (ATI Mobility Radeon X300) :

Top

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. I used the closed source drivers provided by ATI.
  • 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
$ emerge --sync
$ emerge-websync (Note: This is only if you are behind a firewall and can't rsync)
$ emerge ati-driver

emerge ati-driver brought Xorg-X11(6.8.2) and other packages but it failed at the end with the message "fglrx.ko could not be found". I scrolled up and saw some erros like "slot_name" is not a member of the structure. In Kernel 2.6.12 there appears to be some change to the PCI datastructure and "slot_name" is no longer a valid structure member. There is a funtion "pci_name" that can be passed the pointer to PCI device to get thte slot_name. A patch needs to be applied to take care of this. These are the patches which I applied for the successful installation of ATI driver:

# fglrx-2.6.12-inter_module_get.patch
# fglrx-2.6-agpgart.patch
# kernel-2.6.12-agpgart.patch
  • Applying patches:
$ ebuild /usr/portage/media-video/ati-drivers/ati-drivers-8.12.10.ebuild unpack
$ cd /var/tmp/portage/ati-drivers-8.12.10/lib/modules/fglrx/build_mod
$ patch -p0 < Path to fglrx-2.6.12-inter_module_get.patch
$ patch -p0 < Path to fglrx-2.6-agpgart.patch
$ patch -p0 < Path to kernel-2.6.12-agpgart.patch
<--- At this point the filename is firegl_public.c as the file to patched ----> $ ebuild /usr/portage/media-video/ati-drivers/ati-drivers-8.12.10.ebuild compile
$ ebuild /usr/portage/media-video/ati-drivers/ati-drivers-8.12.10.ebuild install
$ ebuild /usr/portage/media-video/ati-drivers/ati-drivers-8.12.10.ebuild qmerge
  • Switch to the ATI OpenGL libraries.
$ opengl-update ati
  • Configure X
$ fglrxconfig
It asked me a bunch of questions and accordingly generated a config file for my system. I saved 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 I needed 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
$ glxgears $ fgl_glxgears
If things worked right, then the first command should echo back something with "OpenGL vendor string:ATI Technologies Inc." and glxgears should show respectable frame-rates (something like 1880 FPS in my case) and fgl_glxgears should run just fine with decent frame-rates.


 Configure touchpad (ALPS Touchpad):

Top
  • Install a driver

I installed the synaptics touchpad driver which works fine for ALPS as well.

$ emerge synaptics
  • Modify /etc/X11/xorg.conf
I added the following in the xorg.conf:
Section "InputDevice" Identifier "ALPS GlidePoint"
Driver "synaptics"

Option  "Device"      "/dev/psaux"
Option  "Protocol"     "auto-dev"
Option  "LeftEdge"    "120"
Option  "RightEdge"    "830"
Option  "TopEdge"    "120"
Option  "BottomEdge"    "800"
Option  "FingerLow"    "25"
Option  "FingerHigh"    "30"
Option  "EmulateMidButtonTime"    "75"
Option  "VertScrollDelta"    "20"
Option  "HorizScrollDelta"    "20"
Option  "MaxTapTime"    "180"
Option  "MinSpeed"    "0.5"
Option  "MaxSpeed"    "1.5"
Option  "AccelFactor"    "0.075"
Option  "EdgeMotionMinSpeed"    "200"
Option  "EdgeMotionMaxSpeed"    "200"
Option  "UpDownScrolling"     "1"
Option  "LeftRightScrolling"    "1"
Option  "CircularScrolling"     "0"
Option  "SHMConfig"    "on"
EndSection

........
Section "ServerLayout"

.......
InputDevice  "ALPS GlidePoint"     "SendCoreEvents" #Here I want to use external mouse as well. So I have not made it as a CorePointer. Please see my complete xorg.conf for referece.
.......

EndSection

I have built the kernel with evdev as a module so I added it to my autoload modules .
/etc/modules.autoload.d/kernel-2.6
evdev



 Configure wired network (Broadcom 440x):

Top
  • Kernel Configuration
I compiled the kernel with my wired network adapter as a module so that I can load it whenever I want to use it. Here I want to use wireless network as my frst preference so I do not load it during boot. But I tried it once by manually loading the module and it works fine.
Device Drivers ----->
  Networking Support ----->
    Ethernet (10 or 1000 Mbit) ----->
      Broadcom 4400 ethernet support
  • configure wired network at boot
If you want to configure wired network at startup do the following:
/etc/modules.autoload.d/kernel-2.6
b44
Add net.eth0 to default run level.
$ rc-update add net.eth0 default



 Configure wireless network (Intel pro/wireless 2200 BG):

Top
  • Kernel Configuration
I am using AES encryption so I built the support for it in the kernel.
Cryptographic Option ----->
   AES cipher algorithms (i586)
  • Install wireless adapter driver
$ emerge --deep ipw2200
  • Install wpa_supplicant
For AES/CCMP encryption wpa_supplicant utility is required.
$ emerge wpa_supplicant
  • Modify /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=2
fast_reauth=1

network={
  ssid="yourssid"
  bssid=Your bssid
  scan_ssid=1
  proto=WPA
  key_mgmt=WPA-PSK
  #pairwise=CCMP
  #group=CCMP
  psk="your key"
  priority=5
}
  • configure wireless network at startup
/etc/modules.autoload.d/kernel-2.6
ipw2200
Add wpa_supplicant to default run level.
$ rc-update add wpa_supplicant default
Here I changed /etc/init.d/wpa_supplicant for starting dhcpcd for wireless network(eth1). Here is my modified wpa_supplicant which does everything at startup.



 Configure Sound using ALSA (Advanced Linux Sound Architecture):

Top
I built ALSA in my kernel.
  • Finding soundcard
$ lspci | grep -i audio
I had done "emerge pciutils" for using lspci command.
  • Install alsa-utils
$ emerge -deep alsa-utils
  • Automatically load the kernel module.
I edited the /etc/modules.d/alsa for adding my soundcard.
alias snd-card-0 snd-intel8x0
Note: intel8x0 is my sound card. You can change it according to the output of your lspci command.
Alternatively one can use alsaconf to detect one's sound card automatically.
$ alsaconf
$ 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



 CPU Frequency Scaling:

Top
  • Kernel Configuration
Power management options (ACPI, APM) ---> CPU Frequency scaling --->
[*] CPU Frequency scaling
<*> /proc/cpufreq interface (deprecated)
Default CPUFreq governor (performance)
<*> 'powersave' governor
'ondemand' cpufreq policy governor
<*> CPU frequency table helpers
Intel Enhanced SpeedStep
[*] Use ACPI tables to decode valid frequency/voltage pairs (EXPERIMENTAL)
  • Install acpid and add to default it run level
$ emerge acpid
$ rc-update add acpid default
  • configure cpu frequency scaling at startup
/etc/modules.autoload.d/kernel-2.6
cpufreq_ondemand
speedstep_centrino
This is my myondemand script which enables ondemand at startup. I saved it to /etc/init.d/ directory , made it executable and added it to default runlevel.
$ chmod a+x /etc/init.d/myondemand
$ rc-update add MyOnDemand default
I also added some more power saving options to my xorg.conf file.
/etc/X11/xorg.conf
Section "ServerLayout"

  .......
  Option "BlankTime" "5" #Blank the screen
  Option "StandbyTime" "10" #Turn off screeen
  Option "SuspendTime" "15" #Hibernate screen
  Option "OffTime" "30" #Turn off

EndSection



 Configure Multimedia keys:

Top
  • Determine the key code
I executed xev command, pressed the keys one by one and noted the output of xev for each multimedia key.
$ xev
  • Save key codes
I created .Xmodmap file in my $HOME and saved the key codes.
$HOME/.Xmodmap
keycode 160=XF86AudioMute
keycode 162=XF86AudioPlay
keycode 176=XF86AudioRaiseVolume
keycode 174=XF86AudioLowerVolume
keycode 153=XF86AudioNext
keycode 144=XF86AudioPrev
keycode 164=XF86AudioStop
  • Call xmodmap in .xsession
$HOME/.xsession
xmodmap $HOME/.Xmodmap
  • Assign key to special function
I am using XFCE4 as my desktop environment. I did the following for assigning keys to special functions:

# Open the Setting Manager
# Click on window manager and select the "Keyboard" tab.
# Click "Add" to create a new theme.
# In the "Command Shortcuts" section doubleclick on an empty slot, enter the command for a key.

Here are the commands which I used for my multimedia keys:

# Mute: amixer -q set Master toggle
# VolumeRaise: amixer -q set PCM 2+ unmute
# VolumeLower: amixer -q set PCM 2- unmute
# Play/Pause: /usr/bin/xmms --play-pause
# Rewind: /usr/bin/xmms --rew
# Forward: /usr/bin/xmms --fwd
# Stop: /usr/bin/xmms --stop




 Configure SCSI driver for DVD RW:

Top
I tried to enable dma transfer for my DVD which had been recognized as an IDE device. I executed "hdparam -d1 /dev/dvd"command and it failed with a message "HDIO_SET_DMA failed: Operation not permitted". After a long search I found a solution on gentoo forum
It required editing /usr/src/linux/include/linux/libata.h
Change
#undef ATA_ENABLE_ATAPI /* define to enable ATAPI support */
to
#define ATA_ENABLE_ATAPI /* define to enable ATAPI support */
After this I needed to change the kernel to enable SCSI cdrom support.
$ cd /usr/src/linux
$ make menuconfig
Device Drivers --->
 ATA/ATAP/MFM/RLL support --->
  [ ] ATA/ATAPI/MFM/RLL


Device Drivers --->
 SCSI Device drivers--->
  < *> SCSI cdrom support
$ make && make modules_install
At this stage, I copied the new kernel image to /boot and rebooted to the new kernel. My DVD was recognized as a SCSI device and /dev/dvd was automatically pointing to /dev/sr0.. Immediately my data transfer rate improved big time.
After this I emerged xine-ui and xine-lib and could watch full screen dvd flawlessly.



 Configure Joystick/Wheel:

Top

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:

Top
  • 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