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
    
でけた?

0 件のコメント: