Oct05

Setup Gentoo on Lenovo Thinkpad W510

Setting up Gentoo Linux on a Lenovo device is straight forwarded since Lenovo already supports several linux distributions and lots of manuals and further readings.

Related Posts

Lenovo W510 Integrated Webcam & Face Authentication
Lenovo W510 Fingerprint Reader & Gnome Integration
Suspend2 on Thinkpad W510
Debian GNU/Linux on the Thinkpad W510
Find more manuals for Linux on IBM/Lenovo Laptops on tuxmobile.org

Hardware

  • Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz
ws1 linux # lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
CPU(s):                8
Thread(s) per core:    2
Core(s) per socket:    4
CPU socket(s):         1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 30
Stepping:              5
CPU MHz:               1600.000
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
  • 1x 4 GB DDR3 RAM
  • 128 GB SATA Solid State Disk (Linux System, Linux Swap ~5 GB, Windows NTFS)
  • 500 GB SATA Hard Disk
  • Nvidia Quadro FX880M
  • Intel Corporation 82577LM Gigabit Network Connection
  • Intel Corporation WiFi Link 6000 Series

Details

ws1 ~ # lspci
00:00.0 Host bridge: Intel Corporation Clarksfield/Lynnfield DMI (rev 11)
00:03.0 PCI bridge: Intel Corporation Clarksfield/Lynnfield PCI Express Root Port 1 (rev 11)
00:08.0 System peripheral: Intel Corporation Clarksfield/Lynnfield System Management Registers (rev 11)
00:08.1 System peripheral: Intel Corporation Clarksfield/Lynnfield Semaphore and Scratchpad Registers (rev 11)
00:08.2 System peripheral: Intel Corporation Clarksfield/Lynnfield System Control and Status Registers (rev 11)
00:08.3 System peripheral: Intel Corporation Clarksfield/Lynnfield Miscellaneous Registers (rev 11)
00:10.0 System peripheral: Intel Corporation QPI Link (rev 11)
00:10.1 System peripheral: Intel Corporation QPI Routing and Protocol Registers (rev 11)
00:16.0 Communication controller: Intel Corporation Ibex Peak HECI Controller (rev 06)
00:16.3 Serial controller: Intel Corporation Ibex Peak KT Controller (rev 06)
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)
00:1a.0 USB Controller: Intel Corporation Ibex Peak USB2 Enhanced Host Controller (rev 06)
00:1b.0 Audio device: Intel Corporation Ibex Peak High Definition Audio (rev 06)
00:1c.0 PCI bridge: Intel Corporation Ibex Peak PCI Express Root Port 1 (rev 06)
00:1c.1 PCI bridge: Intel Corporation Ibex Peak PCI Express Root Port 2 (rev 06)
00:1c.3 PCI bridge: Intel Corporation Ibex Peak PCI Express Root Port 4 (rev 06)
00:1c.4 PCI bridge: Intel Corporation Ibex Peak PCI Express Root Port 5 (rev 06)
00:1c.6 PCI bridge: Intel Corporation Ibex Peak PCI Express Root Port 7 (rev 06)
00:1c.7 PCI bridge: Intel Corporation Ibex Peak PCI Express Root Port 8 (rev 06)
00:1d.0 USB Controller: Intel Corporation Ibex Peak USB2 Enhanced Host Controller (rev 06)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
00:1f.0 ISA bridge: Intel Corporation Ibex Peak LPC Interface Controller (rev 06)
00:1f.2 SATA controller: Intel Corporation Ibex Peak 6 port SATA AHCI Controller (rev 06)
00:1f.3 SMBus: Intel Corporation Ibex Peak SMBus Controller (rev 06)
01:00.0 VGA compatible controller: nVidia Corporation Device 0a3c (rev a2)
01:00.1 Audio device: nVidia Corporation Device 0be2 (rev a1)
03:00.0 Network controller: Intel Corporation WiFi Link 6000 Series (rev 35)
0d:00.0 SD Host controller: Ricoh Co Ltd Device e822 (rev 01)
0d:00.1 System peripheral: Ricoh Co Ltd Device e230 (rev 01)
0f:00.0 USB Controller: NEC Corporation Device 0194 (rev 03)
17:00.0 SD Host controller: Ricoh Co Ltd Device e822 (rev 01)
17:00.3 FireWire (IEEE 1394): Ricoh Co Ltd Device e832 (rev 01)
ff:00.0 Host bridge: Intel Corporation QuickPath Architecture Generic Non-Core Registers (rev 04)
ff:00.1 Host bridge: Intel Corporation QuickPath Architecture System Address Decoder (rev 04)
ff:02.0 Host bridge: Intel Corporation QPI Link (rev 04)
ff:02.1 Host bridge: Intel Corporation QPI Physical 0 (rev 04)
ff:03.0 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller (rev 04)
ff:03.1 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Target Address Decoder (rev 04)
ff:03.4 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Test Registers (rev 04)
ff:04.0 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 0 Control Registers (rev 04)
ff:04.1 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 0 Address Registers (rev 04)
ff:04.2 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 0 Rank Registers (rev 04)
ff:04.3 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 0 Thermal Control Registers (rev 04)
ff:05.0 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 1 Control Registers (rev 04)
ff:05.1 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 1 Address Registers (rev 04)
ff:05.2 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 1 Rank Registers (rev 04)
ff:05.3 Host bridge: Intel Corporation Lynnfield Integrated Memory Controller Channel 1 Thermal Control Registers (rev 04)

64 Bit Architecture

The laptop comes with the Intel i7 720 QM processor which is a real quad core processor providing 8 cores (4 * 2 due to hyperthreading). Since we have “only” 4 GB of DDR3 memory, there would be no further needs for a 64 bit arch! But we have the option to add another 4 GB of RAM where a 64 bit arch would make sense.

The correct arch is not IA-64 which is for Itanium processors, a series of 64-bit Intel microprocessors. What we have to use is Intel’s x86-64 arch which first specs came from AMD and hence is known as AMD64.

Installing Gentoo Base

For system setup, we followed the steps in the Gentoo Quickinstall Guide. For any issues, read below!

Booting & Ext4 Filesystem

We decide to use ext4 filesystem but we ran into trouble (got stupid beginner – you forgot to compile for boot fs driver into the kernel – panic) when we tried to boot from that ext4 partition using Grub 0.97. Following the ext4.wiki.kernel.org, at least Grub2 1.97 is required for doing so. That’s the reason we gave Grub2 a chance and set it up following Gentoo’s Grub2 Wiki.

If you are chrooted from the Gentoo live CD you probably will get the warning “Cannot find list of partitions” when invoking “grub-mkconfig -o /boot/grub/grub.cfg”. Any Windows installation won’t be found in that case. That’s fine as long you linux was found correctly. Just re-run “grub-mkconfig -o /boot/grub/grub.cfg” when you get your system up. Without chrooting, os-prober will work properly.

If you cannot load the kernel, because the root (/dev/sd*) was not found, check whether you have enabled Intel PATA/SATA support at:

Device Drivers
    [*] Serial ATA and Parallel ATA drivers
        [*] ATA SFF support
            [*] Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support

Don’t enable PATA/SATA support as module since like the filesystem driver, this is required before any module is loaded.

Human Beeings Grub2 Howto

USE Flags

We found the following at the Gentoo development guide:

Modern x86 processors support special instruction sets like mmx, sse, SSE2 and 3DNow! AMD64 also provides support for them, but in most cases, x86 assembler code is incompatible with AMD64 assembler. There are lots of packages that provide support through USE flags for these instruction sets. Originally, the USE flags were introduced to keep support for older processors such as the Pentium I that can’t handle such code. Currently, all AMD64s support the same combination of extended instruction sets, so there is no reason to make use of the mentioned USE flags. That’s why these USE flags are hard-masked in all AMD64-profiles. This doesn’t mean we don’t support the extensions themselves, instead, we hard-enable them.

So we just ignored the following use flags:

  • mmx
  • mmx2
  • sse
  • sse2
  • 3dnow
  • 3dnowext

Further we defined the following use flags in make.conf:

Snippet from /etc/make.conf
USE = "a52 aac acpi alsa apache2"
USE = "${USE} bash-completion bcmath bluetooth -branding"
USE = "${USE} cdda cddb cdparanoia cdr cgi cracklib crypt cscope css cups"
USE = "${USE} dbus dri dv dvd dvdr"
USE = "${USE} encode"
USE = "${USE} fbcon ffmpeg firefox flac"
USE = "${USE} gd gif gnome gnome-keyring gnuplot gstreamer gtk gzip"
USE = "${USE} imagemagick"
USE = "${USE} jpeg"
USE = "${USE} -kde"
USE = "${USE} lame lapack latex libgda libnotify"
USE = "${USE} mad mozilla mp3 mp4 mpeg mplayer mysql"
USE = "${USE} -networkmanager nsplugin"
USE = "${USE} ogg opengl"
USE = "${USE} pdf php png ppds python"
USE = "${USE} -qt4 quicktime"
USE = "${USE} rdesktop readline recode rss ruby"
USE = "${USE} samba simplexml smartcard smp soap spell subversion svg symlink syslog"
USE = "${USE} tcl threads tidy tiff tk tokenizer truetype"
USE = "${USE} unicode usb"
USE = "${USE} v4l v4l2 vcd vhosts vim-syntax vnc"
USE = "${USE} wifi win32codecs"
USE = "${USE} X xcomposite xml xv xvid"
USE = "${USE} zsh-completion"

C Flags

Fortunately, the Gentoo people made their thoughts about Safe CFlags.

Following their advice, I use the following cflags for my 64 bit profile (amd64) and >= GCC 4.3:

Snippet from /etc/make.conf
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -mtune=generic -O2 -pipe"
CXXFLAGS="${CFLAGS}"

Kernel Configuration

We are using latest sys-kernel/tuxonice-sources which is the latest kernel 2.6.34 patched with tuxonice stuff to enable enhaced suspend. We started from scratch and we’ve chosen kernel options from which we thought that they were required. Further we partly follow the configuration which was linked by numerical analysis team on their website.

Specific things which might be useful:

  • For USB 3.0 support:
    Device Drivers
        [*] USB support
            [*]  xHCI HCD
  • For smart card reader to work properly:
    Device Drivers
        [M] MMC/SD/SDIO card support
            [M]   Secure Digital Host Controller Interface support
  • For integrated webcam, enable options for uvcvideo.
  • The correct kernel module for Intel Corporatio 82577LM Gigabit Network Connection (e1000e) and for Intel Corporation WiFi Link 6000 Series (iwlagn):
    Device Drivers
        [*] Network device support
            [*] Ethernet (1000 Mbit)
                [M] Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support
            [*]  Wireless LAN
                [M] Intel Wireless Wifi
                [M] Intel Wireless WiFi Next Gen AGN (iwlagn)
  • According processor type and features:
    Processor type and features
        [*] ScaleMP vSMP
        (8) Maximum number of CPUs
        [*] SMT (Hyperthreading) scheduler support
        [*] Multi-core scheduler support
        Processor family (Core 2/newer Xeon)
  • Thinkpad specific drivers:
    Device Drivers
        [*] X86 Platform Specific Device Drivers
            [*] ThinkPad ACPI Laptop Extras
                [*] Allow control of important LEDs (unsafe)
                [*] Video output control support
                [*] Support NVRAM polling for hot keys

Our latest running kernel configuration can be found here.

X Server

Further followed Gentoo X Server Configuration Howto to setup the X server, framebuffer and the nouveau driver. This guide is using hal which “makes” the x server working out-of-the-box without any configuration file.

First try results in:

ws1 ~ # startx
(EE) AIGLX error: dlopen of /usr/lib64/dri/nouveau_dri.so failed (/usr/lib64/dri/nouveau_dri.so: cannot open shared object file: No such file or directory)
(EE) AIGLX: reverting to software rendering

Following this, nouveau_dri.so is in development and not supported. In order to get rid of that warning, we have to disable AIGLX in the xorg configuration.

Second try started my login manager but without mouse and keyboard. I double checked whether synaptics and evdev is configured properly:

ws1 ~ # cat /etc/make.conf | grep INPUT
INPUT_DEVICES="evdev synaptics"
ws1 ~ # eix evdev -o synaptics
[I] x11-drivers/xf86-input-evdev
     Available versions:  2.3.2 2.4.0 ~2.5.0 {debug}
     Installed versions:  2.4.0(22:44:07 10/05/10)(-debug)
     Homepage:            http://xorg.freedesktop.org/
     Description:         Generic Linux input driver

[I] x11-drivers/xf86-input-synaptics
     Available versions:  1.2.1 ~1.2.2-r2 ~1.3.0 {debug hal}
     Installed versions:  1.2.1(22:44:20 10/05/10)(-debug -hal)
     Homepage:            http://cgit.freedesktop.org/xorg/driver/xf86-input-synaptics/
     Description:         Driver for Synaptics touchpads

Found 2 matches.

While looking for some troubleshooting docs, we found the Gentoo Xorg 1.8 Upgrade Guide which stated that since Xorg 1.8 hal is deprecated and replaced by udev. So to not troubleshooting the deprecated hal, we decided to upgrade to current unstable xorg server. We emerged =x11-base/xorg-server-1.9.0-r2 with the newly introduced udev USE flag and all peripherals worked!

Nvidia & Compiz

We want to use compiz-fusion and we tried the unstable nouveau 3D acceleration following the Gentoo Wiki. Starting x server worked properly, but when we started compiz-manager to initialize the compiz stuff, things went wrong and we did not get compiz running. This is why we use the proprietary x11-drivers/nvidia-drivers which results in additional problems:

  • Dots per inch (dpi) value could not be determined correctly which ends up in huge font-sizes
    It seems that the nvidia-driver calculates the dpi in a different way than the nouveau driver does. Anyways, we adjusted the font sizes in gnome to fix that.
  • Following Gentoo Nvidia Guide, the in kernel drivers conflicts with the proprietary driver – in fact when we installed x11-drivers/nvidia-drivers, the framebuffer support was gone.
    Fortunately, uvesafb is a generic driver and does not program the nvidia card at all (in contrast to the nouveau driver which supports acceleration and stuff). Because uvesafb doesn’t do that we can use both, nvidia proprietary driver for X and uvesafb driver for frambuffer. We followed the uvesafb guide in order to setup uvesafb. Further we used /sys/bus/platform/drivers/uvesafb/uvesafb.0/vbe_modes in order to get supported modes and modified the grub kernel parameter accordingly:

    [2:24] 0 root /root $ cat /etc/default/grub | grep -C2 uvesafb
    # This line imports any entries to the end of the 'linux' line.
    # The entries are appended to the end of the normal mode only.
    GRUB_CMDLINE_LINUX_DEFAULT="video=uvesafb:1280x800-32,mtrr:3,ywrap"
  • After starting compiz fusion using compiz-manager we see a white screen.
    In order to fix that, we set the nvidia option AddARGBGLXVisuals to true:

    [2:25] 0 root / $ cat /etc/X11/xorg.conf.d/04-nvidia.conf
    Section "Device"
        Identifier  "Device0"
        Driver  "nvidia"
        VendorName  "NVIDIA Corporation"
        BoardName   "Nvidia Quadro FX880M"
        Option  "AddARGBGLXVisuals" "true"
    EndSection

    Section "Extensions"
        Option  "Composite" "enable"
    EndSection
  1. What’s the point of having only one NUMA node?

  2. 720QM was the cheapest mobile processor having a real quad core. The i7-6xx cores have only two cores but are using hyper-threading so that the vendors can call it “quad core”. It was at least no technical decision to get a real quad core. I mean, maybe a i7-6xx with an higher frequency would have been more advantageous ;-)

  3. NVRAM is not needed, amongst other things, look at the description, you’ll see …

  4. Achim Flammenkamp Says:
    January 14, 2014 at 2:39 pm

    Hi

    Hast Du dein Thinkpad W510 noch und nutzt es?

    Ich habe seit 1 Monat ein Lenovo ThinkPad W510 4389W1B und Gentoo darauf installiert.

    GruB
    Achim

    PS: Falls Du zurückmails bitte raw-text verwenden.

Leave a Reply

You must be logged in to post a comment.