16 Jun 2007 (Sat)

04:04:03 # Life Running user-mode emulation with qemu on a chroot. If you're running on i386, and want to hack on mips, using user-mode emulation rather than the chunky system-mode emulation of qemu, I have a good news for you. If not, well, please read on.

Say you have the mips root filesystem at /mnt (try debootstrap --cross). Copy qemu-mips into the chroot, and copy the required i386 libraries into the chroot, in a path that is only executed by the i386 ELF loader (I used, /lib/i686/cmov here), and copy ld-linux.so.2 to /mnt/lib. (this hack works because mips uses /lib/ld.so.1 while i386 uses /lib/ld-linux.so.2)

# ls -l /mnt/bin/qemu-mips
-rwxr-xr-x 1 root root 555648 Jun 16 03:49 /mnt/bin/qemu-mips
# ldd /mnt/bin/qemu-mips
        linux-gate.so.1 =>  (0xffffe000)
        libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7f86000)
        librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb7f7d000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0xb7ebb000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7d78000)
        /lib/ld-linux.so.2 (0xb7fc1000)
        libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7d61000)
        libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7d5d000)
# ls -l /mnt/lib/i686/cmov/
total 4440
-rw-r--r-- 1 root root  785548 Jun 16 03:56 libasound.so.2
-rw-r--r-- 1 root root  785548 Jun 16 03:55 libasound.so.2.0.0
-rw-r--r-- 1 root root 1315328 Jun 16 03:52 libc-2.5.so
-rwxr-xr-x 1 root root 1315144 Jun 16 03:57 libc.so.6
-rw-r--r-- 1 root root    9684 Jun 16 03:57 libdl.so.2
-rw-r--r-- 1 root root  153424 Jun 16 03:55 libm.so.6
-rwxr-xr-x 1 root root  107995 Jun 16 03:57 libpthread.so.0
-rw-r--r-- 1 root root   30624 Jun 16 03:55 librt.so.1
# ls -l /mnt/lib/ld
ld-2.5.so      ld-linux.so.2  ld.so.1
	

You can now run qemu-mips through chrooting.

# chroot . /bin/qemu-mips /bin/bash
cannot set up thread-local storage: unknown error
	

oops. qemu in unstable today doesn't actually work with mips user-mode emulation. Try the more recent CVS snapshot instead ... To be continued ?

15:31:02 # Life Trying to update the kernel on macbook. I was sitting on 2.6.20.1, so I tried updating to 2.6.21.5. Internal mouse doesn't seem to work, might be due to X settings. Wireless with madwifi doesn't seem to get DHCP, I wonder why. UPDATE: Noel Kothe wrote in mactel linux mailing list that we need a newer version of madwifi than that in unstable today.

Junichi Uekawa

$Id: dancer-diary.el,v 1.91 2006/06/15 15:14:10 dancer Exp $