2011年4月23日土曜日

オレオレ証明書の証明書更新

完全なる備忘録。プロバイダから付与された IP アドレス間でトランスペアレントモード
IPSec するにあたって racoon を certificate_type x509 で動かしているんだけど、この
証明書の更新、および更新方法を都度忘れて調べ直すので、ここにメモ。CRL のハッシュ
がわからず「証明書を取り扱う」を多々参考にさせてもらいました。ありがとうございます
CSR の作成
openssl req -new -keyout server_key.pem -out server_csr.pem -nodes

オレオレ CA で sigh
openssl ca -config /etc/ssl/openssl.cnf -in server_csr.pem -out server_cert.pem

CRL の発行
openssl ca -config /etc/ssl/openssl.cnf -gencrl -out crl.pem

証明書のハッシュ
ln -s server_cert.pem `openssl x509 -in server_cert.pem -noout -hash`.0

CRL のハッシュ
ln -s crl.pem `openssl crl -in crl.pem -noout -hash`.r0

おまけ。確認方法とか
テキスト出力
openssl x509 -in csr.pem -text

verify
openssl verify -CAfile ca.pem csr.pem

nodes 付け忘れ
openssl rsa -in server_key.pem -out server_nodes_key.pem

port mirror on linux

だいぶ以前にここに書いたと思ったら、書いていなかった... のでメモ。
実際に使える例ではないけれど、例えば wlan0 を dummy 0 にミラーするのであれば
root になって長いコマンド。wlan0 からの出ていく方は
# tc qdisc add dev wlan0 root handle 10: prio
# tc filter add dev wlan0 parent 10: prio 10 \
> protocol all u32 match u32 0 0 flowid 10:1 \
> action mirred egress mirror dev dummy0
disc prio を wlan0 の最初 (root) として 10 という ID 割り当て。
その 10 を親として 10番という順番で u32 すべてマッチのフィルタを追加。
結果は 10:1 に流すけど 10:1 という qdisc はないのでデフォルト何もせず。
アクションとして dummy0 にミラーを送出。確認は
# tc qdisc ls dev wlan0
qdisc prio 10: root refcnt 5 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
# tc filter ls dev wlan0 handle 10:
filter parent 10: protocol all pref 10 u32 
filter parent 10: protocol all pref 10 u32 fh 800: ht divisor 1 
filter parent 10: protocol all pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:1 
  match 00000000/00000000 at 0
 action order 1: mirred (Egress Mirror to device dummy0) pipe
  index 1 ref 1 bind 1
wlan0 に入ってくる方は
# tc qdisc add dev wlan0 ingress
# tc filter add dev wlan0 parent ffff: prio 10 \
> protocol all u32 match u32 0 0 flowid ffff:1 \
> action mirred egress mirror dev dummy0
こちら ingress は ID が ffff と決まっている他は、入ってくる方と同じ。確認は
# tc qdisc ls dev wlan0 ingress
qdisc prio 10: root refcnt 5 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc ingress ffff: parent ffff:fff1 ---------------- 
# tc filter ls dev wlan0 handle ffff:
filter protocol all pref 10 u32 
filter protocol all pref 10 u32 fh 800: ht divisor 1 
filter protocol all pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid ffff:1 
  match 00000000/00000000 at 0
 action order 1: mirred (Egress Mirror to device dummy0) pipe
  index 2 ref 1 bind 1
これで wlan0 を promisc モードにして dummy0 で tcpdump
#  ip link set wlan0 promisc on
# tcpdump -nevxi dummy0
とか。ドキュメントとして iproute-doc にも含まれていないのでソースを
apt-get source iproute
とか
git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
とかで持ってきた $SRC/doc/actions/mirred-usage を参照。iproute 全般はで、以下その mirred-usage の抜粋意訳、中途訳


普通のイーサネットスイッチでのミラーやリダイレクトの違いは u32 フィ
ルタ (classifier) でミラーするフローを選択できること。

mirred アクションの使い方:
    mirred <DIRECTION> <ACTION> [index INDEX] <dev DEVICENAME>
        DIRECTION := ingreee か egress
        ACTION    := mirror か redirect
        INDEX は特定のポリシ ID
        DEVICENAME はデバイス名

ACTION - mirror はコピーを指定されたデバイスに送る
ACTION - redirect はパケットを横取りして指定されたデバイスに送る
         (なのでローカルプロセスには渡らない)

* 禁止事項
  A. ループさせない 
      eth0 を eth1 にリダイレクト。更に eth1 を eth0 にリダイレクトなど
  B. IFB デバイスから別の IFB デバイスにリダイレクトしない
      ホストはクラッシュしないけどパケット全てが drop される

  A は再帰によるデバイスキューのロック輻輳。
  B は送信ロック (の輻輳?)


---- サンプル

1. eth0 に入ってくるパケットを eth1 にミラー

       # tc qdisc add dev eth0 ingress
       # tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 \
       >    match u32 0 0 flowid 1:2 action mirred egress mirror dev eth1

   mirror を redirect に変えるとコピーせずオリジナルパケットを eth1
   に送出する


2. lo から eth0 に横取り
   lo の ingress に届く全てのパケットを eth0 にリダイレクト

       # tc qdisc add dev lo ingress
       # tc filter add dev lo parent ffff: protocol ip prio 10 u32 \
       >    match u32 0 0 flowid 1:2 action mirred egress redirect dev eth0

   この設定をしたホストで ping -c 127.0.0.1 としても失敗する。
   eth0 の先に接続したホストで tcpdump してみると...
   XXX
   このフィルタ内 redirect を mirror に置き換えて

       # tc filter add dev lo parent ffff: protocol ip u32 \
       >    match u32 0 0 flowid 1:2 action mirred egress mirror dev eth0

   とすると tc 設定をしたホストと、この eth0 の先にある両方のホスト
   で、パケットを見ることができる。つまりは ping が成功する


3. もうちょっとイカしたサンプル
   lo の ingress にて 10個の内 1個のパケットがランダムに別ホストへ
   --- eth0 へ --- 送る (ランダムは netrand generator を使う)
   XXX: action drop --- 少し違う気がする...

       # tc filter add dev lo parent ffff: protocol ip prio 10 u32 \
       >    match u32 0 0 flowid 1:2 \
       >    action drop random determ ok 10
       >    action mirred egress mirror dev eth0


4. 10.0.0.9 から来て eth0 に出ていくパケット
   (ローカルの IP か forwarding するか)
   が 100Kbps を超えると eth1 にリダイレクト

       # tc qdisc add dev eth0 handle 1:0 root prio
       # tc filter add dev eth0 parent 1:0 protocol ip prio 6 u32 \
       >    match ip src 10.0.0.9/32 flowid 1:16 \
       >    action police rate 100kbit burst 90 ok \
       >    action mirred egress mirror dev eth1

5. もっと面白いサンプルとしてフローを (デフォルト全て drop する)
   dummy デバイスにミラーして tcpdump

   192.168.200.200/32 からのパケットをポリシングして、この送出が
   100Kbps を超えてほしくないとか

       # tc qdisc add dev eth0 handle 1:0 root prio
       # tc filter add dev eth0 pareht 1: protocol ip prio 10 u32 \
       >    match ip src 192.168.200.200/32 flowid 1:2 \
       >    action police rate 100kbit burst 90 drop

   eth0 で tcpdump を実行すると 192.168.200.200/32 からのパケット送
   出がドロップされようと、されまいと全て見ることができる (tcpdump
   は egress される全てのパケットを見せるから)。ルールを少しだけ拡張
   して make out したパケットを見るためには

       # tc qdisc add dev eth0 handler 1:0 root prio
       # tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \
       >    match ip src 192.168.200.200/32 flowid 1:2 \
       >    action police rate 100kbit burst 90 drop \
       >    action mirred egress mirror dev dummy0

   dummy0 で tcpdump を動かして、make out されたパケットだけを見る

       # tcpdump -n -i dummy0 -x -e -t

   mirror を redirect に置き換えると、これらパケットは XXX 一切 make
   out できなくなる

2011年4月18日月曜日

obs600-tools.deb # utils の方が良かった?

obs600 で debian squeeze の続編。deb パッケージにない
  • flashcfg
  • runled
  • pshd
をやっつけ deb パッケージ化。

バイナリはこんなイメージ


ソースはこんなイメージ


SSDLinux のソースから autotools 環境作成のスクリプトと言うかコマンド列挙は
こんなイメージ


zlib1g zlib1g-dev が必要なのでそれぞれ powerpc のdeb バイナリ
  • zlib1g_1.2.3.4.dfsg-3_powerpc.deb
  • zlib1g-dev_1.2.3.4.dfsg-3_powerpc.deb
を持ってきて
$ dpkg-cross --build --arch powerpc *.deb
とするんだけど、バージョン上がった場合の確認が面倒。
apt-cross というツールはなくなってしまい、pdebuild-cross は使い方わからず...

2011年4月16日土曜日

softdog / CONFIG_WATCHDOG_NOWAYOUT - 勘違い

nowayout と Magic Close の関係を思いっきり勘違い。先日のエントリでは
何とでも読み取り可。nowayout 指定しても Magic Close はできると思い込
んでた。が、nowayout の方が強いと言うか、nowayout を指定してしまうと
Magic Close すらできない。

drivers/watchdog/softdog.c の中 MODULE_PARM で探すと
soft_margin: int
Watchdog soft_margin in seconds.
(0 < soft_margin < 65536, default=60)
 
nowayout: int
Watchdog cannot be stopped once started
(default= [config WATCHDOG_NOWAYOUT?])
 
soft_noboot: int
Softdog action, set to 1 to ignore reboots, 0 to reboot
noboot でテスト。watchdog プログラムはこんなんに swd.sh と命名して
#!/bin/sh

exec 3> /dev/watchdog
trap "echo 'send V'; echo -n V >&3; exit 0" INT

while :; do
    echo >&3
    sleep 4
done
SIG_INT で止められたら Magic Close。root になってまずは nowayout なし
で Magic Close の場合は
# modprobe softdog soft_margin=10 nowayout=0 soft_noboot=1 # ./swd.sh ^Csend V (しばらく待った後に Ctrl-c) # dmesg | tail ... [ 3010.493992] Software Watchdog Timer: 0.07 initialized. soft_noboot=1 soft_margin=10 sec (nowayout= 0)
Magic Close しない場合は (rmmod しないで引き続き)
# ./swd.sh 
^Z (Ctrl-z)
[1]+  Stopped                 ./swd.sh
# (しばらく - soft_margin で指定した10 秒以上待つ)
# dmesg | tail
...
[ 3010.493992] Software Watchdog Timer: 0.07 initialized. 
    soft_noboot=1 soft_margin=10 sec (nowayout= 0)
[ 3241.819563] SoftDog: Triggered - Reboot ignored.
リブートだけど soft_noboot 指定したのでメッセージだけ。/dev/watchdog
が開きっぱになっているので、続けて
# fg
./swd.sh
^Csend V (Ctrl-c)
# rmmod softdog
次に nowayout 指定すると
# modprobe softdog soft_margin=10 nowayout=1 soft_noboot=1
# ./swd.sh 
^Csend V (Ctrl-c)
# (10 秒以上待って)
# dmesg | tail
...
[ 3757.016487] Software Watchdog Timer: 0.07 initialized. 
    soft_noboot=1 soft_margin=10 sec (nowayout= 1)
[ 3811.572991] SoftDog: Unexpected close, not stopping watchdog!
[ 3821.580111] SoftDog: Triggered - Reboot ignored.
'V' を /dev/watchdog に送ったけどリブート。で最初の通り nowayout 指定
すると Magic Close も何のその。書き込みなくば再起動という結果。

とってもシンプルだけど先の swd.sh は
nohup ./swd.sh > /var/log/watchdog.log 2>&1 &
でソレナリには動くらしい。nowayout 指定せず Magic Close 使ってリブート
せずの停止は
# killall -INT swd.sh
# cat /var/log/swd.log
nohup: ignoring input
send V

2011年4月13日水曜日

PIL で bin2png - その 2

昔? telnet しか許されていないホストで base64 したバイナリをコピペしたこと
思い出した...鶏卵、ブートストラップ。ソレやるか? で昨日の
> 超てきとーいいかげんにパディング
を貼り付けた結果、ながいブログエントリぃー。pack / unpack の使い方もわかっ
てないし、ムダな事ばっかじゃん。と思った方は是非メンテしてやってください。
コピペして bin2png.py とかで保存した後は、こちらも昨日のイメージを保存して
$ ./bin2png.py -d patch-2.6.38.2.gz.png -o patch-2.6.38.2.gz
とかで。
サイズ大きいファイルはシャレになりませんが、ブログに貼り付ける程度なら...
#!/usr/bin/python

import sys, os, math, struct
import getopt, logging
import Image

log = logging.getLogger()

def sqrint(n):
    r = math.ceil(math.sqrt(n) + 0.1)
    return (int(r), int(math.pow(r, 2) - n))


def encode(srcfp, dstfp):
    # calc sizes
    fsize = os.fstat(srcfp.fileno()).st_size
    log.debug("encode size: %d" % fsize)
    qfsize = fsize / 4
    sides, padlen = sqrint(qfsize)
    tupad = struct.unpack('BBBB', struct.pack('!L', fsize))

    # create data
    data = [tupad]
    for i in range(qfsize):
        data.append(struct.unpack('BBBB', srcfp.read(4)))
    nremain = fsize % 4
    data.append(struct.unpack('BBBB', srcfp.read(nremain) + '\x00' * (4 - nremain)))
    data.extend(((0, 0, 0, 0),) * (padlen / 4 - 1))

    # write out
    im = Image.new('RGBA', (sides, sides))
    im.putdata(data)
    im.save(dstfp, 'PNG')


def decode(srcfp, dstfp):
    im = Image.open(srcfp)
    imgcore = im.getdata() # needs checking mode?
    fsize = struct.unpack("!L", struct.pack("BBBB", *imgcore[0]))[0]
    log.debug("decode size: %d" % fsize)

    data = list(imgcore)[1:]
    b = bytearray()
    [b.extend(d) for d in data]
    dstfp.write(b[:fsize])


def usage():
    print >> sys.stderr, '''%s - convert file to png image
  -e | --encode          specify encoding file 
  -d | --decode          specify decoding file
  -o | --outfile         stdout if not specified
  -h | --help            show (this) usage message
  -v | --verbose         set logging level to DEBUG [default is INFO]
''' % sys.argv[0]

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'e:d:o:hv',
                                   ['encode', 'decode', 'outfile', 
                                    'help', 'verbose'])
    except getopt.GetoptError, err:
        log.error(err)
        usage()
        sys.exit(2)

    isencode = False
    isdecode = False
    srcfp = None
    # 3.0: dstfp = sys.stdout.buffer?
    dstfp = os.fdopen(sys.stdout.fileno(), 'wb')

    for o, a in opts:
        if o in ("-h", "--help"):
            usage()
            sys.exit(0)
        elif o in ("-v", "--verbose"):
            log.setLevel(logging.DEBUG)
        elif o in ("-e", "--encode"):
            isencode = True
            srcfp = file(a, 'rb')
        elif o in ("-d", "--decode"):
            isdecode = True
            srcfp = file(a, 'rb')
        elif o in ("-o", "--outfile"):
            dstfp = file(a, 'wb')

    if not (isencode ^ isdecode):
        log.error("invalid action")
        usage()
        sys.exit(1)

    isencode and encode(srcfp, dstfp)
    isdecode and decode(srcfp, dstfp)


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s %(levelname)s %(message)s')
    main()

PIL で bin2png

ちょっと驚き... こちら blogger 然りでバイナリデータをブログに載せたい時って
どうすれば良いやら。長いテキストとかであれば a2ps | enscript で PostScript
にした後 ps2pdf とか。で PDF がアップロードできるか知らないし、やっぱイメー
ジデータでしょう。

と探すもステガノグラフィ (outguess steghide snowdrop) まで凝った話でもなく、
サイズも大きくなるし a2png だって? と試すもそのまま a2ps の png 版だったり。
sourceforge にあるも Java だったり...

むーん libpng とか使って自作? とか思い始めたところ # 長い前置き
Python Imaging Library (PIL) のハンドブック眺めてみたところ、ソレらしきメソ
ッドが。でお試し
$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> fname = "patch-2.6.38.2.gz"
>>> import os
>>> os.stat(fname).st_size
52847
>>> f = open(fname)
>>> b = bytearray()
>>> b.extend(f.read())
>>> len(b)
52847
>>> import Image
>>> im = Image.new('L', (52847, 1))
>>> im.putdata(b)
>>> im.save("2.6.38.2.png")
>>> (Ctrl-D)
$ ls -l 2.6.38.2.png 
-rw-r--r-- 1 chamaken chamaken 52921 2011-04-12 23:35 2.6.38.2.png
PNG フォーマットとか全く知らないので new() のモードわからないし、最大約数を
探すのも面倒がってサイズもおかしいど、もちろん可逆で
$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
>>> im = Image.open("2.6.38.2.png")
>>> f = open("write.back", 'wb')
>>> f.write(bytearray(im.getdata()))
>>> f.close()
>>> (Ctrl-d)
$ cmp patch-2.6.38.2.gz write.back 
$ 
おどろいた。この 2.6.38.2.png を貼ると大変なことになりそうなので超てきとー
いいかげんにパディングしたものを貼ってみるテスト

2011年4月7日木曜日

obs600 で 再度 debian squeeze - その 3 - で一段落

お待ちかね。OBS600 側
  • CF 積んで
  • ETHER-0 に UTP ケーブル接続して
  • INIT ボタンをボールペンで押さえて
電源投入。ちなみに手元にあるのは 8G の CF。root でログインした後
  1. パーティション分割 & ファイルシステム作成
  2. 8G を 6G / 2G に分割。冗長だけど全部
    # fdisk /dev/sda
    
    Command (m for help): p
    
    Disk /dev/sda: 8019 MB, 8019099648 bytes
    247 heads, 62 sectors/track, 1022 cylinders
    Units = cylinders of 15314 * 512 = 7840768 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-1022, default 1):
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-1022, default 1022): +6144M
    
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 2
    First cylinder (786-1022, default 786):
    Using default value 786
    Last cylinder or +size or +sizeM or +sizeK (786-1022, default 1022):
    Using default value 1022
    
    Command (m for help): p
    
    Disk /dev/sda: 8019 MB, 8019099648 bytes
    247 heads, 62 sectors/track, 1022 cylinders
    Units = cylinders of 15314 * 512 = 7840768 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1         785     6010714   83  Linux
    /dev/sda2             786        1022     1814709   83  Linux
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    sd 0:0:0:0: [sda] 15662304 512-byte hardware sectors: (8.01 GB/7.46 GiB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] Assuming drive cache: write through
     sda: sda1 sda2
    sd 0:0:0:0: [sda] 15662304 512-byte hardware sectors: (8.01 GB/7.46 GiB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] Assuming drive cache: write through
     sda: sda1 sda2
    Syncing disks.
    # mke2fs -j -b 4096 -L / /dev/sda1
    mke2fs 1.39 (29-May-2006)
    Filesystem label=/
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    752192 inodes, 1502678 blocks
    75133 blocks (5.00%) reserved for the super user
    First data block=0
    46 block groups
    32768 blocks per group, 32768 fragments per group
    16352 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736
    
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 28 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    
  3. マウント & ファイル取得準備
  4. # mount /dev/sda1 /mnt
    kjournald starting.  Commit interval 5 seconds
    EXT3 FS on sda1, internal journal
    EXT3-fs: mounted filesystem with ordered data mode.
    # ip link ls eth0
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
    state UP qlen 1000
        link/ether 00:1a:88:0c3:12:bb brd ff:ff:ff:ff:ff:ff
        inet 192.168.253.254/24 brd 192.168.253.255 scope global eth0
    
    # ping -c 4 192.168.253.1
    PING 192.168.253.1 (192.168.253.1): 56 octets data
    64 octets from 192.168.253.1: icmp_seq=0 ttl=64 time=2.2 ms
    64 octets from 192.168.253.1: icmp_seq=1 ttl=64 time=0.3 ms
    64 octets from 192.168.253.1: icmp_seq=2 ttl=64 time=0.3 ms
    64 octets from 192.168.253.1: icmp_seq=3 ttl=64 time=0.3 ms
    
    --- 192.168.253.1 ping statistics ---
    4 packets transmitted, 4 packets received, 0% packet loss
    round-trip min/avg/max = 0.3/0.7/2.2 ms
    
  5. 開発機側のファイルツリーをごっそり取得
  6. (長いコマンドライン)
    # ssh chamaken@192.168.253.1 \
    > "cd ~/obs600/rootfs && tar -cp --numeric-owner -f - *" \
    > | tar -xpv --numeric-owner -f - -C /mnt
    The authenticity of host '192.168.253.1 (192.168.253.1)' can't be established.
    RSA key fingerprint is d1:72:98:8b:42:11:e6:a6:7b:c8:6f:8b:95:ba:a3:a8.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.253.1' (RSA) to the list of known hosts.
    Password:
    ...
    var/cache/debconf/
    var/spool/
    
  7. チルっと
  8. # chroot /mnt
    I have no name!@ssd-linux:/# ls -1
    bin
    boot
    debootstrap
    dev
    etc
    home
    lib
    lib64
    lost+found
    mnt
    proc
    sbin
    selinux
    sys
    tmp
    usr
    var
    I have no name!@ssd-linux:/# cd /debootstrap
    I have no name!@ssd-linux:/debootstrap# ./debootstrap --second-stage
    I: Installing core packages...
    ...
    I: Base system installed successfully.
    I have no name!@ssd-linux:/debootstrap#
    
  9. /uImage.initrd-cfboot の作成
  10. I have no name!@ssd-linux:/debootstrap# cd
    I have no name!@ssd-linux:~# ls -1
    linux-image-2.6.32_0.91_powerpc.deb
    obs600.dtb
    vmlinux.bin.gz
    
    いろいろ叱られるし、長いけど
    I have no name!@ssd-linux:~# dpkg -i linux-image-2.6.32_0.91_powerpc.deb
    Selecting previously deselected package linux-image-2.6.32.
    (Reading database ... 9174 files and directories currently installed.)
    Unpacking linux-image-2.6.32 (from linux-image-2.6.32_0.91_powerpc.deb) ...
    Done.
    Setting up linux-image-2.6.32 (0.91) ...
    
     Hmm. There is a symbolic link /lib/modules/2.6.32/build
     However, I can not read it: No such file or directory
     Therefore, I am deleting /lib/modules/2.6.32/build
    
    
     Hmm. The package shipped with a symbolic link /lib/modules/2.6.32/source
     However, I can not read the target: No such file or directory
     Therefore, I am deleting /lib/modules/2.6.32/source
    
    Running depmod.
    Examining /etc/kernel/postinst.d.
    run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32
    /boot/vmlinux-2.6.32
    update-initramfs: Generating /boot/initrd.img-2.6.32
    df: Warning: cannot read table of mounted file systems: No such file
    or directory
    warning: can't open /etc/mtab: No such file or directory
    warning: can't open /etc/mtab: No such file or directory
    I have no name!@ssd-linux:~#
    
    また長いコマンドライン。くどいけど参照
    • $SSDSRC/usr/src/contrib/debootstrap/post-debootstrap
    • $SSDSRC/usr/src/contrib/developers/kimura/lenny_based_firmware/uimage/create_uImage.sh
    I have no name!@ssd-linux:~# mkimage -n "original.$(date +'%FT%T')" \
    > -A ppc -O linux -T multi -C gzip \
    > -d vmlinux.bin.gz:/boot/initrd.img-2.6.32:obs600.dtb \
    > /uImage.initrd-cfboot
    Image Name:   original.2011-04-01T12:34:56
    Created:      Tue Apr  1 12:34:56 2011
    Image Type:   PowerPC Linux Multi-File Image (gzip compressed)
    Data Size:    3847277 Bytes = 3757.11 kB = 3.67 MB
    Load Address: 00000000
    Entry Point:  00000000
    Contents:
       Image 0: 1925764 Bytes = 1880.63 kB = 1.84 MB
       Image 1: 1913443 Bytes = 1868.60 kB = 1.82 MB
       Image 2: 8053 Bytes = 7.86 kB = 0.01 MB
    I have no name!@ssd-linux:~#
    
  11. 普通の? 必須修正
  12. I have no name!@ssd-linux:~# passwd
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    I have no name!@ssd-linux:~# cd /etc
    I have no name!@ssd-linux:/etc# cp inittab inittab.dpkg-dist
    I have no name!@ssd-linux:/etc# vi inittab
    ...
    I have no name!@ssd-linux:/etc# diff -uw inittab.dpkg-dist inittab
    --- inittab.dpkg-dist   2011-03-31 12:34:56.000000000 +0000
    +++ inittab     2011-03-31 12:34:56.000000000 +0000
    @@ -51,16 +51,16 @@
     # 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 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
    
     # Example how to put a getty on a serial line (for a terminal)
     #
    -#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
    +T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
     #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
    
     # Example how to put a getty on a modem line.
    I have no name!@ssd-linux:/etc#
    
    そのほか /etc/hostname や /etc/network/interfaces など
    必要に応じて作成、変更 - in debian's way で

  13. オリジナルツールのコピー
  14. 後でやっつけパッケージ作るけど、とり急ぎ
    I have no name!@ssd-linux:/etc# exit
    # cd /usr/sbin
    # cp flashcfg runled pshd /mnt/usr/sbin/
    
  15. CF ブートとしてリブート
  16. # flashcfg -h
    usage: flashcfg                 Show this.
           flashcfg -b              Show current boot setting
           flashcfg -c rootdev      Change root file system [initrd|cf|sda-sdd[1-8]]
                                    initrd       - Boot from FlashROM, / on Ramdisk
                                    sda-sdd[1-8] - Boot from FlashROM, / on CF
                                    cf           - Boot from CF,       / on CF
           flashcfg -f boot_image   Load boot image to flash
           flashcfg -s list_file    Save files to Parameter area
           flashcfg -S list_file    Save files to User area
           flashcfg -x              Restore files from Parameter area
           flashcfg -X              Restore files from User area
           flashcfg -d              Delete saved files from Parameter area
           flashcfg -D              Delete saved files from User area
           flashcfg -E env_file     Save params to U-Boot Environment area
           flashcfg -L env_file     Load params from U-Boot Environment area
           flashcfg -h              Show this.
    # flashcfg -c cf
    # shutdown -r now
    
でけた?