在Thinkpad X200上安装ArchLinux。

其他Linux/Unix/BSD/OSX等发行版讨论
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

在Thinkpad X200上安装ArchLinux。

#1

帖子 cnkilior » 2010-08-01 22:00

当然,安装ArchLinux以及在thinkpad上配置Linux都能在arch wiki以及thinkwiki中找到,这里主要是讲Archlinux在thinkpad X200上的特别配置。

这里假定,你已经按照ArchWiki安装并配置好了ArchLinux,并且有一个可用的桌面环境,下面将以Gnome桌面环境为例。

1、为Thinkpad准备好内核模块

软件包:tp_smapi (AUR)

需要修改代码,在hdaps.c的

代码: 全选

HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X61", HDAPS_ORIENT_SWAP | HDAPS_ORIENT_INVERT_X),
后面加入

代码: 全选

HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X200", HDAPS_ORIENT_SWAP | HDAPS_ORIENT_INVERT_X | HDAPS_ORIENT_INVERT_Y),
makepkg方式打包成Arch软件包,想要的内核模块都有,如果是手动编译,需要

代码: 全选

HDAPS=true make ......
安装好了之后,要删除内核自带的hdaps模块(drivers/hwmon/hdaps.ko)
并运行depmod -a

2、配置内核模块。

a、打开风扇控制。在/etc/modprobe.d/modprobe.conf 中加入一行:

代码: 全选

options thinkpad_acpi fan_control=1
b、配置正确的音频。在/etc/modprobe.d/modprobe.conf 中加入一行:

代码: 全选

options snd-hda-intel model=lenovo-x200 enable_msi=1
但仍然有一个问题,就是录音虽然能用,但噪音占了60%。希望知道的人告诉我一下。(使用alsa,而不是pulse)
噪音是风扇等的噪音,求实时消噪的录音软件!
c、自动加载的内核模块:tp_smapi、hdaps、acpi-cpufreq

3、传感器,温度监控。

软件包:lm_sensors、sensors-applet (gnome_applet)、hddtemp

将hddtemp加入到daemon中去,让其自动启动,运行一次sensors-detect来发现传感器。将sensors-applet添加到面板,监控温度。

4、风扇控制。

软件包:tpfand(AUR)、tpfan-admin(AUR)(年久失修,估计不能用了)

将tpfand加入到daemon中让其自动启动,如果tpfan-admin不能用可以自己手写一份配置,或者安装:tpfand-profiles(AUR)

另:tpfand的正常运行依赖hal,但现在ArchLinux使用的是Xorg1.8,如果仅仅为tpfand启动hal真是划不来。修改tpfand的代码吧。tpfand只在settings.py中使用了HAL的功能,也仅仅是为了获取一些名字而已,因为tpfand只是自己用,不需要考虑可以移植,完全可以写死这些名字,而不用从HAL中取得。
于是,将settings.py中的:

代码: 全选

    def read_model_info(self):
        """reads model info from HAL"""
        try:
            bus = dbus.SystemBus()            
            computer_obj = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/computer')
            computer = dbus.Interface(computer_obj, 'org.freedesktop.Hal.Device')
            
            product_id = computer.GetProperty('system.hardware.vendor') + "_" + computer.GetProperty('system.hardware.product')
            self.product_id = product_id.lower()
            product_name = computer.GetProperty('system.hardware.vendor') + "_" + computer.GetProperty('system.hardware.version')
            self.product_name = product_name.lower().replace('/', '-').replace(' ', '_')
            
            self.product_pretty_vendor = computer.GetProperty('system.hardware.vendor') 
            self.product_pretty_name = computer.GetProperty('system.hardware.version')
            self.product_pretty_id = computer.GetProperty('system.hardware.product')
        except:
            print "Warning: unable to get your system model from HAL."
            self.product_id = None
            self.product_name = None
            self.product_pretty_vendor = None
            self.product_pretty_name = None
            self.product_pretty_id = None   
改成:

代码: 全选

#        try:
#            bus = dbus.SystemBus()            
#            computer_obj = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/computer')
#            computer = dbus.Interface(computer_obj, 'org.freedesktop.Hal.Device')
            
#            product_id = computer.GetProperty('system.hardware.vendor') + "_" + computer.GetProperty('system.hardware.product')
#            self.product_id = product_id.lower()
#            product_name = computer.GetProperty('system.hardware.vendor') + "_" + computer.GetProperty('system.hardware.version')
#            self.product_name = product_name.lower().replace('/', '-').replace(' ', '_')
            
#            self.product_pretty_vendor = computer.GetProperty('system.hardware.vendor') 
#            self.product_pretty_name = computer.GetProperty('system.hardware.version')
#            self.product_pretty_id = computer.GetProperty('system.hardware.product')
#        except:
#            print "Warning: unable to get your system model from HAL."
        self.product_id = u'LENOVO_74574AC'
        self.product_name = u'LENOVO_ThinkPad X200'
        self.product_pretty_vendor = dbus.String(u'LENOVO')
        self.product_pretty_name = dbus.String(u'ThinkPad X200')
        self.product_pretty_id = dbus.String(u'74574AC')
当然,最后几行代码等号右边的需要填写你自己的。可以通过python,单独运行上面的代码来获得。改好了之后,就可以吧hal从daemon中去掉了。

5、中键模拟

新建文件:/etc/X11/xorg.conf.d/10-wheel-emulation.conf
写入:

代码: 全选

# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
# http://bugs.freedesktop.org/show_bug.cgi?id=22442 
Section "InputClass"
        Identifier "Trackpoint Wheel Emulation"
        MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"
	MatchDevicePath	"/dev/input/event*"
	Option		"EmulateWheel"		"true
	Option		"EmulateWheelButton"	"2"
	Option		"Emulate3Buttons"	"false"
	Option		"XAxisMapping"		"6 7"
	Option		"YAxisMapping"		"4 5"
EndSection
6、硬盘保护。

软件包:hdapsd(AUR)、hdaps-gl(AUR)、thinkhdaps(AUR)

将hdapsd加入到daemon中去,thinkhdaps加入到启动中。

7、笔记本模式。

软件包:laptop-mode-tools
将laptop-mode加入到daemon中,修改/etc/laptop-mode/laptop-mode.conf把ENABLE_AUTO_MODULES的值改成1


8、保护电池

电池的充放次数有限,所以,尽量使其不充电为好,而默认的设置不是个很好的设置。

新建文件:/etc/sysfs.conf,写入下面内容:

代码: 全选

 # Make battery live longer
 devices/platform/smapi/BAT0/start_charge_thresh = 50
 devices/platform/smapi/BAT0/stop_charge_thresh = 90
或另一套方案

代码: 全选

# Make battery live longer
 devices/platform/smapi/BAT0/start_charge_thresh = 10
 devices/platform/smapi/BAT0/stop_charge_thresh = 100
(本人使用的是第一套,也是thinkwiki上写的。中文论坛上有两位据称是IMB工程师的人分别推荐了上面两套,但以第二套用的人多。具体用哪套,自己衡量。)

新建文件:/etc/rc.d/sysfsutils,写入下面内容:

代码: 全选

#! /bin/sh -e

### BEGIN INIT INFO
# Provides:          sysfsconf
# Required-Start:    mountkernfs
# Should-Start:      udev module-init-tools loadcpufreq
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Set sysfs variables from /etc/sysfs.conf
# Description:       Similarly to /etc/init.d/procps.sh, you can configure
#                    values for sysfs variables (such as power management
#                    defaults) and /sys file permissions in /etc/sysfs.conf.
### END INIT INFO

# /etc/init.d/sysfsutils: 
#
# (c) 2005 Martin Pitt <mpitt@debian.org>

CONFFILE=/etc/sysfs.conf


[ -r "$CONFFILE" ] || exit 0

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
    start)
	stat_busy "Setting sysfs variables..."

	sed  's/#.*$//; /^[[:space:]]*$/d; 
              s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/' \
              $CONFFILE | {
	    while read f1 f2 f3; do
                if [ "$f1" = "mode" -a -n "$f2" -a -n "$f3" ]; then
                    if [ -f "/sys/$f2" ]; then
                        chmod "$f3" "/sys/$f2"
                    else
                        stat_fail 
                    fi
                elif [ "$f1" = "owner" -a -n "$f2" -a -n "$f3" ]; then
                    if [ -f "/sys/$f2" ]; then
                        chown "$f3" "/sys/$f2"
                    else
                        stat_fail
                    fi
                elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then
                    if [ -f "/sys/$f1" ]; then
                        # Some fields need a terminating newline, others
                        # need the terminating newline to be absent :-(
                         echo -n "$f2" > "/sys/$f1" 2>/dev/null ||
                            echo "$f2" > "/sys/$f1"
                    else
                        stat_fail
                    fi
                else
                    stat_fail
                    exit 1
                fi
	    done
	}

	stat_done
	;;
    stop)
	;;
    *)
	echo "Usage: /etc/init.d/sysfsutils {start|stop|force-reload|restart}"
	exit 1
	;;
esac
为其添加可执行属性

代码: 全选

chmod +x /etc/rc.d/sysfsutils
添加到deamon中去。
9、我自己使用的各种配置文件。

a、rc.conf

代码: 全选

MODULES=(!snd_pcm_oss !snd_mixer_oss !snd_seq_oss !thinkpad_ec tp_smapi hdaps acpi-cpufreq)
DAEMONS=(syslog-ng dbus acpid hdapsd tpfand networkmanager hddtemp alsa laptop-mode sysfsutils)
b、tpfand.conf

代码: 全选

enabled = True
override_profile = True

0. CPU = 0:0 45:3 60:6
1. Mini PCI = 0:0 50:3
2. Sensor 2 = 0:255
3. GPU = 0:0 50:3
4. Bat0 = 0:0 35:2
5. Sensor 5 = 0:255
6. Bat1 = 0:0 35:2
7. Sensor 7 = 0:255
8. MB? = 0:0 45:2 60:4
9. MB? = 0:0 55:3
10. Sensor 10 = 0:255
11. Sensor 11 = 0:255
12. Sensor 12 = 0:255
13. Sensor 13 = 0:255
14. Sensor 14 = 0:255
15. Sensor 15 = 0:255

hysteresis = 2
interval_speed = 2
interval_duration = 500.000000
interval_delay = 5000.000000
---------
另外,标记为AUR的软件包,尽量用yaourt安装。
由于风扇控制造成的计算机损坏,本人概不负责。
上次由 cnkilior 在 2010-09-07 23:21,总共编辑 2 次。
头像
qiang_liu8183
论坛版主
帖子: 10699
注册时间: 2006-09-10 22:36
系统: Arch Debian
来自: 北京

Re: 在Thinkpad X200上安装ArchLinux。

#2

帖子 qiang_liu8183 » 2010-08-01 22:30

顶技术帖
看破、放下、自在、随缘、念佛
真诚、清净、平等、正觉、慈悲
头像
cpu太雷
帖子: 85
注册时间: 2010-07-25 14:00

Re: 在Thinkpad X200上安装ArchLinux。

#3

帖子 cpu太雷 » 2010-08-02 8:03

一直把本子当台式机用的没有压力~~~
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

Re: 在Thinkpad X200上安装ArchLinux。

#4

帖子 cnkilior » 2010-08-31 21:25

于8.31 21:24第一次更新。
zhaowenwei
帖子: 57
注册时间: 2009-02-03 10:16

Re: 在Thinkpad X200上安装ArchLinux。

#5

帖子 zhaowenwei » 2010-09-02 16:54

楼主上 降温效果图
路过不明真相的群众
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

Re: 在Thinkpad X200上安装ArchLinux。

#6

帖子 cnkilior » 2010-09-02 20:57

不会给图。
头像
steelan
帖子: 309
注册时间: 2009-04-29 3:50

Re: 在Thinkpad X200上安装ArchLinux。

#7

帖子 steelan » 2010-09-06 20:54

mark
头像
anonymity
帖子: 645
注册时间: 2009-03-14 16:31
来自: 不在故乡的地方

Re: 在Thinkpad X200上安装ArchLinux。

#8

帖子 anonymity » 2010-09-07 12:31

建议不要删除hdapsd。而是按照wiki上面的说法,在rc.loacle里面指定
ismod 自己编译的的hdapsd路径/hdapsd.ko
thinkhdaps&

但是有个问题,就是我怎么能知道thinkhdaps已经启动,或者有什么图标之类的能在桌面监控?gnome环境。
Only the dead have seen the end of war!
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

Re: 在Thinkpad X200上安装ArchLinux。

#9

帖子 cnkilior » 2010-09-07 23:20

系统监视器里面看。
一般它会在通知区域有图标的,晃晃电脑可以看到图标的变化。
hengfeng12345
帖子: 8
注册时间: 2007-12-10 20:12

Re: 在Thinkpad X200上安装ArchLinux。

#10

帖子 hengfeng12345 » 2010-11-23 16:35

这个能用在Ubuntu 10.10上面吗?我的风扇一直在3800,声音有点大。。。在windows下的时候,几乎没声音。。。
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

Re: 在Thinkpad X200上安装ArchLinux。

#11

帖子 cnkilior » 2010-11-23 21:34

可以,我以前用的是ubuntu.
头像
hasee.wu
帖子: 2089
注册时间: 2009-10-20 21:13
来自: Pacific Western University

Re: 在Thinkpad X200上安装ArchLinux。

#12

帖子 hasee.wu » 2010-11-23 22:07

qiang_liu8183 写了:顶技术帖
头像
phoenixlzx
帖子: 2245
注册时间: 2009-07-29 20:11
系统: Arch Linux
来自: Gensokyo
联系:

Re: 在Thinkpad X200上安装ArchLinux。

#13

帖子 phoenixlzx » 2010-11-26 7:23

mark
头像
wowoto
帖子: 3050
注册时间: 2009-04-11 12:17
系统: windows7

Re: 在Thinkpad X200上安装ArchLinux。

#14

帖子 wowoto » 2010-12-06 22:13

我想找X201安装arch的技术贴
wowoto>ubuntu8.04>ubuntu9.04>Archlinux>FreeBSD8.0>Archlinux & end here.
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

Re: 在Thinkpad X200上安装ArchLinux。

#15

帖子 cnkilior » 2010-12-06 23:11

楼上捐台x201给我,我再写一篇就可以了。
回复