wiki:debianonthinkpadt40p
Wiki: Debian on Thinkpad T40p
2006/1/12
按照步骤来
hiweed-debian
要想定制一个自己的系统,最好还是选择从最小的开始。而我选择了hiweed的100多M的iso,因 为hiweed当初刚做这个项目的时候,我曾经尝试过他们的作品,感觉不错。最重要的是版本0.7 开始,他们发布了base版本,就是只关注中文字体和输入法。要使用中文的DIY用户,从这 里起步挺好。
在0.7里边hiweed用了更加小巧的icewm作为display manager,而不再是xfce4;其实我更希 望他们用fvwm2,因为在freebsd下边我已经熟悉了这套管理器。而且就我现在的感觉来说, 虽然icewm更加“智能”一些,但感觉并不如fvwm2自由。那个桌面菜单每次需要点击才能进 入,我想修改一下,但也不知道从哪里下手,还有虚拟桌面的选择框我也不知道能否改变位 置 ……
中文相关
输入法: SCIM
locale: LC_ALL=zh_CN.UTF-8
Fonts: arphic(文鼎)
装完系统之后第一件事事,赶紧下载一个less,然后设置PAGER=less,否则读manual的时候 用more很痛苦,在freebsd下边也没觉得more这么难用的说 -_-!!
输入法
要是不想使用hiweed-desktop-base到那一套,可以换个小企鹅输入法fcitx试试,很小巧。 这样,你需要在 =~/.xinitrc= 插入如下内容:
#!/bin/sh
export XMODIFIERS=@im=fcitx
exec fcitx &
exec icewm-session
最后是执行icewm-session,我原来没有看manual,执行icewm,结果没有桌面,而且像gaim、 stardict这样进程也没法最小化到tray中去 :(
环境设置
hiweed默认把所有locale变量都设置成zh_CN.UTF-8了,这样在console下做某些工作的时候 就会看到很多乱码,现在可以这样设置 /etc/environment :
LANGUAGE="zh_CN:zh:en_US:en"
LANG=POSIX
LC_CTYPE=zh_CN.UTF-8
修改gtk字体
编辑文件 /etc/gtk/gtkrc.utf-8,增加simsun字体
style "default-text" {
fontset = "-*-simsun-medium-r-normal--*-120-*-*-*-*-*-0,\
-*-arial-medium-r-normal--*-120-*-*-*-*-iso10646-1,\
-*-helvetica-medium-r-normal--*-120-*-*-*-*-*-*"
}
class "GtkWidget" style "default-text"
安装字体
linux下实际有两套字体系统,一种是传统的核心字体系统,另一种是新的xft字体系统;前 者历史悠久,传统的X程序都使用核心字体系统,包括Emacs,后者支持aa特性。所以当前版 本的Emacs的字体是没法反锯齿的。
X核心字体看起来是这样子的,可以用 xlsfont 列出可用核心字体
-ms-simsun-medium-r-normal--0-0-0-0-p-0-iso10646-1
xft字体看起来是这样子的,可用用 fc-list 列出可用xft字体
SimSun,宋体:style=Regular
在debian下边有专门的一套字体管理工具 defoma (debian font manager),它统一管理XTT、 Freetype和ps字型;而由libxft库来处理的字型也可以由fontconfig统一管理。
传统方法安装simsun字体
手动安装传统核心字体库稍微麻烦些,步骤如下
apt-get install libfreetype6 fontconfig libxft2
似乎没有freebsd下的 ttfm.sh --add xttfm /path/to/font,共需要三个步骤
从Windows下边copy出simsun.ttc和tahoma.ttf,修改后缀ttc为ttf,放置到目录 /usr/share/fonts/truetype 中(改后缀名是因为用pdflatex命令对ttc失败)
在目录 /usr/share/fonts/truetype 中使用
mkfontscale > fonts.scale
mkfontdir > fonts.dir
生成 fonts.dir 和 fonts.scale (另外似乎还有ttmkfdir, ttfmkdir这样的命令,要是找 不到上边的命令,可以先生成一个scale文件,再copy成dir文件,因为不知道为啥它们是一 样的内容 @@)
新版本的mkfontscale和mkfontdir没有如下问题!当你看到生成的scale或者dir中的 simsun字体没有中文编码时,还要在生成的 fonts.dir 中寻找 如下内容(defoma就没有这样的问题)
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ascii-0
...
修改c为p(似乎不用改也行),如下:
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ascii-0
...
然后,在其后添加
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gbk-0
同时注意将文件第一行的数字相应改动,同样在dir中进行这样的修改,或者直接把scale文 件copy成dir文件也行。
编辑文件 /etc/X11/xorg.conf,把路径 /usr/share/fonts/truetype 加入 FontPath 中,形如:
Section "Files"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/share/fonts/truetype"
...
EndSection
在module一节加入freetype支持:
Section "Module"
Load "freetype"
...
EndSection
最后使用命令 xlsfonts,在X下查看可用字体。也只有 xlsfonts 列出的字体emacs才可用。
defoma安装simsun字体
安装defoma字体引擎
apt-get install x-ttcidfont-conf libft-perl defoma dfontmgr
defoma安装字体很简单,而且它有GUI前端 dfontmgr;先copy字体到目录,然后使用命令
defoma-font register-all /etc/defoma/hints/simsun.hints
其中 simsun.hints 格式如下,可以用 defoma-hints 命令按照提示生成:
category truetype
begin /usr/share/fonts/truetype/simsun.ttf
FaceNum = 2
Family = SimSun
FontName = SimSun
Encoding = Unicode
Location = English Chinese-China
Charset = GB2312 GBK ISO8859-1 ISO10646-1
UniCharset = GB2312 GBK ISO8859-1
GeneralFamily = Song
Weight = Light
Width = Variable
Shape = Upright
Foundry = MS
Priority = 25
X-Family = SimSun
X-Weight = medium
X-ElementAlias = foundry=default:family=song:resx=72:resy=72
TTCap = halfwidth-bw=0.5 italic-angle=0.167 no-roblique no-oblique no-ritalic
end
最后在xorg.conf中添加
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
最简单的安装字体方式
而对于xft来说,很简单,直接把字体文件搁在 ~/.fonts 目录下,运行 fc-cache 一下即可。
关于apt
软件信息管理器 aptitude
这个命令可以取代传统的 apt-get 系列命令
定制 apt
apt的配置信息在 /etc/apt 目录下
几个有用的工具
apt-show-versions
localepurge
sysv-rc-conf
常用软件配置
一个装包列表
apt-get install x11-common xserver-xorg x-window-system
apt-get install ttf-bitstream-vera ttf-arphic-uming icewm fvwm vim \
firefox thunderbird lftp emacs-snapshot-unicode w3m gqview mplayer-686 \
xmms mlterm less gaim stardict acroread rdesktop
apt-get install alsa-base alsa-headers alsa-oss alsa-utils alsaplayer \
alsaplayer-alsa alsaplayer-common alsaplayer-gtk alsaplayer-oss
apt-get install module-init-tools initrd-tools procps
apt-get install kernel-package ncurses-dev fakeroot wget bzip2
apt-get install cvs sudo
系统工具
首先选择一个term,传统的xterm和mlterm等等都行
xterm
xterm配置得好用还挺麻烦,这里给出一个不错的 .Xdefaults 设置
XTerm*geometry: 90x40-10+30
XTerm*internalBorder: 10
XTerm*highlightSelection: true
XTerm*background: #BFDF74
XTerm*foreground: #001123
XTerm*colorBDMode: on
XTerm*colorBD: blue
XTerm*colorULMode: on
XTerm*colorUL: magenta
XTerm*eightBitInput: true
XTerm*eightBitOutput: true
XTerm*scrollBar: true
XTerm*saveLines: 2000
XTerm*rightScrollBar: true
XTerm*titeInhibit: true
XTerm*colorMode: on
XTerm*dynamicColors: on
XTerm*underLine: off
XTerm*metaSendsEscape: true
XTerm*cursorColor: lime green
XTerm*locale: true
XTerm*fontMenu*fontdefault*Label: Default
XTerm*font: -misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
XTerm*wideFont: -misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
!! VIM-like colors
XTerm*color0: #000000
!XTerm*color1: #FFFFFF
XTerm*color1: #911B08
XTerm*color2: #00A800
XTerm*color3: #DD0000
XTerm*color4: #0000A8
XTerm*color5: #A800A8
XTerm*color6: #00A8A8
XTerm*color7: #D8D8D8
XTerm*color8: #B5613B
!XTerm*color9: #FFFFFF
XTerm*color9: #966BEB
XTerm*color10: #00A800
XTerm*color11: #FFFF00
XTerm*color12: #0000A8
XTerm*color13: #A800A8
XTerm*color14: #00A8A8
XTerm*color15: #B5613B
mlterm
mlterm既不是来自xterm,也不是来自rxvt,它比较新,因而可以使用aa字体,而不局限在 那些古老的字体引擎,它的配置在 ~/.mlterm 目录下:
aafont
aafont 设置aa字体,针对中文我修改了如下设置
针对非utf-8编码
ISO8859_1=Bitstream Vera Sans Mono-iso10646-1;
GB2312_80=AR PL Shanheisun uni-gb2312.1980-0;
GBK=AR PL Shanheisun uni-gbk-0;
针对utf-8编码
ISO10646_UCS2_1=Bitstream Vera Sans Mono-iso10646-1;
ISO10646_UCS2_1_BIWIDTH=AR PL Shanheisun uni-iso10646-1;
main
这里是界面等设置,做了如下修改
fontsize=18
use_transbg = true
use_anti_alias = true
ENCODING = zh_CN.UTF-8
use_xim=true
open_xim_in_startup=true
localepurge
apt-show-versions
编辑器
emacs
一开始我使用emacs21+mule-gbk,中文显示始终有问题,真是很痛苦(当然原来是我不会配 置:))。于是还是使用emacs23吧,毕竟本来就是支持unicode的,用起来感觉挺“正宗”,呵 呵。换上emacs23之后,所有中文显示问题迎刃而解;简单得出乎意料。
.Xdefaults
设置字体,linux下的传统方法是设置 .Xdefaults 资源文件,设置字体的时候先使用 xlsfonts 看看自己可用的字体,比如
-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso8859-1
有些字体其中如上 100-100-100 这样的字段是 0-0-0,表示是可缩放的xft矢量字体,尽量 不要使用,因为emacs不支持xft字体。
下边是.Xdefaults设置,
Emacs.geometry: 90x48+10+10
Emacs.Font: fontset-song
Emacs.FontsetList: song
Emacs.Fontset-0:-*-bitstream vera sans mono-medium-r-normal--18-*-*-*-*-*-fontset-song,\
chinese-gb2312: -*-simsun-medium-r-normal--16-*-*-*-p-*-gb2312.1980-0,\
chinese-gbk: -*-simsun-medium-r-normal--16-*-*-*-p-*-gbk-0,\
korean-ksc5601:-*-medium-r-normal-*-16-*-ksc5601*-*,\
chinese-cns11643-5:-*-*-medium-r-*--16-*-*-*-*-*-*-0,\
chinese-cns11643-6:-*-*-medium-r-*--16-*-*-*-*-*-*-0,\
chinese-cns11643-7:-*-*-medium-r-*--16-*-*-*-*-*-*-0
最后,使用如下命令,使得.Xdefaults生效
xrdb -load .Xdefaults
.emacs
另外就是在windows下的方法,直接在.emacs文件中指定emacs字体和窗口位置,这种方式通 用;然而窗口会有有一个变化的过程:
;; charset-list
(if (not (member '("-*-bitstream vera sans mono-normal-r-*-*-*-*-*-*-c-*-fontset-chinese"
. "fontset-chinese") fontset-alias-alist))
(progn
(create-fontset-from-fontset-spec
"-*-bitstream vera sans mono-medium-r-normal-*-17-*-*-*-*-*-fontset-chinese,
chinese-gb2312:-*-ar pl shanheisun uni-medium-r-*--*-*-*-*-*-*-gb2312.1980-0,
korean-ksc5601:-*-medium-r-normal-*-*-*-ksc5601*-*,
chinese-cns11643-5:-*-*-medium-r-*--*-*-*-*-*-*-gbk-0,
chinese-cns11643-6:-*-*-medium-r-*--*-*-*-*-*-*-gbk-0,
chinese-cns11643-7:-*-*-medium-r-*--*-*-*-*-*-*-gbk-0,
chinese-big5-1:-*-*-medium-r-*--*-*-*-*-*-*-*-0,
chinese-big5-2:-*-*-medium-r-*--*-*-*-*-*-*-*-0" t)
(setq default-frame-alist
(append
'(
(font . "fontset-chinese")
(top . 0)
(left . 0)
(width . 96)
(height . 46)
(tool-bar-lines . 0))
default-frame-alist))))
字体相关的命令
M-x describe-char
M-x describe-fontset
查看字体是否设置正确
emacs-w3m
emacs-w3m的整个lisp包直接解压用是不行的,因为还有icons,可以先运行 ./configure 生成 Makefile 文件,然后查看其中 ICONDIR 的值,把icons或者icons30目录拷贝到相应 的地方。我是直接借用的我win下w3m.el文件,所以直接做了一个符号链接过来:
ln -s /d/Program/Emacs/etc/images/w3m /usr/share/emacs/snapshot-unicode/etc/images/w3m
我的共享目录
随便统计一下我用于emacs的所有的符号链接,哈哈,可以共享就是爽阿!更赞linux有个ln
ln -s /d/MyDoc/.emacs.d/config ~/.emacs.d/config
ln -s /d/Mydoc/.emacs.d/templates ~/.emacs.d/templates
ln -s /d/MyDoc/.emacs.d/todo ~/.emacs.d/todo
ln -s /d/MyDoc/Wiki ~/Wiki
ln -s /d/MyDoc/work ~/work
ln -s /d/Program/site-lisp/load-path ~/.emacs.d/load-path
ln -s /d/Program/site-lisp/site-lisp/emacs-wiki ~/.emacs.d/site-lisp/emacs-wiki
ln -s /d/Program/site-lisp/site-lisp/tramp ~/.emacs.d/site-lisp/tramp
ln -s /d/Program/site-lisp/site-lisp/w3m ~/.emacs.d/site-lisp/w3m
ln -s /d/Program/Emacs/etc/images/w3m /usr/share/emacs/snapshot-unicode/etc/images/w3m
下边是thunderbird的符号链接,因为win下用了个win的专用插件minimize to tray,所以 没法像Firefox一样共享整个profile了,不过可以共享邮件已经挺不错了
ln -s /d/backup/tb/Mail ~/.thunderbird/default/Mail
ln -s /d/backup/tb/Signatures ~/.thunderbird/default/Signatures
teTeX
1.先装teTeX和cjk
aptitude install tetex-bin tetex-base tetex-extra cjk-latex dvipdfm-cjk-cmap
然后去 王垠的主页 下载gbkfonts的可执行文件(也可以到 何勃亮的主页 下载新版本),下 载那个静态链接文件就可以了,然后
chmod +x gbkfonts && cp gbkfonts /usr/local/bin
2.建立texmf-local 推荐不要直接放在 /usr/share/texmf 下面,这样以后升级不方便。假设你的中文字体如simsun.ttf simkai.ttf 等文件放在 /usr/share/fonts/truetype 下,现在以普通用户配置。
mkdir ~/texmf
cd ~/texmf
gbkfonts /usr/share/fonts/truetype/simsun.ttf song
gbkfonts /usr/share/fonts/truetype/simkai.ttf kai
...
...
其他字体用同样的方法生成。
3.配置文件
mv cid-x.map dvipdfm/config/
mv cjk.map dvips/config/ /*这里可能报错没有dvips/config目录,新建一个就可以了。 */
cp /usr/share/texmf/dvips/config/config.ps dvips/config/
echo \"p +cjk.map\" >> dvips/config/config.ps
mv pdftex.cfg pdftex/config/
mktexlsr
到此位置可以测试一下 test.tex
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{GBK}{song}
这是latex
\end{CJK}
\end{document}
然后 latex test && dvipdfm test 就应该可以生成test.pdf文件了。下边配置updmap,使 得可以运行pdflatex命令直接生成pdf。
4.运行updmap,注意: 一定以非root身份执行
updmap --edit
其实就是编辑 /etc/texmf/web2c/updmap.cfg 文件, 在最后添加cjk.map文件的位置
Map /home/nini/texmf/dvips/config/cjk.map
现在试试 pdflatex test,可以直接生成test.pdf了。
把texmf放到 ~/texmf 这样的好处是每次重装系统后只要安装好了基本tex环境和cjk-latex 包,只要运行mktexlsr就ok了,因为 ~/texmf 目录默认是mktexlsr搜索的路径,不需要设 置很多环境变量 :)
网络工具
firefox
我windows有两个盘,C格式是NTFS,D格式是FAT32。由于FAT32格式公开,linux下可以对它 进行读写操作。所以相当于,我40G硬盘,win系统用了3G,Debian用了5G,剩下30来G,是 共享空间,在linux下我把D盘mount在 /mnt/vfat ,然后在根目录下做了一个符号链 接: /d@ -> /mnt/vfat 。这样很多程序可以共享配置文件和数据,比如firefox和 thunderbird共享profile,thunderbird共享邮件数据,Emacs共享elisp扩展。
在firefox中使用thinkpad的browser keys
需要修改 chrome/browser.jar 文件
cd /usr/lib/firefox/chrome
unzip browser.jar
编辑 content/browser/browser.xul,寻找 <keyset id="mainKeyset">,添加如下内容:
<key id="goBackKb" keycode="VK_F19" command="Browser:Back" />
<key id="goForwardKb" keycode="VK_F20" command="Browser:Forward" />
保存,重新打包 browser.jar
zip -rD0 browser.jar content/browser/
lftp
对于gftp和lftp的中文显示
编辑/usr/bin/gftp,在#!/bin/sh 后添加
export LANG=zh_CN
编辑 /etc/lftp.conf,添加
set ftp:charset "gbk"
set file:charset "UTF-8"
或者把如上的内容写入 ~/.lftp/rc
Tor & Priovxy
tor 是一个用来匿名上网,隐藏自己踪迹的工具,实际上就是通过数量众多的代理服务器来 让你上网,代理服务器有tor来收集,你只需要配置好tor就OK,不用自己手动去找代理。 tor只提供了socks4的服务,要想让firefox通过tor上网,还必须配置privoxy,一个代理, 将http的请求转发到tor的 socks服务。tor的最大用处就是可以自有无碍的访问被金盾封住 的网站了,比如wikipedia
配置tor,编辑 /etc/tor/tor-tsocks.conf
server = 127.0.0.1
server_type = 5
server_port = 9050
配置privoxy,编辑 /etc/privoxy/config, 不要漏了最后的点"."
forward-socks4a / localhost:9050 .
重新启动一下tor,privoxy
$ sudo /etc/init.d/privoxy restart
$ sudo /etc/init.d/tor restart
设置firefox代理
host:localhost
port:8118
测试一下是否工作正常,访问这个网址
多媒体
mplayer
aptitude install mplayer-686 lirc
添加Skin
skin目录在 /usr/share/mplayer/Skin/, 当前用户目录自己手动建一个,如:
cd ~/.mplayer/
mkdir Skin
下个皮肤 http://www2.mplayerhq.hu/MPlayer/Skin/plastic.tar.bz2 解开后放到这里,以后就可选皮肤了。
字体
ln -s /usr/share/fonts/truetype/simsun.ttf ~/.mplayer/subfont.ttf
xmms
我的locale是zh_CN.UTF-8,xmms打开的菜单中文全是乱码,播放列表里边的中文也是。
解决中文菜单乱码:
ln -s /etc/gtk/gtkrc.zh_CN /etc/gtk/gtkrc.zh_CN.utf-8
解决播放列表中文乱码:设置xmms的字体,编辑文件 ~/.xmms/config,
playlist_font=-*-*-*-*-*-*-14-*-*-*-*-*-gbk-*
自启动项目
普通自启动项
/etc/init.d 以及 /etc/rc?.d,可以使用工具 sysv-rc-conf 管理各个启动级别的服务
X自启动
/etc/X11/Xsession.d,输入法和tpb等可以在这里设置
编译内核
内核模块加载有两种方式 (1) build in (2) modules;一些重要的模块,比如文件系统 ext3的支持,一定要选择 build in,否则开机之后无法挂载文件系统。因为模块的加载是 在挂载文件系统之后做的事情。另外一些声音设备支持,最好也build in,因为当作为模块 加载的时候,alsa就出问题了。
编译内核2.6的步骤
在debian下编译内核是很容易的,而且编译内核的效果是显著的,现在我使用 kernel-2.6.15.4,编译完成之后,所有模块只有不到4M,而默认内核2.6.11.1的模块达到 40M。现在关机和开机速度飞快!
获取编译内核的工具
apt-get update
apt-get install module-init-tools initrd-tools procps
apt-get install kernel-package ncurses-dev fakeroot wget bzip2
取得最新的内核源码
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.4.tar.bz2
如果从老的配置文件升级
make oldconfig
然后
make menuconfig
利用debian的工具来编辑升级内核
make-kpkg clean
fakeroot make-kpkg --revision=custom.1.0 kernel_image
安装内核
cd ..
dpkg -i linux-image-2.6.15.4_custom.1.0_i386.deb
创建ramdisk (optional)
cd /boot/
mkinitrd -o /boot/initrd.img-2.6.15.4 2.6.15.4
修改 grub/menu.lst,然后重启, name -a 可以看到当前内核版本
针对Thinkpad T40p
安装
安装的时候若是内存很大,可以选择不使用swap分区,我就一直取消swap分区在使用
需要加载的模块
设置/etc/fstab
把windows下的fat32分区,以可读写的方式mount,这样两个系统之间就可以 共享数据罗
/dev/hda5 /mnt/vfat vfat uid=1000,umask=000,iocharset=utf8 0 2
常用配置命令 dpkg-reconfigure
比如:
dpkg-reconfigure cdrecord
DVD/CD-RW
想使用combo,要在kernel 2.6里边enable CONFIG_BLK_DEV_IDECD,然后编辑 /etc/cdrecord/cdrecord,指定 CDR_DEVICE=/dev/cdroms/cdrom0
WIFI
首先在内核配置中选择上802.11支持,用户软件使用 MadWifi。
Bluetooth
一般来说Bluetooth设备依赖USB bus,所以在编译内核的时候一般要enable如下选项:
CONFIG_BLUEZ_HCIUSB
CONFIG_BLUEZ
CONFIG_BLUEZ_L2CAP
CONFIG_BLUEZ_RFCOMM
CONFIG_BLUEZ_RFCOMM_TTY
CONFIG_BLUEZ_BNEP
CONFIG_BLUEZ_HCIUSB
另外还需要 BlueZ 维护user-space的蓝芽协议栈,在debian下需要如下dpkg: bluez-utils, bluez-sdl, bluez-pan, bluez-hcidump
Infrared/IrDA
编译内核的时候,需要enable如下选项:
CONFIG_NSC_FIR
CONFIG_ISA
安装如下dpkg: irda-common 和 irda-tools,设备形如 /dev/ttyS?
如果不能正常工作,加入 nsc-ircc 到 /etc/modules;加入
options nsc-ircc nsc-ircc irq=3 dma=3
到 /etc/modutils/99local。
S-video Socket
need the atitvout package compiled from source to flip between TV out (as root: ‘./atitvout -f t’) and regular LCD out (as root: ‘./atitvout -f l’).
Hotkey
Hotkey的功能主要由tpb, ibm-acpi, thinkpad-acpi 和xmodmap一起完成的,每个键位所需 要的软件支持可以在ThinkWiki上查到。其中tpb基本涵盖了xmodmap的功能,而ibm-acpi基 本涵盖了thinkpad-acpi的功能,所以一般只要装前两个就可以了。
tpb
先安装tpb,需要编译内核,加入 NVRAM 支持,安装tpb
aptitude install tpb
把自己加入用户组 nvram,或者直接修改 /dev/nvram 的存取属性
addgroup <user> nvram
或者直接修改 /etc/group 文件,在nvram那行最后加上你的用户名。这点很重要,因为 /dev/nvram 的默认属性是 660,属于nvram组,你不加入nvram组,将无法访问该设备。
startx, you will find when you press the brightness and volume buttons you will be in for a surprise.
ibm-acpi
ibm-acpi 是专门为Thinkpad写的linux ACPI事件接口,它可以把Fn按键跟ACPI框架结合起 来。不过需要注意的是,ibm-acpi需要和acpid配合使用,关于acpid在下边介绍 deb包可以在这里找到,在 sources.list 里加入如下内容:
deb http://debian.isg.ee.ethz.ch/public sarge ibm-acpi madwifi
ibm-acpi的配置文件在 /etc/acpi/,包括各种事件的脚本
ibm-acpi会产生 /proc/acpi/ibm/,所有的动作就是和这里的进程通信的。比如你打开thinklight,则 cat /proc/acpi/ibm/light,会打印如下结果:
# cat light
status: off
commands: on, off
deb的包比较老了,现在还是0.8.2,安装之后没找到sleep(Suspend to RAM)的脚本,这里 提供一个:
#!/bin/sh
# http://www.lugbari.org/bin/view/Main/LinuxOnTpX40
chvt 1
sleep 1
modprobe -r ehci_hcd
echo "mem" > /sys/power/state
hwclock --hctosys
modprobe ehci_hcd
chvt 7
acpid
acpid 是一个捕捉ACPI事件的daemon,在编译内核时打开ACPI支持,然后通过apt-get安装即 可,要想完成待机功能需要用到它。
ALSA Sound & DMixer
在编译内核的时候需要选择上 intel8x0 声卡,当你发觉没有声音的时候,很可能是DMixer 静音着 :)
aptitude install alsa-base alsa-headers alsa-oss alsa-utils alsaplayer alsaplayer-alsa alsaplayer-common alsaplayer-gtk alsaplayer-oss
让DMixer工作,可能还需要 ~/.asoundrc
FireGL
ATI 的显卡有专门的驱动,可以搜索 fglrx,然后安装
DVD (mplayer)
首先在 /etc/modules 里边加入 ide-cd,在 ~/.mplayer/config 中指定DVD设备
dvd-device = /dev/cdroms/cdrom0
ACPI & Power
查看电池信息
watch -n1 cat /proc/acpi/battery/BAT0/state
问题
配置文件列表
~/.asoundrc
# ~/.asoundrc:
pcm.!default {
type plug
slave.pcm "dmixer"
}
pcm.dsp0 {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 8192
#periods 128
rate 48000
}
bindings {
0 0
1 1
}
}
ctl.mixer0 {
type hw
card 0
}
~/.mplayer/config
# Write your default config options here!
skin=default
#fs=yes
#vm=yes
#bpp=24
zoom=yes
ontop=yes
font=/usr/share/fonts/truetype/simsun.ttf
subcp=cp936
subfont-autoscale=1
subfont-text-scale=6
/etc/apt/*
/etc/apt/apt.conf
APT::Default-Release "testing";
/etc/apt/preference
Package: *
Pin: release a=testing
Pin-Priority: 600
Package: *xorg* xlib* libfs* libx11* libxau* libxdmcp* libxxf86vm* x-window-system-core xlibmesa-dri* xlibmesa-gl* xlibmesa-glu* xorg-common xserver-common xserver-xorg xutils* libxcomposite* libxdamage* libxfixes* libxkbfile*
Pin release o=Ubuntu,a=hoary
Pin-Priority: 100
Package: *
Pin: release a=unstable
Pin-Priority: 50
/etc/apt/sources.list
普通用户用unstable(sid)是挺合适的啦:比如我曾经想切换到用testing的,结果装Fx 1.5 的时候,居然没有,而Fx1.5出来至少2多个月了。于是现在使用testing和unstable的混合 系统。
ustc给出的sources.list
我自己的sources.list
# 2005-12-23
deb http://debian.ustc.edu.cn/debian unstable main non-free contrib
#deb-src ftp://debian.ustc.edu.cn/debian unstable main non-free contrib
#deb ftp://debian.ustc.edu.cn/debian-non-US unstable/non-US main non-free contrib
#deb-src ftp://debian.ustc.edu.cn/debian-non-US unstable/non-US main non-free contrib
deb ftp://debian.ustc.edu.cn/debian-uo sid marillat rareware misc ustc firefly
#deb-src ftp://debian.ustc.edu.cn/debian-uo sid marillat rareware misc ustc firefly
### ustc etch
deb ftp://debian.ustc.edu.cn/debian testing main non-free contrib
#deb-src ftp://debian.ustc.edu.cn/debian testing main non-free contrib
deb ftp://debian.ustc.edu.cn/debian-security testing/updates main
### Tsinghua mirror
deb ftp://ftp.tsinghua.edu.cn/mirror/debian/debian sid contrib non-free
#deb http://archive.ubuntu.org.cn/ubuntu/ hoary universe
#deb http://archive.ubuntu.org.cn/ubuntu/ hoary-security main restricted
### sarge: ibm-acpi, madwifi
deb http://debian.isg.ee.ethz.ch/public sarge ibm-acpi madwifi
/etc/cdrecord/cdrecord
# This file is /etc/default/cdrecord
# It contains defaults that are used if no command line option
# or environment is present.
#
# The default device, if not specified elswhere
#
CDR_DEVICE=/dev/cdroms/cdrom0
# The default speed, if not specified elswhere
#
# Note that newer cdrecord versions do not default
# to speed=1. For MMC compliant drives, the default
# is to write at maximum speed, so it in general does
# not make sense to set up a default speed in /etc/default/cdrecord
#
#CDR_SPEED=40
# The default FIFO size if, not specified elswhere
#
CDR_FIFOSIZE=4m
# The following definitions allow abstract device names.
# They are used if the device name does not contain the
# the characters ',', ':', '/' and '@'
#
# Unless you have a good reason, use speed == -1 and let
# cdrecord use it's intercal drive specific defaults.
#
# drive name device speed fifosize driveropts
#
teac= 1,3,0 -1 -1 ""
panasonic= 1,4,0 -1 -1 ""
plextor= 1,4,0 -1 -1 ""
sanyo= 1,4,0 -1 -1 burnfree
yamaha= 1,5,0 -1 -1 ""
cdrom= 0,6,0 2 1m ""
/etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda3 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 /mnt/vfat vfat uid=1000,umask=000,iocharset=utf8 0 2
/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
/etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a "#", and everything on the line after them are ignored.
psmouse
nvram
ide-cd
ide-disk
ide-generic
speedstep-centrino
freq_table
cpufreq_ondemand
ibm_acpi
/etc/tpbrc
THINKPAD xterm -T ntpctl -e ntpctl
OSD ON
OSDFONT 10x20
OSDCOLOR Green
OSDSHADOW 1
OSDVERTICAL 60
OSDPOS BOTTOM
OSDALIGN CENTER
/etc/X11/xorg.conf
fglrx-driver 可能和xorg-6.8.0 之间有些不协调,使用mplayer播放视频的全屏时xorg消耗 cpu资源100%,而再ubuntu下边是经过修改的xorg-fglrx-driver 包没有问题。后来我升级到 xorg-6.9,卸载掉了fglrx-driver,mplayer全屏正常了。
Section "Files"
# FontPath "unix/:7100" # local font server
# if the local font server has problems, we can fall back on these
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
# paths to defoma fonts
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
FontPath "/usr/share/fonts/truetype"
FontPath "/usr/share/fonts/truetype/ttf-bitstream-vera"
FontPath "/usr/share/fonts/truetype/arphic"
EndSection
Section "Module"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
# Option "XkbModel" "pc104"
Option "XkbModel" "ibm/thinkpad"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/psaux"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "ZAxisMapping" "4 5"
EndSection
Section "Device"
Identifier "ATI Technologies, Inc. Radeon R250 Lf [Radeon Mobility 9000 M9]"
Driver "ati"
BusID "PCI:1:0:0"
Option "SWcursor" "false"
Option "NoAccel" "false"
Option "Dac6Bit" "false"
Option "VideoKey" "0x1E"
Option "UseFBDev" "false"
Option "AGPMode" "4"
Option "AGPFastWrite" "false" # crash if on :(
Option "BusType" "AGP"
Option "DDCMode" "false"
Option "DisplayPriority" "AUTO"
Option "NoMergedXinerama" "false"
Option "EnablePageFlip" "true"
Option "RenderAccel" "true"
Option "SubPixelOrder" "RGB"
Option "DynamicClocks" "true"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
Option "DPMS"
HorizSync 30-67
VertRefresh 50-75
EndSection
Section "Screen"
Identifier "Default Screen"
Device "ATI Technologies, Inc. Radeon R250 Lf [Radeon Mobility 9000 M9]"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 1
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 4
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 8
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 15
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 16
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "DRI"
Mode 0666
EndSection
一些有用的资料