x86-64 Arch Linux on ThinkPad x201i - 行者无疆 始于足下 - 行走,思考,在路上
x86-64 Arch Linux on ThinkPad x201i
前两天自用的Arch Linux系统出了点小问题,索性重新搞了一下,由i686迁移到x86-64平台。原先一直以为64位系统是高不可攀的贵族产品,后来才知道原来64位处理器最早是由AMD 1999年设计,几年前的Intel Core Duo早已经支持64位系统,只是软件产品和内存还跟不上,所以多数应用还是32位为主。
OS版本用的是Arch Linux 2010.05,在mirrors.sohu.com上下载支持 32 位及 64 位架构的 Dual 映像,用UltraISO刻录硬盘镜像到U盘上。基本的安装过程不再赘述,ArchWiki Beginner's Guide讲的明明白白。唯一注意的是分区格式化的时候需要格外注意,不要把自己原先的系统搞丢——我曾经有过惨痛的教训,不过幸好那次做了数据备份。不过100G的东西备份还原也是件耗时耗力的工作啊^)^。
基本系统装好后,装个Desktop Environment,然后再做一下系统美化和针对小黑的特殊配置。过程还是挺繁琐的,因此写下来做个备忘。先上张图,KDE4.6——我承认我越来越浮云了……
最新的Xorg已经变得十分人性化,再也不需要手工配置恼人的xorg.conf,最新的Linux内核驱动也能自动识别鼠标和键盘,不会再出现进入图形界面却无法使用鼠标键盘的窘境——至少两年前是这样的。有个东西叫做HAL,最近又出来个evdev。总体而言Linux的驱动程序还是比较混乱的,hal、evdev、mesa、xorg、xf86、wayland、alsa、oss、pulseaudio等等,令人头大。
字体用的是AUR里面打过ubuntu补丁的cairo-ubuntu、libxft-cairo、freetyp2-ubuntu以及WenQuanYi Micro Hei,加上次像素优化,效果还是不错,上图就是最好的说明。
网络客户端抛弃了废柴的KDE的networkmanager,采用了wicd,可以根据地点自动链接不同的无线网,而且非常稳定,从不崩溃。安装过程可以参考ArchWiki Wicd。关于蓝牙的配置,我用的是bluez和bluedevel,具体可以参考这里。
剩下的都是小黑的特别配置。这方面的Wiki配置零零总总,并没有统一的解决方案。ThinkWiki是一个很好的去处,基本可以找到ThinkPad各个型号再主流Linux发行版上的安装配置。不过由此也看出开源软件的弊端——顶级的ThinkPad支持尚且如此繁琐,可见Linux真正要普及还有很长的路要走。废话少说,还是回到x201i上的设置吧。ThinkPad的设置主要有以下几处:
- 电池电源控制
- trackpoint小红点
- Active Protection System,硬盘保护系统
- 风扇控制
电池的电源控制主要是用来延长电池寿命的。电池的充电次数是有限的,因此减少电池的冲放电次数是演唱电池寿命的关键。tp_smapi是针对ThinkPad的一组内核模块,可以通过AUR(yaourt -S tp_smapi)安装。对电源的保护主要是设置电源的冲放电阀值。比如我们设置[start_charge=40, end_charge=90],意思就是当电池的电量低于40%的时候才开始充电,而一旦电量到达90%的时候就停止充电。举例说明,当我们野外需要频繁的野外工作时,如果不设置电池的充放电阀值[start_charge, end_charge],那么我们的电量可能是这样的:95(battery, discharge)-->80(AC power, charge)-->100(battery, discharge)-->70(AC power, charge)-->93(battery, discharge)-->70,而设置[start_charge=40, end_charge=90]后我们的电量变化就是这样的:95(battery, discharge)-->80(AC power, but not charge)-->80(battery, discharge)-->50(AC power, but still not charge since 50 >= 40)-->50(battery, discharge)-->27(If AC power now, charge, since 27 >= 40, charge until battery = 90)。看明白了吗?估计没有。反正我也有点晕。ArchWiki上提供了一个封装的脚本set_bat_thresh:
#!/bin/bash # # Bash script for setting the battery thresholds on ThinkPads using the tp_smapi interface. # Written by Ignas Anikevicius (20/03/2010) #HELP TEXT if [ "x$1" == "x--help" -o "x$1" == "x-h" ] then echo -e " WARNING!!! This script needs to be run as root in order to have effect!!! Possible options are: set_bat_thresh [BAT_N] [[LOWER] [UPPER]][--reset][-r] [BAT_N] number of the battery (can be either 0 or 1). LOWER - lower threshold. UPPER - upper threshold . [--reset] or [-r] sets the default thresholds. execute to see this text: set_bat_thresh [--help][-h] " exit 0 fi if [ ! -d /sys/devices/platform/smapi ]; then echo -e "\nSMAPI interface is NOT installed.\nPlease load the module.\n" exit 0; fi #SETTING THRESHOLD VALUES if [ "x$2" == "x--reset" -o "x$2" == "x-r" ] then LOWER=96 UPPER=100 else LOWER=$2 UPPER=$3 fi #VALUE TESTING if [ ${LOWER} -ge ${UPPER} ]; then echo -e "\n Please provide proper thresholds!!! \n" exit 0 fi #BATTERY NUMBER BAT_N=$1 LOWER_F="/sys/devices/platform/smapi/BAT${BAT_N}/start_charge_thresh" UPPER_F="/sys/devices/platform/smapi/BAT${BAT_N}/stop_charge_thresh" #SETTING THE THRESHOLDS echo ${LOWER} > ${LOWER_F} echo ${UPPER} > ${UPPER_F} #ECHOING THE STUFF echo -e "\nSetting battery thresholds for Battery ${BAT_N}: Threshold for charging to start: ${LOWER} Threshold for charging to stop: ${UPPER} " exit 0;
执行用:
set_bat_thresh 0 start_charge end_charge
至于trackpoint小红点,AUR里面有一个trackpoint脚本,用yaourt -S trackpoint安装,安装完毕将trackpoint加到/etc/rc.conf的DAEMONS里面。/etc/conf.d/trackpoint里面可以更改一些设置如:
- SPEED: 小红点光标移动速度。
- SENSITIVITY: 小红点敏感度。
- PRESS_TO_SELECT: 小红点单击功能。
中键模拟用如下的脚本设置下(我也忘了是从哪里找到的了):
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1 xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
硬盘保护(Active Protection System)用的是AUR里面的HDAPS,参看ArchWiki,Applet用的是thinkhdaps,根据需要改下/etc/conf.d/hdapsd里面的设置,效果还不错,抱着笔记本在床上看电影的时候视频会一卡一卡的。
风扇控制貌似不太不要,而且设置不好会影响散热效果,降低笔记本的寿命。这个功能主要目的貌似是使笔记本更安静些。用的软件包是AUR里面的tpfand和tpfan-admin,tpfand.conf是copy来的,参考这里。用了之后好像也没啥特别的效果。
最后show下/etc/rc.conf里面的设置,日后重装的时候也好有个参考:
# # /etc/rc.conf - Main Configuration for Arch Linux # # ----------------------------------------------------------------------- # LOCALIZATION # ----------------------------------------------------------------------- # # LOCALE: available languages can be listed with the 'locale -a' command # HARDWARECLOCK: set to "UTC" or "localtime", any other value will result # in the hardware clock being left untouched (useful for virtualization) # TIMEZONE: timezones are found in /usr/share/zoneinfo # KEYMAP: keymaps are found in /usr/share/kbd/keymaps # CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US) # CONSOLEMAP: found in /usr/share/kbd/consoletrans # USECOLOR: use ANSI color sequences in startup messages # LOCALE="en_US.UTF-8" HARDWARECLOCK="localtime" TIMEZONE="Asia/Shanghai" KEYMAP="us" CONSOLEFONT= CONSOLEMAP= USECOLOR="yes" # ----------------------------------------------------------------------- # HARDWARE # ----------------------------------------------------------------------- # # MOD_AUTOLOAD: Allow autoloading of modules at boot and when needed # MOD_BLACKLIST: Prevent udev from loading these modules # MODULES: Modules to load at boot-up. Prefix with a ! to blacklist. # # NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array. # MOD_AUTOLOAD="yes" #MOD_BLACKLIST=() #deprecated MODULES=(uinput tp_smapi thinkpad_acpi thinkpad_ec vboxdrv) # Scan for LVM volume groups at startup, required if you use LVM USELVM="no" # ----------------------------------------------------------------------- # NETWORKING # ----------------------------------------------------------------------- # # HOSTNAME: Hostname of machine. Should also be put in /etc/hosts # HOSTNAME="lox-pad" # Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces. # # Interfaces to start at boot-up (in this order) # Declare each interface then list in INTERFACES # - prefix an entry in INTERFACES with a ! to disable it # - no hyphens in your interface names - Bash doesn't like it # # DHCP: Set your interface to "dhcp" (eth0="dhcp") # Wireless: See network profiles below # #Static IP example #eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" eth0="dhcp" INTERFACES=(!eth0) # Routes to start at boot-up (in this order) # Declare each route then list in ROUTES # - prefix an entry in ROUTES with a ! to disable it # gateway="default gw 192.168.0.1" ROUTES=(!gateway) # Enable these network profiles at boot-up. These are only useful # if you happen to need multiple network configurations (ie, laptop users) # - set to 'menu' to present a menu during boot-up (dialog package required) # - prefix an entry with a ! to disable it # # Network profiles are found in /etc/network.d # # This now requires the netcfg package # #NETWORKS=(main) # ----------------------------------------------------------------------- # DAEMONS # ----------------------------------------------------------------------- # # Daemons to start at boot-up (in this order) # - prefix a daemon with a ! to disable it # - prefix a daemon with a @ to start it up in the background # DAEMONS=(@syslog-ng @dbus !hal !network !netfs @acpid @tpfand @crond @hdapsd @laptop-mode @wicd @kdm bluetooth @trackpoint)
大概就这么多吧。都是些琐碎的东西,能用就好了。想想Linux的东西变动如此之快,有些东西是真的不必深究的。比如关于中键模拟有上面的方案,也有改xorg.conf的方案。比如hal这个东西,再比如X Window和未来的Wayland,比如ext4和btrfs。想想自己走的也有些偏了,过于追求工具化的东西,倒是忽略了最本质的知识,如体系结构,算法等等。这就比如户外旅行,总是想方设法装一辆拉风的自行车,却很少去骑车领略旅行的真谛。四年,四年前的我还只会开机关机,四年后的我折腾系统小打小闹颇有一套,最本质的计算机基础却一塌糊涂。希望自己的折腾之旅到此位置吧。接下来的关键词是,lisp、tcp/ip,hadoop。
Sun, 30 Jan 2011 22:27:36 +0800
原来你也用 Arch 啊。字体渲染的 ubuntu 补丁感觉没必要了,我用 ubuntu 的字体配置文件替换了 Arch 的感觉不装补丁效果也跟 ubuntu 差不多。在论坛上看到有人说现在的已经不需要 hal 了,没试过。有个未正式发行的安装盘 archlinux-2011.01.03 支持 brtfs。
Sun, 30 Jan 2011 23:32:31 +0800
截图很漂亮。。。。
Mon, 31 Jan 2011 01:18:06 +0800
嗯。已经验证过不需要hal了。一切正常。
至于文件系统的更换我一向持谨慎态度,因为我太害怕文件丢失了。
Mon, 31 Jan 2011 01:18:25 +0800
嘿嘿,哈哈,咳咳。
Mon, 31 Jan 2011 03:59:59 +0800
刚才试了一下没有 hal 不能自动挂载 U 盘(因为这个继续保留 hal)其它正常.我就很冒失,上次安装的时候就因 arch 安装程序的硬盘挂载点有问题(分区的时候有 sd5-sd8 格式化的时候却只认出 sd5-sd7)误把 D 盘给格了。
Mon, 31 Jan 2011 04:18:58 +0800
诡异。我这边可以挂载的。你的桌面环境是?
Mon, 31 Jan 2011 04:22:22 +0800
gnome 2.32.1
Mon, 31 Jan 2011 04:58:11 +0800
桌面着实酷炫
Mon, 31 Jan 2011 23:45:18 +0800
具体原因不懂,网上找的方法 mkinitcpio -g kernel26.img 后就可以了。
Tue, 01 Feb 2011 00:13:54 +0800
man 5 mkinitcpio:
Creates an initial ramdisk environment for booting the linux kernel. The initial ramdisk is in essence a
very small environment (early userspace) which loads various kernel modules and sets up necessary things
before handing over control to init.
估计是重新加载了某些内核模块。太深入的我也不懂了。猜的。
Sun, 04 Mar 2012 12:12:23 +0800
ubuntu补丁还是很有必要的,arch自带的字体渲染补丁很烂的