2007年10月31日水曜日

....

会ったことも無く当然私などを知っているはずは無いが、おこがましくも尊敬する itojun さんが亡くなられたとのおはなし。自身の語彙不足を今更ながら恨めしく....心からのご冥福をお祈りします。

2007年10月30日火曜日

using lguest - 2

ちょっと使えるようになるまで、また jot。
/opt/lguest# mount -t ext3 -o loop FW1.img tmp
/opt/lguest# chroot tmp
/# apt-get install udev iproute less
Reading package lists... Done
Building dependency tree... Done
....
/# cat >> /etc/fstab
proc /proc proc defaults 0 0
/dev/lgba / ext3 defaults,errors=remount-ro 0 1
/dev/lgbb none swap sw 0 0
/# cat > /etc/resolv.conf
nameserver 192.168.0.3
/# cat >> /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.3
/#
/# cat > /etc/hostname
fw1
/# exit
/opt/lguest# dd if=/dev/zero of=FW1.swap bs=1 count=1 seek=$((1024 * 1024 * 128 - 1))
1+0 records in
1+0 records out1+0 records in
1+0 records out
1 byte (1 B) copied, 0.000128516 seconds, 7.8 kB/s
/opt/lguest# mkswap FW1.swap
Setting up swapspace version 1, size = 134213 kB
no label, UUID=69713635-6d63-4cd9-b0da-96d1eb7fe561
/opt/lguest# brctl addbr br0
/opt/lguest# ip addr add 192.168.0.3/24 dev br0
/opt/lguest# ip link set br0 up
/opt/lguest# umount tmp
/opt/lguest# ./lguest 64m /usr/src/stable/vmlinux --block=FW1.img --block=FW1.swap root=/dev/lgba --tunnet=bridge:br0
....
Debian GNU/Linux lenny/sid fw1 /dev/hvc0

fw1 login: root
Last login: Tue Oct 30 14:08:48 UTC 2007 on hvc0
Linux fw1 2.6.23.1 #1 Wed Oct 17 13:58:03 JST 2007 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
fw1:~#
fw1:~# ping -c3 192.168.0.3
PING 192.168.0.3 (192.168.0.3) 56(84) bytes of data.
64 bytes from 192.168.0.3: icmp_seq=1 ttl=64 time=7.64 ms
64 bytes from 192.168.0.3: icmp_seq=2 ttl=64 time=0.266 ms
64 bytes from 192.168.0.3: icmp_seq=3 ttl=64 time=0.262 ms

--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.262/2.724/7.644/3.478 ms
fw1:~# mount
/dev/lgba on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fw1:~# swapon -s
Filename Type Size Used Priority
/dev/lgbb partition 131064 0 -1
fw1:~# apt-get update
Get:1 http://ring.asahi-net.or.jp lenny Release.gpg [189B]
Hit http://ring.asahi-net.or.jp lenny Release
Get:2 http://ring.asahi-net.or.jp lenny/main Packages/DiffIndex [2038B]
Fetched 2227B in 2s (989B/s)
Reading package lists... Done
fw1:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
fw1:~# apt-get install ssh deborphan
....
fw1:~# useradd -d /home/chamaken -G users chamaken -m
fw1:~# passwd chamaken
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
fw1:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/lgba 2.0G 266M 1.7G 14% /
tmpfs 30M 0 30M 0% /lib/init/rw
udev 10M 20K 10M 1% /dev
tmpfs 30M 4.0K 30M 1% /dev/shm
fw1:~# shutdown -h now
Saving the system clock..
hwclock[1215] general protection eip:804aacb esp:bff53fc4 error:0
/etc/rc0.d/K25hwclock.sh: line 48: 1215 Segmentation fault /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR
....
lguest: CRASH: Power down
と、まぁまぁ使えるようになりましたっと。``さて'' という字は尻へんに長いと書く。と言っているおじさんがいました。

2007年10月22日月曜日

rtl8187 動作せず...

やっぱりダメらしい。
~# cat /sys/bus/usb/devices/2-2/product
NETGEAR WG111v3
Web 探してみると v2 で asic_rev = 1。更に rf_init = rtl8225z2_rf_init っぽかったのでベタで試してみたところ、ウンとは言うがスンとは言わず。といった感じ。 zd1211rw も bcm43xx も mac802.11 じゃないけど、この辺り使うしか無いのかしら....

madwifi も方向転換で HAL 使わなくなって、以前のものから仕切り直しっぽい。そうそう svn のリポジトリ が再構成 Repository restructured ¶ だそうだ。stable は svn switch http://svn.madwifi.org/madwifi/trunk だそうだ。

using lguest - 1

とりあえずの起動までを、ちょっと jot。
/opt/lguest# dd if=/dev/zero of=FW1.img bs=1 count=1 seek=$((1024 * 1024 * 1024 * 2 - 1))
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.000126002 seconds, 7.9 kB/s
/opt/lguest# ls -l
total 16
-rw-r--r-- 1 root root 2147483648 2007-10-22 20:28 FW1.img
/opt/lguest# mkfs.ext3 FW1.img
mke2fs 1.40-WIP (14-Nov-2006)
FW1.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
....snip....
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
/opt/lguest# mkdir tmp
/opt/lguest# mount -t ext3 -o loop FW1.img tmp
/opt/lguest# debootstrap --arch i386 lenny tmp http://ring.asahi-net.or.jp/archives/linux/debian/debian
I: Retrieving Release
....snip....
I: Base system installed successfully.
/opt/lguest# chroot tmp
/# cp /etc/inittab oldtab
/# vi /etc/inittab
....
/# diff -ubB oldtab /etc/inittab
--- oldtab 2007-10-22 11:54:48.000000000 +0000
+++ /etc/inittab 2007-10-22 11:54:12.000000000 +0000
@@ -51,12 +51,12 @@
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
-1:2345:respawn:/sbin/getty 38400 tty1
-2:23:respawn:/sbin/getty 38400 tty2
-3:23:respawn:/sbin/getty 38400 tty3
-4:23:respawn:/sbin/getty 38400 tty4
-5:23:respawn:/sbin/getty 38400 tty5
-6:23:respawn:/sbin/getty 38400 tty6
+1:2345:respawn:/sbin/getty 38400 /dev/hvc0
+#2:23:respawn:/sbin/getty 38400 tty2
+#3:23:respawn:/sbin/getty 38400 tty3
+#4:23:respawn:/sbin/getty 38400 tty4
+#5:23:respawn:/sbin/getty 38400 tty5
+#6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
/# cat >> /etc/securetty

# lguest console
hvc0
/# mknod /dev/hvc0 c 229 0
/# exit
exit
/opt/lguest# umount tmp
/opt/lguest# cd /usr/src/stable/Documentation/lguest/
/usr/src/stable/Documentation/lguest# make
cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds -static lguest.c -lz -o lguest
/usr/src/stable/Documentation/lguest# cp lguest /opt/lguest/
/usr/src/stable/Documentation/lguest# cd !$
cd /opt/lguest/
/opt/lguest# modprobe lg
/opt/lguest# ./lguest 64m /usr/src/stable/vmlinux --block=FW1.img root=/dev/lgba
いや、実のところ、途中途中しくじっているけどね。

2007年10月15日月曜日

The Art of UNIX Programming

出版当初に原著を購入したのだが、難かしい英語 --- えぇ勿論私にとって --- だったので、ものの数ページで挫折したのだが.... The Art of UNIX Programming おぉ和訳。と早速購入。訳云々は全くわかっていないのだが、原著読める方はもちろん、どうも読んでおくべき本。もう一冊 Linux System Programming も購入。Robert Love さん著は以前の Linux Kernel Development が大変良くできた内容だった。にしても Programming って、してない気がする。

swatch

仕事で swatch を使ってみた。root 権限のないホストだったので、まぁ適当にホームディレクトリに各種パッケージをインストールして。って感じ。で .swatchrc を書くのだが、適当にスペースで区切られたフィールドを行として扱う正規表現が
percodemy $prefix = "(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+).*";
なんてあまりにも....仕組としては .swatchrc から .swatch_script.$$ みたいなスクリプトを作成して、これを実行するようなので、眺めてみると
LOOP: while (defined($_=$File->read)) {

chomp;
my $S_ = $_;
@_ = split;

### quote all special shell chars ###
$S_ =~ s/([;&\(\)\|\^><\$`'\\])/\\$1/g;
my @S_ = split(/\s+/, $S_);
....
反則かもしれないけど、この @S_ を使うと便利ってただそれだけ。あっ、もう一点。--extra-moduleで指定したら、先の swatch_script.$$ でも use lib 'extra-modeule' してくれると嬉しいカモ。

2007年10月1日月曜日

LSRR with nuttcp その 2

遅すぎる LSRR 付けた nuttcp だが TSO (tcp segmentation offload) をオフとすると、それなりになった。tcpdump 追いかけると MSS が 1440 の所、何かのタイミングで丁度倍 2880 というサイズのパケットを送出して、もちろんロス。が原因っぽい。ハードウェア絡みなのかカーネルの話なのか不明。ちなみに NIC は x86_64上の
01:03.0 Ethernet controller: Intel Corporation 82541EI Gigabit Ethernet Controller (Copper)
Subsystem: Intel Corporation PRO/1000 MT Network Connection
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 18
Memory at fc9c0000 (32-bit, non-prefetchable) [size=128K]
Memory at fc9a0000 (32-bit, non-prefetchable) [size=128K]
I/O ports at 9880 [size=64]
Expansion ROM at fc980000 [disabled] [size=128K]
Capabilities: [dc] Power Management version 2
Capabilities: [e4] PCI-X non-bridge device

rtl8187 動作せず...

iwconfig iwlist でソレナリの表示はされるものの
~# ip link set wlan0 up
~# dmesg | tail -n2
phy0: RF Calibration Failed! 0
ADDRCONF(NETDEV_UP): wlan0: link is not ready

~# ip link ls
....
5: wmaster0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc ieee80211 qlen 1000
link/ieee802.11 00:1b:2f:be:42:5c brd ff:ff:ff:ff:ff:ff
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:1b:2f:be:42:5c brd ff:ff:ff:ff:ff:ff
Monitor モードは可だが、Master モードは INVALID。の前に、デバイスのランプが点灯せず、動作していなさげ。む〜ん....