Sunday, February 25, 2007

My first bollywood theater experience in the USA

This is my last quarter here at Stanford and I am taking all my courses as credit/no credit. Hence, I get some free time during the weekends. So I decided to watch a hindi movie in a theater with one of my friends. I searched on the web and found that "salam-e-ishq" is a new bollywood hit. So I bought tickets for it online (Naz8, Fremont). I was looking forward to my first bollywood theater experience here, in the US. However, someone told me that "salam-e-ishq" is not a good movie, "Eklavya" is a much better movie. I wanted to make this experience as a good experience with a good movie so I decided to get my ticket changed. The movie was supposed to start at 1 PM and I reached there 5min to 1 PM. Luckily, there were couple of available tickets for "Eklavya" and I could magage to get one for Eklavya.

Since this was my first bollywood theater experience, I was comparing everything with my PVR experience in India. I found that the architecture and decor was very similar to old traditional inidian movie theaters. Surprisingly, it was not very crowded even though it is located in the heart of Indian community in the bay area. During the interval we ate some samosas with chuttney, this reminded me my childhood when I used to go to a theater for samosas and aaloo-chat. After the movie, I visited the indian costume shop, right across the street. I was feeling as if I am in Sarojni Nagar market, colorful clothes, glass bangles and bindis. The store had a small indian beauty parlor as well. There was a good collection of lehenga though I found them a little expensive. Even though I did not buy anything, I enjoyed my window shopping in an indian store.

Well, about the movie. Overall, I liked the movie "Eklavya". I was happy that the movied did not have many songs (only one song) and there were no dance scenes around trees and on a moutain.

Thursday, August 18, 2005

Gentoo on Inspiron 6000

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:
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):
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 stallation.
$ 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) :
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 <> $ 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):
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):
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):
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):
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:
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:
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:
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:
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

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