HOWTO Gentoo 2007.0 on Dell 700m

gentoo

During the last disaster, I lost the root partition, while the good news is the irresponsible mkstage4.sh backup the /etc that saves a huge amount of time for me to emerge world.

This post would summarize the efforts for my record and for your convenience. This HOWTO is originally posted in the official forum three years ago, and I once tried to update it in my previous post as well. Since then, some devices get supported, some software packages are obsolete, Life runs fast.

Overview of the System

The hardware specification of Dell Inspiron 700M:

The kernel also need to support the following gadgets:

Bootstrap

Stage 1 installation is discouraged and we don’t need to bootstrap the system from GCC 3.x to GCC 4.x. What we need to do is to setup the CFLAGS, USE. Here are configurations I am using everyday: make.conf, package.keywords, package.use and package.unmask.

I am quite conservative of the system setting, I love Gentoo because of its flexible package management system and outstanding performance as well. But I would not pay tons of sweat for one ounce of performance.

Partitioning and File System

Most likely, the laptop is dedicated for single user, you. Make sure put your home directory into a different partition, that would save tremendous efforts to undelete the file, backup, and once the system crashed, you still have your precious work in your hand. /usr/portage and /var/tmp/portage and two hot spots for Gentoo users. It is addicted to sync the portage daily and update the world if possible. So if possible, put the two directory into different partition. As the rotation of your tires, rotate the partitions if possible. For desperate Gentoo users, read TIP Speeding up portage with tmpfs.

Although JFS is the most power-efficient file system, but it lacks the feature to relocate the bad sectors, so use it in caution. I was just bitten by the FS/HD crash.

Power Management

Energy Budget
Energy Budget

From Day 1, we need to worry about the power, which is the shortest staff in the mobile computing imho. According to the official Power Management Guide, the display, CPU, HD dominate the energy budget, and we may take some actions for remedy.

CPU frequency scaling

In most scenarios, 1.6GHz is overkill, except emerging the packages. So the default CPUFreq governor is conservative, theory proves that the minimum computing power as required would save the most energy in the long run. In the userland, emerge the cpufrequtils and setup the conservative as the governor in /etc/conf.d/cpufrequtils

Display

The best way to save the energy is to close the lid, the screen is shutdown by BIOS. And you can enable DPMS support in xorg.conf. Or “should I pay the price and run some cool xscreensaver to make me superior among MS Windows dudes?”. I am not quite sure whether xscreensaver still running when the display is blanked out. According to the log of xscreensaver-command -watch, most likely it is still running. So it is up to you.

Hard disk

hdparm can tunes the performance of ATA harddisk, here is my hdparm.conf for your reference. laptop-mode would call hdparm for power management. The default configuration covers most common cases, we may fine tune the setup for the following sections:

# Idle timeout values. (hdparm -S)
# Default is 2 hours on AC (NOLM_HD_IDLE_TIMEOUT_SECONDS=7200) and 5 seconds
# for battery and for AC with laptop mode on.
LM_AC_HD_IDLE_TIMEOUT_SECONDS=7200
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=600
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200

According to the FAQ, I think 5s spin down is too aggressive, that may kill my hardisk. For other options, I enable the DPMS in the xorg.conf, and also in xscreensaver. Another interesting feature is to hibernate the system when battery is below the critical level, that may aid to save the work for the ignorant users, for example, myself.

Video

HOWTO Direct rendering on Intel Extreme Graphics (855GM) chipsets covers all the odds and ends to setup the DRI. Here is my xorg.conf. To take the full advantage of XGA screen, we need 915resolution, the replacement of 855resolution, to replace some video mode by 1280 x 800.

Dell 700m supports video output, Fn + F8 as the shortcut. For the first generation 700m, this function is not built into the BIOS, so we have to explicitly to setup the video pipe using 3rd party tool, either 855switch(obsoleted from the portage) or i855crt. The later module supports this functionality out of the box, but you need to adjust the resolution before your presentation, try xrandr or krandrtray.

Since suspend2 supports fbsplash userspace UI, it is worthy taking sometime to work on fbsplash, follow this HOWTO to build the kernel:

 VESA VGA graphics support
 VESA driver type (vesafb-tng) --->
(1024x768@72) VESA default mode
 Intel 810/815 support (EXPERIMENTAL)
 Intel 830M/845G/852GM/855GM/865G/915G/945G support (EXPERIMENTAL)

Note: Do not build i810fb or intelfb, use vesafb-tng instead.

Follow the rest section, and replace livecd-2006.1 with livecd-2007.0. Setup the kernel option in grub.conf:

title=Gentoo suspend2 2.6.21
root (hd0,0)
kernel /boot/kernel-2.6.21-suspend2-r6 root=/dev/hda3 video=vesafb:ywrap,mtrr,1024x768-24@72 splash=silent,fadein,theme:livecd-2007.0 quiet CONSOLE=/dev/tty1 resume2=swap:/dev/hda6
initrd /boot/fbsplash-livecd-2007.0-1024x768

I was amazed by the beauty of livecd-2007.0 theme, literally.

Suspend and Hibernation

The suspend2-sources is preferred over gentoo-sources due to the hibernation. Just follow this HOWTO to get things done. The inline help in configuration is quite straightforward, to take the advantage of fbsplash, link the livecd-2007.0 fbsplash theme to suspend2, then enable the fbsplash in various configuration files.

ProcSetting userui_program /sbin/suspend2ui_fbsplash
FBSplash on
FBSplashTheme suspend2

And here are some misc options that help:

Runi915resolution yes
LockConsoleAs root
EnableVbetool yes
SwitchToTextMode no

You need vbetool to restore VBE status, and I suggest to lock all consoles and X11 using vlock for the sake of security.

Wireless

This HOWTO provides detailed instruction for the basic functionality. Unfortunately, the new kernel seems to have problem to load appropriate drivers when setting the key for the WEP encrypted network. Generally, the ieee80211_crypt_wep requires:

If you are paranoid to have a monolithic kernel, you could iterate all the combinations of built-into kernels and modules, and report here. Note: the ipw2200 module is always to built as module. To make my life easier, I just build all of them into the kernel, and WEP just works.

If you want to rename the wireless network interface to wlan0 instead of eth1, you need to configure the module parameters in /etc/modules.d/ipw2200:

install ipw2200 /sbin/modprobe --ignore-install ipw2200; /sbin/ifrename

and setup the rule in /etc/iftab:

wlan* driver ipw2200

##SD/MMC Card reader

Thanks to the SDHCI’s hard work, the built-in SD/MMC card reader in Dell 700m eventually works, with some flaws though: You need to enable the Device Drivers | MMC/SD card support and the following options:

 MMC block device driver
 --- MMC/SD Host Controller Drivers
  Secure Digital Host Controller Interface support (EXPERIMENTAL)
  TI Flash Media MMC/SD Interface support (EXPERIMENTAL)

and also the Device Drivers | Misc devices:

 TI Flash Media interface support (EXPERIMENTAL)
 TI Flash Media PCI74xx/PCI76xx host adapter support (EXPERIMENTAL)

Since most likely, the MMC uses fat/vfat as the file system, make sure build them into kernel or modules. To mount the MMC/SD card, the following modules are supposed to be loaded or built into the kernel:

Once you plugin the card, and the /dev/mmcblk0p1 shows up, you are good to setup the kernel. To make your life easier, you can put the following lines into /etc/udev/rules.d/98-mmc.rules:

KERNEL=="mmcblk[0-9]p[0-9]", NAME="%k", GROUP="disk"

The volume manager, in my case kioslave would mount the device for you. Unfortunately, whenever I tried to read the file from the SD card, there are lots of error messages like this:

Jul 23 16:52:24 tiger end_request: I/O error, dev mmcblk0, sector 496672
Jul 23 16:52:24 tiger end_request: I/O error, dev mmcblk0, sector 496680
Jul 23 16:52:24 tiger end_request: I/O error, dev mmcblk0, sector 496688
Jul 23 16:52:24 tiger end_request: I/O error, dev mmcblk0, sector 496696

I am quite confident that the card is working, still need to find out where the nasty errors come from.

Fn Keys

I once worked on Gentoorizing a daemon that could handle the extended keycode in both console and X11. Unfortunately, I lost the patch and ebuild, so I decided to just pick up what is on the table: xbindkeys according to this HOWTO, here is my .Xmodmap:

keycode 160 = XF86AudioMute
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 223 = XF86Standby

and my .xbindkeyrc:

"amixer set PCM toggle"
XF86AudioMute

"amixer set PCM 5%-"
XF86AudioLowerVolume

"amixer set PCM 5%+"
XF86AudioRaiseVolume

"sudo /usr/sbin/hibernate-ram"
XF86Standby

You need to setup the /etc/sudoers to enable the users to hibernate the machine without providing password, like this:

%users ALL=(ALL) NOPASSWD: /usr/sbin/hibernate-ram, /usr/sbin/hibernate

Others

Summary

As a laptop user, there are still some tasks to do to improve the user experience:

Network roaming(fplugd?) - how to setup the wired/wireless network when migrating from one network to another?

These are beyond Dell 700m specific issues, it is more or less that all laptop users may face the same problem. I would keep posting my solution in this blog, thanks for your patience.