<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chen Yufei's blog &#187; Linux</title>
	<atom:link href="http://chenyufei.info/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://chenyufei.info/blog</link>
	<description>Keep your head about you while all those are losing theirs</description>
	<lastBuildDate>Wed, 21 Jul 2010 05:30:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Linux initial ramdisk 以及启动过程</title>
		<link>http://chenyufei.info/blog/2010-05-01/linux-initial-ramdisk-and-startup-process/</link>
		<comments>http://chenyufei.info/blog/2010-05-01/linux-initial-ramdisk-and-startup-process/#comments</comments>
		<pubDate>Sat, 01 May 2010 05:05:42 +0000</pubDate>
		<dc:creator>chenyufei</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ramdisk]]></category>

		<guid isPermaLink="false">http://chenyufei.info/blog/?p=300</guid>
		<description><![CDATA[推荐一篇 IBM developerworks 上的文章，Linux initial RAM disk (initrd) overview，很详细一篇介绍，包括了内核里哪些函数涉及到启动过程。另外 man initrd 也有相关的介绍。 不过文章的内容已经有点过时，内核启动过程调用的函数发生变化，默认执行的 initrd 里的程序也从 /linuxrc 变成 /init。另外现在 Linux 发行版大多用 cpio 格式的 initrd)，这篇文章介绍的是 ext2 格式的。如何提取和创建 cpio 格式的 initrd 可以参考下面这篇文章Debian Lenny 5.0.1 PXE initrd update，主要的命令如下： # 提取 zcat ../initrd.gz &#124; cpio -iv # 创建 find . -print0 &#124; cpio -0 -H newc -ov &#124; gzip -c [...]]]></description>
			<content:encoded><![CDATA[<p>推荐一篇 IBM developerworks 上的文章，<a href="http://www.ibm.com/developerworks/linux/library/l-initrd.html">Linux initial RAM disk (initrd) overview</a>，很详细一篇介绍，包括了内核里哪些函数涉及到启动过程。另外 man initrd 也有相关的介绍。</p>
<p>不过文章的内容已经有点过时，内核启动过程调用的函数发生变化，默认执行的 initrd 里的程序也从 /linuxrc 变成 /init。另外现在 Linux 发行版大多用 cpio 格式的 initrd)，这篇文章介绍的是 ext2 格式的。如何提取和创建 cpio 格式的 initrd 可以参考下面这篇文章<a href="http://www.ducea.com/2009/05/19/debian-lenny-501-pxe-initrd-update/">Debian Lenny 5.0.1 PXE initrd update</a>，主要的命令如下：</p>
<pre>
# 提取
zcat ../initrd.gz | cpio -iv
# 创建
find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd.gz
</pre>
<p>如果有 Linux 内核源码的话还可以参考 Documentation/initrd.txt，里面有启动过程的介绍和创建和提取 initrd 的说明，内容比 man initrd 更详细，不过也有一点过时。</p>
]]></content:encoded>
			<wfw:commentRss>http://chenyufei.info/blog/2010-05-01/linux-initial-ramdisk-and-startup-process/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>screen &amp; LD_LIBRARY_PATH</title>
		<link>http://chenyufei.info/blog/2009-11-13/screen-ld_library_path/</link>
		<comments>http://chenyufei.info/blog/2009-11-13/screen-ld_library_path/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 16:45:24 +0000</pubDate>
		<dc:creator>chenyufei</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://chenyufei.info/blog/?p=191</guid>
		<description><![CDATA[这篇 post 居然是在今年 1 月份的时候放到 draft 里，到现在才 publish…… 因为用 intel 的编译器，所以设置了 LD_LIBRARY_PATH 这个环境变量，但是每次启动 screen 后这个环境本来都会被 unset。google 到的结果。 screen 可执行文件是 setuid 的（为了 share session，debian 的 screen 安装时默认没有 setuid），glibc 对这样的可执行文件会把那些“危险”的环境变量去掉，所以出现了上面的情况 解决办法两个 1. 把 setuid 位去掉，当然这样 screen 的 share session 就不能工作了，还好一般用不到 2. 把 LD_LIBRARY_PATH 的设置放到 .zshrc/.bashrc 之类的文件里去，这样每次启动 shell 的时候自然会把这个环境变量读入的 if [ -z $LD_LIBRARY_PATH ]; then export $LD_LIBRARY_PATH=XXX else [...]]]></description>
			<content:encoded><![CDATA[<p>这篇 post 居然是在今年 1 月份的时候放到 draft 里，到现在才 publish……</p>
<p>因为用 intel 的编译器，所以设置了 LD_LIBRARY_PATH 这个环境变量，但是每次启动 screen 后这个环境本来都会被 unset。<a href="http://www.mail-archive.com/screen-devel@gnu.org/msg00019.html">google 到的结果</a>。</p>
<p>screen 可执行文件是 setuid 的（为了 share session，debian 的 screen 安装时默认没有 setuid），glibc 对这样的可执行文件会把那些“危险”的环境变量去掉，所以出现了上面的情况</p>
<p>解决办法两个</p>
<p>1. 把 setuid 位去掉，当然这样 screen 的 share session 就不能工作了，还好一般用不到<br />
2. 把 LD_LIBRARY_PATH 的设置放到 .zshrc/.bashrc 之类的文件里去，这样每次启动 shell 的时候自然会把这个环境变量读入的</p>
<pre>
if [ -z $LD_LIBRARY_PATH ]; then
    export $LD_LIBRARY_PATH=XXX
else
    export $LD_LIBRARY_PATH=$LD_LIBRARY_PATH:XXX
fi
</pre>
<p>LD_LIBRARY_PATH 这个环境变量设置起来还真的挺麻烦的，系统的库目录和自己的库目录下有同名不同版本的库的时候，不是自己的程序有问题就是系统的程序有问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://chenyufei.info/blog/2009-11-13/screen-ld_library_path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small tips to improve window switcher performance in compiz</title>
		<link>http://chenyufei.info/blog/2007-11-19/small-tips-to-improve-window-switcher-performance-in-compiz/</link>
		<comments>http://chenyufei.info/blog/2007-11-19/small-tips-to-improve-window-switcher-performance-in-compiz/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 05:20:38 +0000</pubDate>
		<dc:creator>chenyufei</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://chenyufei.info/blog/2007/11/19/small-tips-to-improve-window-switcher-performance-in-compiz/</guid>
		<description><![CDATA[After using Sawfish for some time and seeing the amazing new effects provided by compiz-fusion, I switched to compiz-fusion. (I switch window managers about every two months ;-) ) Every thing goes smoothly. The installation of compiz-fusion on Arch is simple, no extra configuration for X is needed since I&#8217;ve used beryl before. It just [...]]]></description>
			<content:encoded><![CDATA[<p>After using <a href="http://sawfish.wikia.com/wiki/Main_Page">Sawfish</a> for some time and seeing the amazing new effects provided by <a href="http://www.compiz-fusion.org/">compiz-fusion</a>, I switched to compiz-fusion. (I switch window managers about every two months ;-) ) Every thing goes smoothly. The installation of compiz-fusion on Arch is simple, no extra configuration for X is needed since I&#8217;ve used beryl before. It just works :-)</p>
<p>One feature I love for <a href="http://compiz.org/">compiz</a> &#038; <a href="http://www.beryl-project.org/">beryl</a> is window switching: You get a preview of each window so it&#8217;s much easier to select the desired window. However, the switching operation is not quite smooth on my box no matter what window switcher I am using. I tried to change the configuration for the shift switcher and found that <strong>using none overlay icon dramatically increases the performance</strong>. I tried this on other window switchers and it also works. Anyway, the overlay icon is not very useful to me, so I can still be happy without it.</p>
<p><strong>Another option I suggest to toggle on is Mipmaps</strong>. You will get much better preview without any noticeable performance degeneration.</p>
]]></content:encoded>
			<wfw:commentRss>http://chenyufei.info/blog/2007-11-19/small-tips-to-improve-window-switcher-performance-in-compiz/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>交换 Caps Lock 和 Esc</title>
		<link>http://chenyufei.info/blog/2007-08-25/post-070825-100618-685/</link>
		<comments>http://chenyufei.info/blog/2007-08-25/post-070825-100618-685/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 03:10:31 +0000</pubDate>
		<dc:creator>chenyufei</dc:creator>
				<category><![CDATA[Vim]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://chenyufei.info/blog/?p=132</guid>
		<description><![CDATA[Vim 里面你怎么按 Esc 键？今天网上看到有人开玩笑说用巴掌拍过去，这个似乎暴力了点…… 我是用左手小拇指按的，很神奇吧，那么远居然用小指按。 如果你看过 Vim Tips 的话可能就会知道怎么回事。其实我按的是 Caps Lock，利用 xmodmap 修改了 X window 下的键盘布局。因为我很少用到 Caps Lock 键，同时也为了方便按键，我交换了 Caps Lock 和 Esc 的位置。上代码， remove Lock = Caps_Lock keysym Escape = Caps_Lock keysym Caps_Lock = Escape add Lock = Caps_Lock 保存到某个文件，比如 ~/.Xmodmap，然后执行 xmodmap ~/.Xmodmap 就可以了。当然，我现在是每次启动 X 的时候都自动执行这条命令。开始会有些不习惯吧，但习惯以后肯定可以提高使用 Vim 的爽快感的。 Emacs 也有用户交换 Ctrl 和 Caps Lock [...]]]></description>
			<content:encoded><![CDATA[<p>Vim 里面你怎么按 Esc 键？今天网上看到有人开玩笑说用巴掌拍过去，这个似乎暴力了点……</p>
<p>我是用左手小拇指按的，很神奇吧，那么远居然用小指按。</p>
<p>如果你看过 Vim Tips 的话可能就会知道怎么回事。其实我按的是 Caps Lock，利用 xmodmap 修改了 X window 下的键盘布局。因为我很少用到 Caps Lock 键，同时也为了方便按键，我交换了 Caps Lock 和 Esc 的位置。上代码，</p>
<pre>
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
</pre>
<p>保存到某个文件，比如 ~/.Xmodmap，然后执行 xmodmap ~/.Xmodmap 就可以了。当然，我现在是每次启动 X 的时候都自动执行这条命令。开始会有些不习惯吧，但习惯以后肯定可以提高使用 Vim 的爽快感的。</p>
<p>Emacs 也有用户交换 Ctrl 和 Caps Lock 的，但个人感觉那样的话按 C-x 不是很不爽……</p>
]]></content:encoded>
			<wfw:commentRss>http://chenyufei.info/blog/2007-08-25/post-070825-100618-685/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>sysenter, int 0&#215;80 和 Linux 系统调用</title>
		<link>http://chenyufei.info/blog/2007-05-12/post-070512-221011-78/</link>
		<comments>http://chenyufei.info/blog/2007-05-12/post-070512-221011-78/#comments</comments>
		<pubDate>Sat, 12 May 2007 14:34:27 +0000</pubDate>
		<dc:creator>chenyufei</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://chenyufei.info/blog/?p=108</guid>
		<description><![CDATA[这次的作业里面要求修改 Linux 内核代码，统计系统调用执行的次数。看 《Linux Kernel Development》 的第一版（我买的早，所以是第一版），在 entry.S 里面加了几行代码，然后实现个系统调用把统计数据提供给用户空间进程，还是很简单的。 先说点题外话，《Linux Kernel Development》 一年前没有学过 Linux 编程的时候看不懂，现在再看感觉好多了，是本内核入门非常不错的书。 不过发现了点奇怪的现象。（无知，所以才觉得奇怪啊）测试程序里面用 C 库提供的 syscall 来调用自己写的系统调用，无论调用多少次，自己的那个调用的执行次数统计始终为 0。但是如果使用 _syscall 宏来调用自己的系统调用，每次调用统计次数都会增加。（我在 2.6.20 的内核 asm/unistd.h 中没有找到 _syscall 宏，拿了老版本代码里面的宏来用。）看 glibc 的 syscall 代码没有看懂（glibc 真是复杂，看的头大，不过倒是知道了什么是 weak symbol）。拿了 LKD 的第二版再来看，看到里面提到一句 Linux 的系统调用在 x86 上现在有了一种新的出发机制，名字就叫 sysenter。sysenter 进入内核的代码在 sysenter.c 里，我只改了 entry.S 所以如果用户空间进程以 sysenter 进入内核则系统调用的统计数据当然不会有变化。问题应该就是出在这里了。 于是就开始 Google 了，找到一些文章，ibm developer works [...]]]></description>
			<content:encoded><![CDATA[<p>这次的作业里面要求修改 Linux 内核代码，统计系统调用执行的次数。看 《Linux Kernel Development》 的第一版（我买的早，所以是第一版），在 entry.S 里面加了几行代码，然后实现个系统调用把统计数据提供给用户空间进程，还是很简单的。</p>
<p>先说点题外话，《Linux Kernel Development》 一年前没有学过 Linux 编程的时候看不懂，现在再看感觉好多了，是本内核入门非常不错的书。</p>
<p>不过发现了点奇怪的现象。（无知，所以才觉得奇怪啊）测试程序里面用 C 库提供的 syscall 来调用自己写的系统调用，无论调用多少次，自己的那个调用的执行次数统计始终为 0。但是如果使用 _syscall 宏来调用自己的系统调用，每次调用统计次数都会增加。（我在 2.6.20 的内核 asm/unistd.h 中没有找到 _syscall 宏，拿了老版本代码里面的宏来用。）看 glibc 的 syscall 代码没有看懂（glibc 真是复杂，看的头大，不过倒是知道了什么是 weak symbol）。拿了 LKD 的第二版再来看，看到里面提到一句 Linux 的系统调用在 x86 上现在有了一种新的出发机制，名字就叫 sysenter。sysenter 进入内核的代码在 sysenter.c 里，我只改了 entry.S 所以如果用户空间进程以 sysenter 进入内核则系统调用的统计数据当然不会有变化。问题应该就是出在这里了。</p>
<p>于是就开始 Google 了，找到一些文章，<a href="http://www.ibm.com/developerworks/cn/linux/kernel/l-k26ncpu/index.html">ibm developer works 的介绍</a>，<a href="http://linux.chinaunix.net/doc/kernel/2005-02-01/1044.shtml">ChinaUnix 的一篇文章</a>。马上来 fix 它。</p>
<p>想起去年暑假 IBM 的工程师凌棕说的一句话了，工程师只要找到问题，接下来就好解决了，难就难在怎样找到问题。再一次体会到了，不过这次运气还行，找到问题过程还算顺利。</p>
]]></content:encoded>
			<wfw:commentRss>http://chenyufei.info/blog/2007-05-12/post-070512-221011-78/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
