販売終了のお知らせ

SUZAKU シリーズ販売終了のお知らせ > 詳細情報


Howto : ルートファイルシステムにNFSを使う

該当製品:
SZ010-U00
SZ030-U00
SZ130-SIL
SZ130-U00
SZ310-SIL
SZ310-U00
  1. 概要

    ルートファイルシステムをnfs経由でマウントします。ここで説明する環境では3つのシステムがネットワークで繋がっていると仮定します。

    • 開発用 PC (NFSサーバも兼る)

    • DHCPサーバ

    • SUZAKU

    開発用PCが DHCPサーバを行なうことも可能です。開発用PCでDHCPサーバを行なうときには適時読み替えてください。

  2. ダウンロード

    http://download.atmark-techno.com/suzaku/image/rootnfs/ からダウンロードしてください。

    中には以下の3つのファイルが入っています。

    • linux-rootnfs.bin

    • suzaku-rootnfs.tar.gz

    • uClinux-dist-20040408-suzaku3-rootnfs.patch

    linux-rootnfs.binはSUZAKUのFlashメモリに書き込むためのLinuxカーネルイメージファイルです。

    suzaku-rootnfs.tar.gzはルートファイルシステムをtarでまとめ、圧縮したものです。rootユーザで展開する必要があります。

    patchは、カーネルのデフォルト設定ファイル(vendor/AtmarkTechno/SUZAKU/config.linux-2.4.x)を変更します。

  3. 設定とビルド

    カーネル 以下の設定を変更する必要があります。(*が付いているものは有効に、付いていないものは無効にしてください):

    
       General setup
         [*] Compiled-in Kernel Boot Parameter
             Default kernel command string: "root=/dev/nfs"
    
       Memory Technology Devices (MTD)
         Mapping drivers for chip access
         < >  Generic uClinux RAM/ROM filesystem support
    
       Networking options
         [*] TCP/IP networking
         [*] IP: kernel level autoconfiguration
         [*] IP: DHCP support
    
       File systems
         Network File Systems
           <*> NFS file system support
           [*]   Provide NFSv3 client support
           [*]   Root file system on NFS
    

    手動で変更せず、patchを使って変更することも可能です。作業例:

    
       [PC ~]$ tar xzf rootnfs.tar.gz
    [PC ~]$ cd uClinux-dist
    [PC ~/uClinux-dist]$ patch -p1 < ../rootnfs/uClinux-dist-20040408-suzaku3-rootnfs.patch
    [PC ~/uClinux-dist]$ make config
    :
    :

    ビルドするとimages/linux.binができます。image.binではなく、linux.binを使用します。

  4. NFSサーバの設定

    開発用のPCにNFSサーバをインストールしてください。debianの場合:

    
      [PC ~]# apt-get install nfs-kernel-server

    で、installすることができます。

    次に、images/romfs.imgに含まれているファイルをコピーします。すでにイメージファイルになっているため、一度 /mntにマウントしてからコピーします。作業は rootユーザで行なってください。コピー先はどこでも問題ありません。ここでは /srv/exportsを使用します。作業例:

    
      [PC ~]# mkdir -p /srv/exports/suzaku
    [PC ~]# mount -o loop /home/atmark/uClinux-dist/images/romfs.img /mnt
    [PC ~]# cd /mnt
    [PC ~]# tar -c * | (cd /srv/exprots/suzaku; tar xfv -)

    suzaku-rootnfs.tar.gzを使うこともできます。rootユーザで展開してください。便宜上 suzakuというシンボリックリンクも作成します。作業例:

    
      [PC ~]# mkdir -p /srv/exports
      [PC /srv/exports]# tar xzf suzaku-rootnfs.tar.gz
      [PC /srv/exports]# ln -s suzaku-rootnfs suzaku
    

    さて、できあがったディレクトリを /etc/exportsに記述し、反映させます。:

    
      [PC ~]# echo "/srv/exports/suzaku *(rw,no_root_squash,sync)" >> /etc/exports
      [PC ~]# exportsfs -a
      [PC ~]# exportsfs
      /srv/exports/suzaku-rootnfs
                      < world >
    
  5. DHCPサーバの設定

    ここでは、ISC DHCP3を例に説明します。必要な場合はインストールしてください。debianの場合は以下のようにインストールします。作業例:

    
      [Srv ~]# apt-get install dhcp3-server

    DHCP3の設定ファイルは /etc/dhcp3/dhcpd.confです。環境に合せて設定してください。以下サンプル:

    
      option domain-name "local-network";
      option domain-name-servers 192.168.1.1;
      option subnet-mask 255.255.255.0;
    
      default-lease-time 600;
      max-lease-time 7200;
    
      allow bootp;
      not authoritative;
    
      subnet 192.168.1.0 netmask 255.255.255.0 {
              range 192.168.1.100 192.168.1.254;
              option broadcast-address 192.168.1.255;
              option routers 192.168.1.1;
              option subnet-mask 255.255.255.0;
              host suzaku {
                      hardware ethernet 00:11:C0:00:XX:XX;
                      option root-path "192.168.1.xx:/srv/exports/suzaku,v3";
              }
      }
    

    重要な部分は、host suzakuのカッコの中です。"hardware ethernet"の部分には、お使いのSUZAKUの MACアドレスを記入してください。"option root-path"には、開発用PCの IP番号を記入してください。

  6. イメージの書き込み

    SUZAKUに、ビルドしたlinux.binまたはダウンロードしたlinux-rootnfs.binを書き込みます。Netflashが使える状態であればFlashメモリの書き換え(NetFlash)を、hermitを使う場合はFlashメモリの書き換え(Hermit)を参照してください。

  7. 起動

    Linuxをブートし、ルートファイルシステムをマウントするか確認してください。bootlog:

    
      Copying kernel...done.
    Linux version 2.4.27-uc0-suzaku0 (atmark@build) (gcc version 2.95.3-4 Xilinx EDK 6.1 Build EDK_G.11) #8 Mon Jan 3 17:57:37 JST 2005
    On node 0 totalpages: 4096
    zone(0): 4096 pages.
    zone(1): 0 pages.
    zone(2): 0 pages.
    CPU: MICROBLAZE
    Console: xmbserial on UARTLite
    Kernel command line: root=/dev/nfs
    Calibrating delay loop... 25.44 BogoMIPS
    Memory: 16MB = 16MB total
    Memory: 14928KB available (1035K code, 235K data, 56K init)
    Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
    Inode cache hash table entries: 1024 (order: 1, 8192 bytes)
    Mount cache hash table entries: 512 (order: 0, 4096 bytes)
    Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
    Page-cache hash table entries: 4096 (order: 2, 16384 bytes)
    POSIX conformance testing by UNIFIX
    Linux NET4.0 for Linux 2.4
    Based upon Swansea University Computer Society NET3.039
    Initializing RT netlink socket
    Microblaze UARTlite serial driver version 1.00
    ttyS0 at 0xffff2000 (irq = 1) is a Microblaze UARTlite
    Starting kswapd
    xgpio #0 at 0xFFFF5000 mapped to 0xFFFF5000
    Xilinx GPIO registered
    SMSC LAN91C111 Driver (v2.0), (Linux Kernel 2.4 + Support for Odd Byte) 09/24/01 - by Pramod Bhardwaj (pramod.bhardwaj@smsc.com)
    eth0: SMC91C11xFD(rev:1) at 0xffe00300 IRQ:2 MEMSIZE:8192b NOWAIT:0 ADDR: 00:11:c0:xx:xx:xx
    RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
    Suzaku MTD mappings:
    Flash 0x400000 at 0xff000000
    Amd/Fujitsu Extended Query Table v1.3 at 0x0040
    flash: Swapping erase regions for broken CFI table.
    number of CFI chips: 1
    cfi_cmdset_0002: Disabling fast programming due to code brokenness.
    Creating 7 MTD partitions on "flash":
    0x00000000-0x00400000 : "Flash/All"
    0x00000000-0x00080000 : "Flash/FPGA"
    0x00080000-0x000a0000 : "Flash/Bootloader"
    0x003f0000-0x00400000 : "Flash/Config"
    0x000a0000-0x003f0000 : "Flash/Image"
    0x000a0000-0x00210000 : "Flash/Kernel"
    0x00210000-0x003f0000 : "Flash/User"
    NET4: Linux TCP/IP 1.0 for NET4.0
    IP Protocols: ICMP, UDP, TCP
    IP: routing cache hash table of 512 buckets, 4Kbytes
    TCP: Hash tables configured (established 1024 bind 1024)
    eth0:PHY remote fault detected
    Sending DHCP requests ., OK
    IP-Config: Got DHCP answer from 192.168.1.1, my address is 192.168.1.225
    IP-Config: Complete:
    device=eth0, addr=192.168.1.225, mask=255.255.255.0, gw=192.168.1.1,
    host=192.168.1.225, domain=local-network, nis-domain=(none),
    bootserver=192.168.1.1, rootserver=192.168.1.xx, rootpath=/srv/exports/suzaku,v3
    Looking up port of RPC 100003/3 on 192.168.1.xx
    Looking up port of RPC 100005/3 on 192.168.1.xx
    VFS: Mounted root (nfs filesystem).
    Freeing init memory: 56K
    Mounting proc:
    Mounting var:
    Populating /var:
    Running local start scripts.
    Mounting /etc/config:
    Populating /etc/config:
    flatfsd: Created 4 configuration files (151 bytes)
    Setting hostname:
    Setting up interface lo:
    Starting DHCP client:
    Jan 1 00:00:15 dhcpcd[33]: dhcpConfig: ioctl SIOCADDRT: File exists
    Starting inetd:
    Starting thttpd:

    SUZAKU login:

    DHCP clientの起動後に出るメッセージは、すでにip情報が存在するために出力されます。次のdistで修正する予定です。

  8. 動作確認環境

    上記の動作は以下の環境で確認されています。:

      SUZAKU:     uClinux-dist-20040408-suzaku3
    開発用PC: Debian Sid
    nfs-kernel-server 1:1.0.6-3
    DHCPサーバ: Debian Woody
    dhcp3-server 3.0+3.0.1rc9-2.2