Saturday, August 20, 2011


There's been some problem renewing this domain. We might as well abandon this domain name altogether and switch to Actually I have already registered the later one.

Probably will set it up this weekend.

Meanwhile you can access the site using Everything works fine, except sub domains, like {planet,irc...}

Sorry for the convenience caused, if any.


Sunday, June 12, 2011

gentoo-zh overlay

So gentoo-china and gentoo-taiwan overlay will merge. The new overlay will be called gentoo-zh.
I have already added gentoo-zh overlay to repositories.xml based on which layman-global.txt is generated.

Thanks to microcai for merging the repository of these two projects.

EDIT: sorry there is an error about the source type. already fixed.

Labels: ,

Monday, February 21, 2011

New job, New life

So, as some of you may know, I have just settled down in San Jose, CA.
My new job is Site Reliability Engineer in Google Mountain View office.

I would like make some new friends here.
If you live nearby, let me know, ;)

Sunday, December 19, 2010

Linux 2.6.35 + glibc compiled with >linux-header-2.6.34 == Unusable MIPS N32 System

getdents64 was added to N32 ABI during 2.6.35 merge window. But it has a problem which is later fixed by a patch merged in 2.6.36 window.

IIRC, readdir in glibc works with both getdents and getdents64, and it prefers getdents64 if it is available.

So if your glibc is compiled against linux-header-2.6.35 and upwards, readdir will use getdents64, but on Linux 2.6.35 it actually calls getdents. So readdir will be confused.

As a consequence, you will have problems accessing files. The system will be effectively unusable.

So if you have encountered this problem, pray that you have another system which could boot the machine. Compile a kernel 2.6.36 or upwards and use it to boot the system. Then you should be able to get your system back.

Wednesday, September 15, 2010

MIPS N32 Firefox

Almost forget to mention, now with this workaround, N32 firefox-3.6.8 is working again.

I am still trying to fix the binutils bug.
I am feeling that I am not far from a break through.

BTW, Shenzhen Linux User Group will celebrate Software Freedom Day 2010 on this Saturday.
If you happen to be in town by then, do drop by, ;)
If you can come, and don't understand Chinese, I am always ready for help. ;)

Labels: , ,

Thursday, July 29, 2010

Loongson 2F N32 stage3 is now available on gentoo mirrors

It is under experimental/mips/stages/loongson/. Like:
I should have done it long ago, just don't familiar with catalyst and catalyst lacks documentation.

Thanks to leio and robbat2 for making it happen.

I have already included kernel modules in the stage3. You can find the corresponding kernel here:

If you want to build your own kernel, use the source here:

You also need loongson overlay. Just use layman to add it. Of course you need to emerge layman first.;a=summary

If you find portage ask you to downgrade packages, you can try this trick
ACCEPT_KEYWORDS="x86 ~x86 ~mips"
However you need to understand that there is no guarantee that software installed in this way would work. But at least some of them will work. Like perl. I have been using this for a long time. Some packages are not so easy to downgrade. So maybe you need to use this too. But remember, if the package really works, better file a keyword bug asking devs to add mips keyword to it.

Please note this is experimental, so I am afraid there will be problems. If you hit any, please don't hesitate to contact me.

Sunday, July 18, 2010

Type special characters in xterm in N900

UPDATE: The build failed because of gcc's multislot USE flag(seed stage has it while catalyst can't set USE for stage3). I was on a trip so there is actually no progress for the last 5 days. Sorry. I have worked around it. Now rebuilding.

First, sudo gainroot.

Then run the following two commands:
/home/user # gconftool-2 -s /apps/osso/xterm/key_labels -t list --list-type=string '[Tab,Esc,~,`,|,>,<]'
/home/user # gconftool-2 -s /apps/osso/xterm/keys -t list --list-type=string "[Tab,Escape,asciitilde,grave,bar,greater,less]"
Then restart your xterm, you will see the bottom bar looks like the one showing in the following picture:

This picture shows that I am building new stage3 for Loongson 2F, N32 ABI, ;)

Friday, May 21, 2010

FEATURES installsources not working on MIPS?

Update 2010-07-09: the patch received upstream attention. The maintainer said it's better to send to directly.
Update: just reported to upstream

I resumed my quest to xulrunner linking problem on Loongson:

But I found that "installsources" FEATURE is not working on Loongson. I investigated it and found that it is because debug.sources file produced by debugedit is empty.

Then I found that in turn was because debug related sections in MIPS elf file is not of type SHT_PROGBITS, but SHT_MIPS_DWARF.

[32] .debug_aranges MIPS_DWARF 00000000 0845c4 0002c0 00 0 0 1
[33] .debug_pubnames MIPS_DWARF 00000000 084884 001a2a 00 0 0 1
[34] .debug_info MIPS_DWARF 00000000 0862ae 015221 00 0 0 1
[35] .debug_abbrev MIPS_DWARF 00000000 09b4cf 002c9a 00 0 0 1
[36] .debug_line MIPS_DWARF 00000000 09e169 009ce3 00 0 0 1
[37] .debug_str MIPS_DWARF 00000000 0a7e4c 0049d7 01 MS 0 0 1
[38] .debug_loc MIPS_DWARF 00000000 0ac823 004c7d 00 0 0 1
[39] .debug_macinfo MIPS_DWARF 00000000 0b14a0 1cf9d6 00 0 0 1
[40] .debug_ranges MIPS_DWARF 00000000 280e76 0001d8 00 0 0 1
So the fix is very easy and straight forward.

--- debugedit.c.orig 2010-05-21 16:26:13.000000000 +0800
+++ debugedit.c 2010-05-21 01:44:08.000000000 +0800
@@ -1596,6 +1596,7 @@
switch (dso->shdr[i].sh_type)
name = strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name);
/* TODO: Handle stabs */
#if 0

Sunday, April 18, 2010

Show real swap usage for each individual process

Update: the kernel patch is already in 2.6.34-rcN.

Currently, in top, the SWAP column only shows the difference between VIRT and RES:
    case P_SWP:
MKCOL(scale_num(PAGES_TO_KB(p->size - p->resident), w, s));
So currently the value is of no use.

As a matter of fact, a recent enough kernel has provided the information which is needed to calculate the swap usage for each process. It is in /proc/$PID/smaps. But using smaps may affect top's performance because you have to calculate the sum yourself.

But with this patch, the kernel will keep track of each process's swap usage for you. This patch (maybe not exactly in the same shape) is already in mmotm tree ( 2.6.34-rcN.

However, checking the /proc/$PID/status file directly may not be a thing which people would like to do. So I decided to make a patch for ps and top. Now it seems to be working.

This is the vanilla ps:
$ ps -o m_swap,comm -e | grep firefox
- firefox

This is modified ps:
$ ./ps/ps -o m_swap,comm -e | grep firefox
2984 firefox

This is a picture showing a modified top:

The patch can be found here:

Saturday, April 03, 2010

Generate coredumps automatically in specified directory

If you are into investigating coredumps, or you are just curious about how many processes have coredumped, then this is for you:

1. add the following line to /etc/security/limits.conf
* - core unlimited
2. add the following line to /etc/sysctl.conf
kernel.core_pattern = /corefiles/core.%e.%p
%e is the executable filename, %p is pid.
Please check the "Naming of core dump files" section of man 5 core for more information on this.

3. run "sysctl -p", then logout and login. Or just reboot.

This is what I have on my Yeeloong:
$ ls /corefiles/
core.genstrings.11832 core.nscd.10278 core.nscd.12821 core.nscd.13617 core.nscd.23172 core.nscd.29367 core.nscd.6428
core.genstrings.18210 core.nscd.10281 core.nscd.13061 core.nscd.13620 core.nscd.23175 core.nscd.29368 core.nscd.6431
core.main.19478 core.nscd.10284 core.nscd.13064 core.nscd.19028 core.nscd.24042 core.nscd.29369
core.main.19702 core.nscd.10293 core.nscd.13067 core.nscd.19031 core.nscd.29353 core.nscd.29371
core.main.19825 core.nscd.10294 core.nscd.13219 core.nscd.22710 core.nscd.29360 core.nscd.29372
core.main.19894 core.nscd.12815 core.nscd.13222 core.nscd.22713 core.nscd.29363 core.nscd.29373
core.mkhomedir_helpe.31721 core.nscd.12818 core.nscd.13614 core.nscd.22716 core.nscd.29366 core.nscd.6425