2009年6月12日金曜日

Gentoo freeze unloading alsa module

gentoo-sources-2.6.29-r5
alsa-utils-1.0.17
の組み合わせで、shutdown すると
unloading alsa module
以降進まなくなる。

http://bugs.gentoo.org/232875
System hangs at shutdown after message "Killing processes using ALSA"

らしい、とりあえず
emerge --unmerge alsa-utils
でもいいけど、音 出なくなるのもアレなので、

/etc/init.d/alsasound に UNLOAD_ON_STOP="no" を書いて回避

2009年6月7日日曜日

initrd.gz をマウントするには ...

kernelが cramfs に対応してる必要がある
- File systems --->
- Miscellaneous filesystems --->
- Compressed ROM file system support (cramfs)
- ROM file system support

その上で、gunzip initrd.gz
mount -o loop initrd /mnt

2009年6月4日木曜日

Debian GNU/Linuxでクロスコンパイル環境を作る(mipsel)

1. aptitude install apt-cross
クロスコンパイル用ライブラリを簡単に作ってくれる

2. サポートしてるアーキテクチャは
dpkg-architecture -L
で確認できる。今回は mipsel

3. アップデート
apt-cross -a mipsel --update

4. gccに必要なライブラリをインストール
apt-cross -a mipsel --install gcc

5. クロスコンパイラの作成に必要なパッケージをインストール
apt-get build-dep binutils
apt-get build-dep gcc-4.3

6. apt-get source binutils
cd binutils-2.18.1
./configure --target=mipsel-linux-gnu --prefix=/usr/mipsel-linux-gnu
make
make install

export PATH=/usr/mipsel-linux-gnu/bin:$PATH

7. gcc
http://ftp.gnu.org/gnu/gcc/gcc-4.3.3/

cd gcc-4.3.3/
./configure --target=mipsel-linux-gnu --prefix=/usr/mipsel-linux-gnu \
--disable-nls --disable-shared --without-headers \
--with-newlib --enable-languages=c
make all-gcc install-gcc


X.
http://www.kernel.org/pub/linux/kernel/v2.6/
tar jxvf linux-2.6.27.24.tar.bz2
make ARCH=mips menuconfig
make ARCH=mips CROSS_COMPILE=mipsel-linux-gnu- vmlinux

qemu-system-mips で動かすなら Machine selection は Malta board を選択する
debian kernelなら Machine selection に qemu が選択できる(2.6.18)

Y. build result
linux-2.6.27 + gcc-4.3.3 + binutils-2.18.1 : ok
linux-2.6.18 + gcc-4.3.3 + binutils-2.18.1 : failed
linux-2.6.18 + gcc-4.3.1 + binutils-2.17.50 : failed

mips in qemu

qemu-system-mips を使ってみる。
を使ってみる。

と言っても、クロスコンパイラ用意できてないし、
とりあえず、test imageで...
http://www.nongnu.org/qemu/download.html
mips-test-0.2.tar.gz の run-qemu にある通り

qemu-system-mips -kernel vmlinux-2.6.18-3-qemu -initrd initrd.gz -append "console=ttyS0 init=/bin/sh" -nographic -m 128 -hda ../hda.img

で、あっさり起動。

qemu: Warning, could not load MIPS bios '/usr/share/qemu/mips_bios.bin'
Linux version 2.6.18-3-qemu (Debian 2.6.18-8) (waldi@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)) #1 Mon Dec 11 02:18:57 UTC 2006
CPU revision is: 00019300
FPU revision is: 00739300
Determined physical RAM map:
memory: 08000000 @ 00000000 (usable)
Initial ramdisk at: 0x802d7000 (2663940 bytes)
Built 1 zonelists. Total pages: 32768
Kernel command line: rd_start=0x802d7000 rd_size=2663940 console=ttyS0 init=/bin/sh
...

やっぱり、mips_bios.bin が無いって言われてるなぁ。
u-boot をコンパイルすればいいのかな...

2009年5月26日火曜日

What Emacs Commands Do You Use Most and Find Most Useful

http://www.reddit.com/r/programming/comments/8lfx7/what_emacs_commands_do_you_use_most_and_find_most/

M-x align
コードを揃える努力は好きじゃないし、必要もないと思うけど、
回りのコードが揃ってたりすると、見た目を気にして揃えちゃうからなぁ

M-x align

and

M-x align-regexp

Select a bunch of lines like:

int a=1;
float b=2;
char *c="hello";

"M-x align" will turn it into

int    a = 1;
float b = 2;
char *c = "hello";
M-x eshell
M-x shell は常用してるけど、eshellなんてのもあるんだ、vi動くんだw
M-x term なんてのもあったっけ...

emacs22 default日本語環境

OpenBSDにskkを入れるほど根性無いし、
emacs22だと set-input-method "japanese" で kcc 使って日本語入力出来ちゃうので
kccをskkっぽくして、しのぐことにする...中途半端だけどw


(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(set-buffer-file-coding-system 'utf-8-unix)

;; change quail + kkc keybind like skk
(global-set-key "\C-xj" `toggle-input-method)

(defun my-kcc-mode-act-hook ()
;; nn を ん に変換する。
(setq quail-japanese-use-double-n t)

;; 変換中のCtrl-gで変換をキャンセル
(define-key kkc-keymap "\C-g" 'kkc-cancel)

(defun my-kanji-mode ()
(interactive)
(set-input-method "japanese")
)
(defun my-ascii-mode ()
(interactive)
(set-input-method "japanese-ascii")
)
(defun my-katakana-mode ()
(interactive)
(set-input-method "japanese-katakana")
)
(local-set-key "\C-l" 'my-ascii-mode)
(local-set-key "\C-q" 'my-katakana-mode)
(local-set-key "\C-j" 'my-kanji-mode)
)

(defun my-kcc-mode-inact-hook ()
(local-unset-key "\C-l")
(local-unset-key "\C-q")
(local-unset-key "\C-j")
)

(add-hook 'input-method-activate-hook 'my-kcc-mode-act-hook)
(add-hook 'input-method-inactivate-hook 'my-kcc-mode-inact-hook)

2009年5月17日日曜日

Gentoo sys-fs/fuse

emerge --update --deep world したら、

>>> Failed to emerge sys-fs/fuse-2.7.4, Log file:

>>> '/var/tmp/portage/sys-fs/fuse-2.7.4/temp/build.log'

* Messages for package sys-fs/fuse-2.7.4:

* You need to build the FUSE module from the kernel source, because your kernel is too new
* Please check to make sure these options are set correctly.
* Failure to do so may cause unexpected problems.
* Once you have satisfied these options, please try merging
* this package again.

kernelのオプションで、
File systems -> FUSE (Filesystem in Userspace) support
を有効にしないといけないみたい。

make menuconfig でオプション付けて
make && make modules_install
make install
して、再起動してやり直し