Gentoo Installation (Inspiron 6400)

In Gentoo on 17/04/2011 by pier0w

Here is a run down of the Gentoo installation I did on an Inspiron 6400. I will walk through the configuration I used in the different stages of the Gentoo Handbook installation.

I chose to install the x86 version of Gentoo because it has better compatibility with closed sources applications like Java and Flash.

I’m not going to walk through how I set up my network for the install.

4. Preparing the Disks

The disk layout I chose is the same as the one the Gentoo Handbook recommends. That is a very small boot partition at the start of the disk, then a 512Meg swap partition after that, and lastly the rest of the disk is an ext3 partition that will be used for the root file system.

Here is the output of fdisk -l:

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xab6ad924

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048       67583       32768   83  Linux
/dev/sda2           67584     1116159      524288   82  Linux swap / Solaris
/dev/sda3         1116160   488397167   243640504   83  Linux

As you can see I have added a larger hard drive to this laptop but otherwise the partition layout is nice and simple. I decided not to use ext4 because I don’t think I will require any of it’s new features and maybe it’s not as light wait as ext3, but I am not certain of that.

5. Installing the Gentoo Installation Files

The only thing that I did different in this section was to set the MAKEOPTS to use three threads.


6. Installing the Gentoo Base System

I have added a large number of USE flags to the make.conf file, this is just to make sure that all the required features are compiled in. Also the video card driver has been set to the intel driver.

Here is the make.conf file:

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -march=i686 -pipe"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult before changing.

USE="a52 aac acpi aim alsa cdda cddb cdr css dts dv dvd dvdr encode ffmpeg flac gif
gphoto2 icq ios ipod jpeg jpeg2k lame lirc matroska mmx mp3 mp4 mpeg mplayer msn
musicbrainz ogg opengl png quicktime raw samba smp sound sse sse2 svg svga theora truetype
udev usb v4l v4l2 vcd vorbis wifi win32codecs wmf x264 xvid"

GENTOO_MIRRORS=" rsync:// rsync://"



7. Configuring the Kernel

I have customised the kernel (2.6.36-gentoo-r8) quite a bit to fit this laptop and to add some extra functionality for wireless and XBMC support.

Below are the custom settings that I used.

Processor type and features  --->
    Processor family (Core 2/newer Xeon)  --->
        (X) Core 2/newer Xeon

File System:
File systems  --->
    <*> Second extended fs support
    [*]   Ext2 extended attributes
    [*]     Ext2 POSIX Access Control Lists
    [*]     Ext2 Security Labels
    [*]   Ext2 execute in place support
    <*> Ext3 journalling file system support
    [*]   Ext3 extended attributes
    [*]     Ext3 POSIX Access Control Lists
    [*]     Ext3 Security Labels
    <*> The Extended 4 (ext4) filesystem
    [*]   Ext4 extended attributes
    [*]     Ext4 POSIX Access Control Lists
    [*]     Ext4 Security Labels
    [*] Dnotify support
    [*] Inotify support for userspace
    [*] Quota support
    [*] Report quota messages through netlink interface
    <*> Quota format vfsv0 and vfsv1 support
    <*> Kernel automounter version 4 support (also supports v3)
    <*> FUSE (Filesystem in Userspace) support
    CD-ROM/DVD Filesystems  --->
        <*> ISO 9660 CDROM file system support
        [*]   Microsoft Joliet CDROM extensions
        [*]   Transparent decompression extension
        <*> UDF file system support 
    DOS/FAT/NT Filesystems  --->
        <*> MSDOS fs support
        <*> VFAT (Windows-95) fs support
        (437) Default codepage for FAT
        (iso8859-1) Default iocharset for FAT
        <*> NTFS file system support
        [*]   NTFS write support
    [*] Network File Systems  --->
        <*>   NFS client support
        [*]     NFS client support for NFS version 3
        [*]       NFS client support for the NFSv3 ACL protocol extension
        [*]     NFS client support for NFS version 4
        [*]     Root file system on NFS
        <*>   CIFS support (advanced network filesystem, SMBFS successor)

Intel Graphics: (Intel GMA, Gentoo 3D Acceleration, GLX)
Device Drivers  --->
    Graphics support  --->
        Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
            <*>   Intel I810
            <*>   Intel 830M, 845G, 852GM, 855GM, 865G (i915 driver)  --->
                (X) i915 driver
            [*]     Enable modesetting on intel by default

Sound: (Gentoo Alsa)
Device Drivers  --->
    <*> Sound card support  --->
        <*>   Advanced Linux Sound Architecture  --->
            [*]   PCI sound devices  --->
                <*>   Intel HD Audio  --->
                    [*]   Build hwdep interface for HD-audio driver
                    [*]   Build Realtek HD-audio codec support
                    [*]   Build Analog Device HD-audio codec support
                    [*]   Build IDT/Sigmatel HD-audio codec support
                    [*]   Build VIA HD-audio codec support
                    [*]   Build ATI HDMI HD-audio codec support
                    [*]   Build NVIDIA HDMI HD-audio codec support
                    [*]   Build INTEL HDMI HD-audio codec support
                    [*]   Build Cirrus Logic codec support
                    [*]   Build Conexant HD-audio codec support
                    [*]   Build Creative CA0110-IBG codec support
                    [*]   Build C-Media HD-audio codec support
                    [*]   Build Silicon Labs 3054 HD-modem codec support
                    [*]   Enable generic HD-audio codec parser

Device Drivers  --->
    [*] Network device support  --->
        <*>   Broadcom 440x/47xx ethernet support

Wireless: (Iwlwifi, Gentoo Wireless):
The wireless drivers are loaded as modules because they need to access the file system (/lib/firmware) which is loaded AFTER the kernel loads.
General setup  --->
    [*] Prompt for development and/or incomplete code/drivers
[*] Networking support  --->
    -*-   Wireless  --->
        <*>   cfg80211 - wireless configuration API
        [*]     nl80211 testmode command
        [*]     enable powersave by default
        [*]     cfg80211 wireless extensions compatibility
        [*]   Wireless extensions sysfs files
        <*>   Common routines for IEEE802.11 drivers
        <*>   Generic IEEE 802.11 Networking Stack (mac80211)
        [*]   Enable LED triggers
Device Drivers  --->
    Generic Driver Options  --->
        -*- Userspace firmware loading support
    [*] Network device support  --->
        [*]   Wireless LAN  --->
            <M>   Intel Wireless Wifi
            [*]     Enable full debugging output in iwlagn and iwl3945 drivers
            <M>     Intel Wireless WiFi Next Gen AGN (iwlagn)
            [*]       Intel Wireless WiFi 4965AGN
            [*]       Intel Wireless-N/Advanced-N/Ultimate-N WiFi Link
            <M>     Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)
-*- Cryptographic API  --->
    -*-   Cryptographic algorithm manager
    [*]   Disable run-time self tests
    -*-   Authenc support
    -*-   CBC support
    -*-   ECB support
    <*>   PCBC support
    -*-   HMAC support
    -*-   MD5 digest algorithm
    <*>   Michael MIC keyed digest algorithm
    -*-   SHA1 digest algorithm
    <*>   SHA224 and SHA256 digest algorithm
    -*-   AES cipher algorithms
    <*>   AES cipher algorithms (i586)
    -*-   ARC4 cipher algorithm
    -*-   DES and Triple DES EDE cipher algorithms

SD Card:
Device Drivers  --->
    <*> MMC/SD/SDIO card support  --->
        <*>   MMC block device driver
        [*]     Use bounce buffer for simple hosts
        <*>   Secure Digital Host Controller Interface support
        <*>   SDHCI support on PCI bus
        <*>   SDHCI support on the platform specific bus

You’ll notice that in the wireless section some of the drivers have been compiled as modules so they need to be registered to load on start up. I have added them to my /etc/modules.autoload.d/kernel-2.6 file, they are the only modules in there.

# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.
# Note that this file is for 2.6 kernels.
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line.  Comments begin with # and
# are ignored.  Read man modules.autoload for additional details.

# For example:
# aic7xxx


Also for the sound to work the alsa needs to be configured. So first install alsa.
#> emerge -av alsa-utils

Once alsa has finished installing start it up.

#> /etc/init.d/alsasound start

Next unmute the volume so that it is possible to actually hear something. Do this by starting alsamixer then highlighting the Master and PCM channels and pressing the ‘m’ key to make sure they have 00 instead of MM at the bottom.

#> alsamixer

Lastly set alsa to start at boot.

#> rc-update add alsasound boot

8. Configuring your System

I set up fstab in the a exact same way as the handbook, but the networking I had to do a little differently.

Firstly to get the wireless working I had to install an extra package called iwl3945-ucode which is used by the drivers.

#> emerge -av iwl3945-ucode

Also a symlink needs to be created in the /etc/init.d/ directory for the wireless network.

#> cd /etc/init.d/
#> ln -s net.lo net.wlan0

Now the Gentoo handbook says to register the net.eth0 interface to start at boot, don’t do this because it will be started anyway. One thing that can be done is to tell Gentoo which interface to start net.eth0 or net.wlan0, this is done within the /etc/conf.d/rc script in the RC_PLUG_SERVICES variable.

Below is the RC_PLUG_SERVICES setting that I used to only start the wlan0 interface.

RC_PLUG_SERVICES="net.lo net.wlan0 !net.eth*"

Next the wired and wireless network need to be setup so they start correctly, I have configured them both with static IP’s, this is so that later I will be able to control XBMC with the Android remote.

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

config_eth0=( " netmask brd" )
routes_eth0=( "default via" )

# Prefer wpa_supplicant over wireless-tools
modules=( "wpa_supplicant" )

# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet

config_wlan0=( " netmask brd" )
routes_wlan0=( "default via" )

My wpa_supplicant configuration is very simple.

# The below line not be changed otherwise we refuse to work

# Ensure that only root can read the WPA configuration

# Let wpa_supplicant take care of scanning and AP selection

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
    # The higher the priority the sooner we are matched

# Same as previous, but request SSID-specific scanning (for APs that reject
# broadcast SSID)

The last extra piece of configuration that I carried out is to do with the key mapping, I created mappings for the buttons on the front of the laptop that are meant to be used to control the DVD drive. I have mapped these keys to the keyboard letters that correspond to the volume and play controls of XBMC.

Custom key mappings need to be placed in a file under the /usr/share/keymaps/include/ directory and can have any name as long as they have the “.map” extension.

The file I created was called and had the following content.
keycode 113 = 0x0030
keycode 114 = 0x002d
keycode 115 = 0x002b
keycode 164 = 0x0020
keycode 165 = 0x0072
keycode 163 = 0x0066
keycode 166 = 0x0078

This creates the following mapping:
Mute Button -> 0
Volume Down Button -> –
Volume Up Button -> +
Play Button -> Space
Track Back Button -> r
Track Forward Button -> f
Stop Button -> x

To find the values of the face buttons use the showkey program, just run it and start pressing the face buttons you should get output like this:
#> showkey
keycode 113 press    <-- When I Pressed Mute
keycode 113 release
keycode 114 press    <-- When I Pressed Volume Down
keycode 114 release
keycode 115 press    <-- When I Pressed Volume Up
keycode 115 release
keycode 164 press    <-- When I Pressed Play
keycode 164 release

Now to find the “keysym” (the last value in the key mapping) for the keys that you want the buttons to represent run the dumpkeys -l command and grep the keys you want.
#> dumpkeys -l | grep zero
0x0030    zero
0x0830    Meta_zero
#> dumpkeys -l | grep plus
0x002b    plus
0x00b1    plusminus
0x082b    Meta_plus
#> dumpkeys -l | grep minus
0x002d    minus
0x00b1    plusminus
0x082d    Meta_minus
#> dumpkeys -l | grep space
0x0020    space
0x00a0    nobreakspace
0x0820    Meta_space
no-break_space  for nobreakspace
#> dumpkeys -l | grep "r$"
0x0012    Control_r
0x0024    dollar
0x0034    four
0x003e    greater
0x0072    r
0x007c    bar
0x00a6    brokenbar
0x00b2    twosuperior
0x00b3    threesuperior
0x00b9    onesuperior
0x00bc    onequarter
0x0118    Prior
0x030e    KP_Enter
0x0701    AltGr
0x0812    Meta_Control_r
0x0824    Meta_dollar
0x0834    Meta_four
0x083e    Meta_greater
0x0872    Meta_r
0x087c    Meta_bar
0x0c01    SAltGr
PageUp          for Prior
AltR            for AltGr
Alt_R           for AltGr
AltGr_R         for AltGr
#> dumpkeys -l | grep "f$"
    0x0000 - 0x00ff
    0x0100 - 0x01ff
    0x0500 - 0x05ff
    0x0800 - 0x08ff
    0x0b00 - 0x0bff
    0x0d00 - 0x0dff
0x0006    Control_f
0x0066    f
0x00bd    onehalf
0x0806    Meta_Control_f
0x0866    Meta_f
#> dumpkeys -l | grep "x$"
0x0018    Control_x
0x0036    six
0x0078    x
0x00c2    Acircumflex
0x00ca    Ecircumflex
0x00ce    Icircumflex
0x00d4    Ocircumflex
0x00db    Ucircumflex
0x00e2    acircumflex
0x00ea    ecircumflex
0x00ee    icircumflex
0x00f4    ocircumflex
0x00fb    ucircumflex
0x0402    dead_circumflex
0x0818    Meta_Control_x
0x0836    Meta_six
0x0878    Meta_x
dead_caron      for dead_circumflex

Now that the mappings have been setup we need to tell Gentoo to use them, this is done by putting the name of our mappings file minus the extension into the EXTENDED_KEYMAPS variable of the /etc/conf.d/keymaps file.

# /etc/conf.d/keymaps

# Use KEYMAP to specify the default console keymap.  There is a complete tree
# of keymaps in /usr/share/keymaps to choose from.


# Should we first load the 'windowkeys' console keymap?  Most x86 users will
# say "yes" here.  Note that non-x86 users should leave it as "no".


# The maps to load for extended keyboards.  Most users will leave this as is.


# Tell dumpkeys(1) to interpret character action codes to be 
# from the specified character set.
# This only matters if you set UNICODE="yes" in /etc/rc.conf.
# For a list of valid sets, run `dumpkeys --help`


That is the end of the extra configuration for this section.

10. Configuring the Bootloader

I installed GRUB and used the following kernel line so that the console runs in a nice frame buffer.

kernel /boot/kernel-2.6.36-gentoo-r8 root=/dev/sda3 video=uvesafb:mtrr:3,ywrap,1280x800-32@60

11. Finalizing your Gentoo Installation

The very last peace of Gentoo specific configuration I did was to create an xbmc user. I made sure the user had video, audio, usb, and dvd privileges.

#> useradd -d /home/xbmc -m -G audio,cdrom,video,cdrw,usb,users xbmc

Now reboot the laptop and hopefully everything works, if it does now would be a good time to run a global update.

#> emerge --update --deep world

Once this has completed there is a good chance that Python will have been updated to version 3. XBMC and it’s dependencies do not like this version of Python so will fail to compile or run. To fix this use eselect to set Python back to version 2.6.

#> eselect python list
Available Python interpreters:
  [1]   python2.6
  [2]   python3.1 *

#> eselect python set 1
#> eselect python list
Available Python interpreters:
  [1]   python2.6 *
  [2]   python3.1


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s