Le's profileSomething like a home pa...PhotosBlogListsMore Tools Help

Blog


    August 27

    yahoo第一天

    早上步行到红磡码头,坐船到北角,在从北角坐地铁到铜锣湾。花了一个小时的时间。
    然后hr的人给我还有另外一个从美国yahoo回来的人介绍公司的待遇。
    然后我得到一个笔记本,compaq nc6230,大概是这个型号
    不算很新,不过比我的笔记本还是强多了,很多小软件嗖嗖的就emerge好了,我想apt-get install也不过如此。
    可惜显卡只是ati r300,ati等级最高的有开源驱动的显卡
    哎,如果是X3100就好了
    yahoo内部网叫后院
    team member叫monkey
    我今天一天就在搞new monkey check list,没搞完,因为搭建工作环境需要Linux系统。可是笔记本只有一个windows。
    我用Guy给我的knoppix U盘启动,用qtparted重新调整了分区大小(这是我第一次用parted调整分区大小)。然后装了gentoo。中间我用ssh登录了我的龙芯盒子,作为跳板,登录了我的笔记本(笔记本没带去公司),拷贝了内核的.config等配置文件。所以整个过程进行的很快,等到下班的时候我就让它emerge gnome去了,但愿明早能搞定。
    team里有2个美国人,2个香港人。两个香港人中,一个是去年才拿到永居,老家在梅县,另外一个今天没来上班,他的机器上贴着文革时的宣传画,挺有个性的。所以我们的通用语只能是英语了。-_-"
    晚上回来发现北角地铁站A1出口就在渣华路上的,也就是Java路。想起来一路的地名都挺有意思的。
    铜锣湾->天后->炮台山->北角(Java Road)->红磡
    其实我今天还没完全搞清楚我将会做什么,很多东西要catch up……
    今天犯了个低级错误,没有听出来chroot,['tʃru:t],我之前就一直念它的完整形式change root……
    我们还有个yroot,和chroot类似,但是不同。头说,如果搞不定yroot,那么这个程序员就一无是处了。看起来很重要,不过应该不难。有搞定过的人在,我还怕什么。
    流水帐结束,谢谢浏览。

    PS:公司里有零食任吃,饮品任饮。我们team还有拉力器,还有练俯卧撑的,练前臂肌肉的器具……

    装了个gitweb

    http://www.gentoo-cn.org/gitweb/

    上面Owner一列的值是从/etc/passwd文件里repo所有者的comment字段取得的
    August 25

    使用GDB/Emacs调试C++程序

    使用GDB/Emacs调试C++程序

    Date: 2006-09-26
    Version: 1.0
    Authors: 张乐

    gdb使用技巧

    注意事项

    1. gdb使用 Readline
    1. 可以使用bash快捷键,tab补齐
    2. 清除inputrc里有冲突的设置

    准备工作

    1. 重新编译安装程序。系统里现有的程序一般不适合直接拿来跟踪。需要使用合理的CFLAGS重新编译安装后再跟踪。
    ./configure
    find -name "Makefile" | xargs sed -i -e 's/^CFLAGS = /CFLAGS = -g3 -ggdb3 -gdwarf-2 /'
    make && make install

    运行

    1. 启动gdb
    a. gdb bayonne
    b. gdb --args bayonne -vvv script.scr
    1. 利用帮助
    a. help 命令类别名
    b. help 命令名
    1. 运行程序
    a. r[un]
    b. r[un] -vvv script.scr

    设置断点

    1. 按照函数名设置断点
    b[reak] main
    b[reak] 'namespace::Class::func()'
    1. 按照文件名和行数设置断点
    b[reak] methods.cpp:523

    检查状态

    1. 检查堆栈
    b[ack]t[race]
    up
    down
    1. 检查当前函数的源代码
    list
    1. 检查/改变变量值
    p[rint] var
    p[rint] ptr->mem
    p[rint] *ptr
    p[rint] ('namespace::Class') *this
    p[rint] (('namespace::Class') *this)->a.b.c

    p[rint] var=value
    1. 检查类
    ptype ptr

    set print object on
    whatis ptr
    1. 检查并启用/禁用断点
    set breakpoint pending on
    info b[reakpoints]
    enable [N]
    disable [N]
    1. 检查并切换线程
    info th[reads]
    thread N
    1. 检查寄存器
    info reg
    info reg esp
    1. 检查内存
    x/10s *0xaabbccdd
    x/5x var

    继续运行

    1. 运行到某一行即停止,当前函数返回时也停止
    advance source.cpp:123
    1. 运行到当前函数返回为止
    fin[ish]
    1. 继续运行直到程序结束或下一个断点
    c[ontinue]

    信号

    1. 检查当前的信号处理策略
    info signals
    1. 改变信号处理策略
    handle SIGINT pass
    handle SIGINT nostop

    与Emacs配合使用

    1. 建议使用Emacs-23
    2. 配置字体
    • 指定xft为FontBackend,在~/.Xdefaults中加入
    Emacs.FontBackend: xft
    • 命令参数
    emacs --enable-font-backend -fn "Dejavu Sans Mono-12"
    1. 修改~/.emacs,把下面这一行加入
    (defvar gdb-many-windows t)
    1. 在Emacs里启动gdb
    M-x gdb
    1. 开启多窗口模式
    M-x gdb-many-windows
    1. 进入gud-tooltip-mode
    M-x gud-tooltip-mode
    August 23

    interactive kernel map

    heard from zh-kernel.org's mailing list:
    http://www.linuxdriver.co.il/kernel_map
    August 22

    base64编解码——the command line way

    编码:
    openssl enc -e -base46

    解码:
    openssl enc -d -base64

    Current TODO list - 20070822

    1. finish GWN 20070730
    2. assigned translation task GWN 20070806 20070813
    3. finish my doc dev quiz http://www.gentoo.org/proj/en/gdp/doc/doc-quiz.xml
    4. translate kernel Documentation/CodingStyle
    5. add tentative deadline to progress.xml
    August 21

    TeX - longtable的应用

    如果你有一个表格跨好几页,使用longtable包是一个不错的选择
    主要就是定义一下表格头和尾(firsthead and lastfoot),以及中间每一页的头和尾
    生成pdf时,执行两次latex和一次dvipdfmx

          \hline
            \multicolumn{1}{|c|}{\textbf{id}} &
            \multicolumn{1}{c|}{\textbf{姓名}} &
            \multicolumn{1}{c|}{\textbf{联络电话}} &
            \multicolumn{1}{c|}{\textbf{e-mail}} &
        \multicolumn{1}{c|}{\textbf{IM}\footnotemark[1]} &
            \multicolumn{1}{c|}{\textbf{地区}} \\ \hline
          \endfirsthead

          \multicolumn{6}{c}{接上页} \\
          \hline
            \multicolumn{1}{|c|}{\textbf{id}} &
            \multicolumn{1}{c|}{\textbf{姓名}} &
            \multicolumn{1}{c|}{\textbf{联络电话}} &
            \multicolumn{1}{c|}{\textbf{e-mail}} &
        \multicolumn{1}{c|}{\textbf{IM}\footnotemark[1]} &
            \multicolumn{1}{c|}{\textbf{地区}} \\ \hline
          \endhead
         
          \hline \multicolumn{6}{l}{转下页} \\
          \endfoot
         
          \hline \hline
          \endlastfoot

    参考资料:
    http://www.astro.psu.edu/gradinfo/psuthesis/longtable.html
    http://users.sdsc.edu/~ssmallen/latex/longtable.html

    My current TODO List - 20070821

    1. add more people's personal info to Gentoo Chinese community contact list.
    2. create a progress table for new translation task
    3. send an email to people who have been assigned a task, telling them where to get xml source file and how to translate.
    4. do list.xml and overview.xml, https://bugs.gentoo.org/show_bug.cgi?id=189247
    5. finish GWN 20070730
    6. assigned translation task GWN 20070806 20070813
    7. finish my doc dev quiz http://www.gentoo.org/proj/en/gdp/doc/doc-quiz.xml

    August 20

    chinese fortune, aka fortune-mod-zh, unified

    [zhangle@adriano games-misc] $ fortune-zh maoyulu
      共产党是不怕批评的,因为我们是马克思主义者,真理是在我们方面,工农基本群众是在我们方面。
      《在中国共产党全国宣传工作会议上的讲话》(一九五七年三月十二日),人民出版社版第一一页
    [zhangle@adriano games-misc] $ fortune-zh maoshici
    《蝶恋花・答李淑一》
    毛泽东 一九五七年五月十一日
    我失骄杨君失柳,
    杨柳轻飏直上重霄九。
    问讯吴刚何所有,
    吴刚捧出桂花酒。

    寂寞嫦娥舒广袖,
    万里长空且为忠魂舞。
    忽报人间曾伏虎,
    泪飞顿作倾盆雨。
    [zhangle@adriano games-misc] $ fortune-zh songproses
    吾道悠悠,忧心悄悄,最无聊处秋光到。西风林外有啼鸦,斜阳山下多衰草。
    长忆商山,当年四老,尘埃也走咸阳道。为谁书到便幡然?至今此意无人晓。
          — 辛弃疾《踏莎行》
    [zhangle@adriano games-misc] $ fortune-zh tang300
    《无题》
    作者:李商隐
    昨夜星辰昨夜风,画楼西畔桂堂东。
    身无彩凤双飞翼,心有灵犀一点通。
    隔座送钩春酒暖,分曹射覆蜡灯红。
    嗟余听鼓应官去,走马兰台类转蓬。
    [zhangle@adriano games-misc] $ fortune-zh lunyu
      子曰:“仁远乎哉?我欲仁,斯仁至矣。”
      --《论语》
    [zhangle@adriano games-misc] $ fortune-zh proverb
    刀不磨要生锈,人不学要落后。
        ―《谚语》

    http://code.google.com/p/chinese-fortune/issues/list


    August 18

    Gentoo手册已经全部上了官方网站

    http://www.gentoo.org/doc/zh_cn/handbook/

    有一句话不太对头 "本翻译已经不再被维护"
    是因为少了metadoc.xml
    我已经提交了
    https://bugs.gentoo.org/show_bug.cgi?id=189247

    2006.1 neysx 不愿意接收
    不过至少 gentoo-cn.org 是会保存着的
    大家的努力都是可以看到的

    再次感谢大家的努力

    现在就差我的doc quiz了

    Patrick也要加油啊

    问:_syscall[0-6]跑哪里去了

    答:没有了

    问:那现在用啥呢?
    答:用系统调用 syscall(2),第一个参数是SYS_name,后面参数照写

    August 16

    使用pulseaudio(待续)

    使用方式:alsa on top of pulseaudio on top of alsa
    好处:我的现有软件都使用alsa dmix,这样的使用方式原有软件不必重新配置
    注意事项:audacious -> 需要用pulseaudio output plugin,使用alsa的话放完一首歌就停
                 gsopcast -> .asoundrc中ctl.!defautl的类型要设置为hw
                 flash插件 -> 设定环境变量 FLASH_FORCE_PULSEAUDIO=1

    euse -E avahi pulseaudio
    emerge pulseaudio media-sound/padevchooser media-sound/paman media-sound/paprefs media-sound/pavucontrol media-sound/pavumeter net-www/libflashsupport
     alsa-plugins
    用我的/etc/pulse/default.pa
    load-module module-alsa-sink device=hw:0
    load-module module-alsa-source device=hw:0
    add-autoload-sink output module-oss device="/dev/dsp" sink_name=output source_name=input
    add-autoload-source input module-oss device="/dev/dsp" sink_name=output source_name=input
    add-autoload-sink output module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
    add-autoload-source input module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
    add-autoload-sink output module-alsa-sink sink_name=output device=dmix
    add-autoload-source input module-alsa-source source_name=input
    load-module module-esound-protocol-unix auth-anonymous=1
    load-module module-native-protocol-unix auth-anonymous=1
    load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/24
    load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/24
    load-module module-zeroconf-publish
    load-module module-volume-restore
    load-module module-rescue-streams
    .nofail
    load-sample x11-bell /usr/share/sounds/gtk-events/activate.wav
    load-module module-x11-bell sample=x11-bell
    load-module module-x11-publish
    load-module module-gconf

    用我的.asoundrc
    pcm.!default {
        type pulse
    }

    ctl.!default {
        type hw
        card 0
    }

    超级无敌screen caption

    caption always "%{= Bw}%-w%{= kW}%n %t%{= Bw}%+w%{= BW}%? @%u%?%? [%h]%?%-= - %LD %d %LM - %c"

    add it to your ~/.screenrc

    xrdb

    显示所有的property
    xrdb -all -query
    August 14

    搞定了Gentoo里的stardict 3.0.0

    if you_already_have_china_overlay() {
        layman -S
    } else {
        layman -a gentoo-china
    }

    stardict-3.0.0的问题和解决方案

    如果查不到单词,请到词典管理,在默认组的Query Dict和Scan Dict里加上你已有的词典。

    geoff's git

    git-clone git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux
    you have to install dtc in order to build ps3 kernel from geoff's tree
    get it from http://dtc.ozlabs.org/
    August 09

    有关PS3的内核代码

    * tgall_out has quit (Read error: 110 (Connection timed out))
    <GodEater> r0bertz: no - I'm running a 2.6.22-somethingsomethingsomething-git one...
    <r0bertz> GodEater, arnd's git?
    <GodEater> don't think so
    <GodEater> lemme check
    <GodEater> geoff's git
    <GodEater> straight from kernel.org
    <r0bertz> GodEater, using cell_defconfig?
    <GodEater> ps3_defconfig
    <r0bertz> cool
    <GodEater> haven't updated it in a while mind you
    <GodEater> and there is at least one issue you need to be aware of
    <r0bertz> oh?
    <GodEater> which is you can't use boot-game-os (I think)
    <GodEater> you have to do that from the kboot prompt
    * parabelboi (i=parabelb@nat/ibm/x-ae945c36e7051b35) has joined #gentoo-ppc64
    <GodEater> boot-game-os wasn't working the last time I tried it from my kernel anyway - although as I say I've not done it in a while
    <r0bertz> GodEater, normally where should one use boot-game-os?
    <GodEater> either from the bash prompt in your running kernel, or at the kboot prompt
    <GodEater> in my kernel though as I say it doesn't work
    <GodEater> so I can only return to the game os from kboot
    <r0bertz> oh, previously i thought i can just use it on kboot, :)
    <GodEater> well if you upgrade you'll be right ;)
    <r0bertz> i haven't tried it yet, just installed gentoo on iti
    <r0bertz> s/iti/it
    <r0bertz> :)
    * GodEater confesses to having debian on his PS3 :(
    <r0bertz> hehe
    <GodEater> but the people in here seem to have more clue, so I choose to hang out here
    <r0bertz> ok
    <GodEater> I keep thinking about changing to gentoo - but I never seem to find the time
    <r0bertz> welcome! any time, ;)
    <malc> GodEater: that's just because of the device-renaming - if you look in boot-game-os, it calls find-other-os-flash you should be able to patch that up to detect the correct device and all will be well.
    <GodEater> malc: when I find that time I don't have I'll be sure and do that ;)
    <GodEater> ooh - talking of device renaming - you'll probably need to make changes to your /etc/fstab too r0bertz
    <GodEater> they renamed the ps3's disk devices
    <malc> it takes less time than 1 cycle of reboot to kboot: to boot to game-os tbh ;)
    <r0bertz> GodEater, renamed to what?
    <GodEater> /dev/ps3d(x) I think
    <r0bertz> ok, i will keep that in mind
    <r0bertz> thanks
    <GodEater> it's somewhere in the git changes logs for the ps3 branch if you want to confirm
    <GodEater> I'm doing this from memory, and my PS3 isn't switched on at home today so I can't ssh into it and confirm for you
    <r0bertz> that's fine, i will check myself, thanks

    Gentoo on PS3安装手记

    要准备的东西:
    1. PS3 (这台是60G的)
    2. PC
    3. U盘
    4. 空CD-R
    首先,PS3里给Linux分出10G的空间。System Setting -> "Format xxx" (选项名记不清了,有个format)。把PS3的系统软件版本升级到最新,现在为1.9版。此机器为新机,所以没有做备份。如果你的硬盘里已经有东西,要先备份。
    然后,下载刻录Gentoo minimal install CD。http://gentoo.osuosl.org/experimental/ppc64/livecd/
    然后,把U盘插到PC上。在U盘根目录 mkdir -p PS3/otheros。把Gentoo光盘里的ps3_otheros_images里 的otheros.default,拷贝到PS3/otheros下,重命名为otheros.bld
    然后,下载32bit userland stage4 tarball,放到U盘里。
    然后,把U盘插到PS3上。System Setting下选择Install Other OS。这样PS3就能从U盘里检测到需要的东西,然后按提示继续安装过程。重启前,在default system中选择other OS。重启。
    然后,按照这个网页 http://overlays.gentoo.org/proj/cell/wiki/InstallGentooOnPS3 从 Prepare the hard disk for installation 继续安装。这里要注意的是/dev/sda就是你前面第一步给Linux分出的10G。它是作为一个设备出现的,而不是一个分区。

    之后就是正常的Gentoo安装过程。唯一一个要注意的是,如此装好的系统内核为64位,用户层为32位。编译内核时要设定CROSS_COMPILE变量
    make CROSS_COMPILE=powerpc64-unknown-linux-gnu- oldconfig[menuconfig,...]

    后记:
    安装时用的PC里装的是Ubuntu,Ubuntu的cdrecord是wodim,这个是debian fork的cdrtools。cdrtools的协议不符合debian的自由软件标准,所以debian fork了它。http://lwn.net/Articles/198171/ 可是这个东西扫描不到笔记本上的刻录机。后来用nautilus刻录成功,步骤仅仅是右键点击选择烧录。

    今天早上修改了有关显示模式的内核参数,结果电视机上显示不出来了。kboot不会玩。结果我盲打修改了/etc/kboot.conf,然后恢复了原状。

    PS3上的Linux启动时,有8个小企鹅。第一行2个大的,代表双核CPU。第二行6个小的,代表6个SPU。

    --
    Zhang Le, Robert
    http://r0bertz.blogspot.com
    http://zh.gentoo-wiki.com
    http://savannah.nongnu.org/projects/pgubook
    http://groups.google.com/group/gentoo-china
    http://groups.google.com/group/szlug