2008年11月20日星期四
2008年11月9日星期日
2008年11月8日星期六
About Prelink & Enable prelink in Unbuntu
What is Prelinking?
Prelinking is a process that allows you to speed up the process of dynamic linking. What it does is, through a process of magic that is incredibly complex, but basically it speeds up the relocation process, in loading shared libraries.. by setting preferred load addresses.What is he talking about, you ask? Well, here's how it goes. Dynamically linked libraries (often referred to as DSO's or in the windows world DLLs) are libraries which are loaded at runtime. The advantage of shared libraries versus static libraries is, that it reduces the size of executables, since each program doesn't need its libraries built in, but will dynamically locate and use it at run time. This adds some overhead, because the address space of the library, instead of being known in advance, has to be mapped at runtime. Another advantage of shared libraries is that due to the magic of copy-on-write, you can save memory when you have multiple programs sharing the same library (though it's not as simple as that.. it is pretty complicated)
Pre-linking sets preferred address space for the libraries to be loaded at. Note they are _preferred_ spaces, and if that address space is not available, then it will use relocation to load it dynamically.. hence pre-linking is not 100% foolproof.
What do I need to prelink?
To prelink, you need at least:
- glibc 2.3.1 or greater
- libelf or elfutils 0.7, though 0.8 is preferred. Latest version as of this writing is 0.84
- Your shared libraries have to be compiled with -fPIC
- the prelink program from ftp://people.redhat.com/jakub/prelink
HOWTO: Enable prelink
Prelink is in universe. I use it on my Ubuntu system without issues, but do google about Prelink and do your research before trying it out.
How to enable prelink:
1. Activate Ubuntu universe sources. The procedure is well-documented by Ubuntu.
2. use apt-get or synaptic to install prelink.
3. Open /etc/default/prelink with your favorite editor, as sudo/root.
4. Change PRELINKING=unknown from unknown to yes.
5. Adjust the other options if you know what the heck you're doing. Defaults work well.
6. To start the first prelink (the longest one!), run sudo /etc/cron.daily/prelink
In the future, prelink performs a quick prelink (a less-than-1-minute procedure on most systems) daily, usually at midnight. Every 14 days, or whatever you changed it to be, a full prelink will run.
If you just did a major apt-get upgrade that changed systemwide libraries (i.e. libc6, glibc, major gnome/X libs, etc etc etc) and experience cryptic errors about libs, rerun step 6.
To undo prelink, change step 4 from yes to no, then rerun step 6.
WARNING:
An amd64 users in another thread (http://ubuntuforums.org/showpost.php...3&postcount=16) reports having experienced trouble with AMD64 prelinking. I have NOT tried prelinking on anything other than an i386!
2008年11月5日星期三
移植 tslib 到Android 的注意事项
插件的顺序是你的 ts.conf 里面的插件的顺序。
昨天发现能够从/dev/input/event1里面读出东西来, 却不能够用ts_test来响应,原来是驱动送上来的点不符合规则, (更搞笑的是他还没意识到这点, 坚持说自己是对的), 我用的插件是 input 插件, 找到问题以后就好办了, 改configure.ac里面, 给自己加一个插件, 就叫ac97吧, 然后创建文件 tslib_src/plugins/ac97-raw.c , 把你“特殊”的驱动加进去就可以了。
测试的时候, 发现很慢, 奇怪驱动送上来的点是很快的啊, 结果发现是因为我在读入每个点之后都打印了调试信息, 所以导致tslib的延迟, 如果你的系统也存在同样的问题, 最好去掉debug试一试, 毕竟终端是比较慢的设备。
其实把tslib放入Android里面首先要解决的问题是Android的编译系统, 你要把tslib, 和那些你用到的插件们都编译成动态库的形式, 可以参考其他库的Android.mk文件来编写, 还有就是你要把ts_test, ts_calebrate编译成可执行文件, 同样是编写Android.mk。
因为Android是从/dev/input/event0读入鼠标事件, 我们的想法就是不要去改动他的代码, 在后台运行一个daemon, 它就是把 /dev/input/event1中读出来的坐标(经过校准的),inject到event0里面, 这样一来就可以不修改Android的代码, 而加入我们的东西。
我在想, 要不要把tslib的东西checkin到Android的baseline中呢。 这是一个好想法。 毕竟不是所有人都用电容触摸屏的。
移植进入Android里面可能会有这样的问题, 就是点击触摸屏和键盘会没有反应, 其实这是因为电源管理相关的东西导致的, 如果你也遇到同样的问题, 那么请屏蔽掉 _android_src_/hardware/libhardware/power.c中的函数(关键是最后一个函数, 函数名我忘了呵呵)。
PS:fprintf到stderr上严重影响性能, 用打log调试确实不是一个好的方法, 在tiny loop和相应用户事件的地方不要大量的打log, 这也是为什么让我体会到了Android中的logger设备的优点啊。
2008年11月2日星期日
苍白
后脑有些镇痛, 大概是熬夜加刺激的原因, 看着房间里面的家具, 竟然和昨天完全不一样, 于是也重新拾起了被我遗弃已久的博客。
我醒着吗? 感觉它们都是一个个静物,我变成了素描画。除了我没有定格, 其他的东西都已经和我没有关系,黑白色。尽管他们有很多都已经不是原来的颜色, 但是现在看到的都是黑白色。 不,只有白色的色调变化而已。
有风轻轻吹入房间, 原来是我已经打开了窗户, 管着的房门也因为风的缘故发出一些响声, 奇怪, 这些都是我熟悉的。 为何如此陌生了。
一个, 两个脚直接踏在地板上, 也许以前不经常这么做吧, 或许我发觉了我的身体或者说皮囊已经开始和我的灵魂有些偏移, 重影有些错位, 就像没有印刷好的一张照片。 去看看小可,也许会让我好些。
对了, 我很无知, 原来这个季节已经没有台风了。 所以计划赶不上变化。
我才发觉, 有许多我没有关注的事情, 尤其是她的细微感受。
“世界非常安静
需要深呼吸 才能呼吸”