2011年6月21日火曜日

obs600-11 nfsrootマウント

U-Bootプロンプトさえ出てくれれば、ブートしなくなっても、uImage.initrd.squeezeのロードと起動であっさり回復は出来そうです。しかし、大きな変更をしたい時や、CFディスクを抜き差しせずに、バージョンの世代変更を確認したい時などは、NFS ルートファイルシステムで起動マウント出来ればそれなりに便利なことがありそうです。以下はnfsrootマウントを試した記録です。

(1) linux-2.6.36 の .config 変更
・make menuconfig の変更箇所 (→部分)

 │    [*] Networking support  --->
 │    --- Networking support
 │          Networking options  --->
→│    [*]   IP: kernel level autoconfiguration
→│    [*]     IP: DHCP support (NEW)          
→│    [*]     IP: BOOTP support (NEW)         
→│    [*]     IP: RARP support (NEW)
 
 │    [*] Network File Systems  --->
 │    --- Network File Systems 
→│    <*>   NFS client support
→│    [*]     Root file system on NFS

→│    <*>   NFS server support                                         
  │    -*-     NFS server support for NFS version 3                     
  │    [*]       NFS server support for the NFSv3 ACL protocol extension
  │    [*]     NFS server support for NFS version 4 (EXPERIMENTAL)      

・.config の差分

root@squeeze:linux-2.6.36# diff .config_3 .config
4c4
< # Mon Jun 13 10:33:02 2011
---
> # Mon Jun 20 14:24:56 2011
364c364,367
< # CONFIG_IP_PNP is not set
---
> CONFIG_IP_PNP=y
> CONFIG_IP_PNP_DHCP=y
> CONFIG_IP_PNP_BOOTP=y
> CONFIG_IP_PNP_RARP=y
1704c1707
< CONFIG_NFS_FS=m
---
> CONFIG_NFS_FS=y
1708a1712
> CONFIG_ROOT_NFS=y
1711c1715
< CONFIG_NFSD=m
---
> CONFIG_NFSD=y
1716c1720
< CONFIG_LOCKD=m
---
> CONFIG_LOCKD=y
1718,1719c1722,1723
< CONFIG_EXPORTFS=m
< CONFIG_NFS_ACL_SUPPORT=m
---
> CONFIG_EXPORTFS=y
> CONFIG_NFS_ACL_SUPPORT=y
1721,1723c1725,1727
< CONFIG_SUNRPC=m
< CONFIG_SUNRPC_GSS=m
< CONFIG_RPCSEC_GSS_KRB5=m
---
> CONFIG_SUNRPC=y
> CONFIG_SUNRPC_GSS=y
> CONFIG_RPCSEC_GSS_KRB5=y
1941c1945
< CONFIG_CRYPTO_MD5=m
---
> CONFIG_CRYPTO_MD5=y
1963c1967
< CONFIG_CRYPTO_DES=m
---
> CONFIG_CRYPTO_DES=y
root@squeeze:linux-2.6.36#               [ERROR:1] (11-06-20 Mon 14:26:20 PM)

このあと、 make uImage; make modules; make modules_install

UIMG=uImage.36_$(date +'%Y%m%d')
mkimage -n "$(date +'%Y%m%d_%H%M')-sda1" -A ppc -O linux -T multi -C gzip ¥
-d vmlinux.bin.gz:ramdisk.image-cfboot.gz:obs600.dtb ${UIMG}

にて、
-rw-r--r-- 1 root root 2617662 Jun 20 19:41 uImage.36_20110620
ができあがりました。これを、
/usr/sbin/flashcfg -f uImage.36_20110620 しました。
(2) nfsroot 指定による起動
以下のように起動しました。冗長ですが、コンソールログです。
U-Boot 2009.01-ph20100607-01 (Jun 07 2010 - 18:10:57)

CPU:   AMCC PowerPC 405EX Rev. D at 400 MHz (PLB=200, OPB=100, EBC=100 MHz)
       Security support
       Bootstrap Option C - Boot ROM Location EBC (16 bits)
       16 kB I-Cache 16 kB D-Cache
Board: OBS600 - Plat'Home OBS600 Board
I2C:   ready
DRAM:   1 GB
FLASH: 128 MB
Net:   ppc_4xx_eth0, ppc_4xx_eth1
*** SW 4 IS OFF, CPU Clock TO 600MHZ ***

*** WILL RESET CHIP TO TAKE EFFECT ***

U-Boot 2009.01-ph20100607-01 (Jun 07 2010 - 18:10:57)

CPU:   AMCC PowerPC 405EX Rev. D at 600 MHz (PLB=200, OPB=100, EBC=100 MHz)
       Security support
       Bootstrap Option C - Boot ROM Location EBC (16 bits)
       16 kB I-Cache 16 kB D-Cache
Board: OBS600 - Plat'Home OBS600 Board
I2C:   ready
DRAM:   1 GB
FLASH: 128 MB
Net:   ppc_4xx_eth0, ppc_4xx_eth1
*** SW 4 IS OFF, CPU Clock TO 600MHZ ***

Display the current time of RTC by UTC.
Date: 2011-06-21 (Tuesday)    Time:  5:54:17

Hit any key to stop autoboot:  0 

Run Boot Selection Script

*** SW 1 IS ON ***

*** SW 2 IS OFF, ENTER COMMAND PROMPT ***

=> setenv bootargs console=ttyS0,115200 root=/dev/nfs rw ¥
nfsroot=192.168.1.70:/mnt/share/OBS600/Debian/nfs_squeeze ip=dhcp; bootm 0xf8000000
## Booting kernel from Legacy Image at f8000000 ...
   Image Name:   20110620_1941-sda1
   Created:      2011-06-20  10:41:40 UTC
   Image Type:   PowerPC Linux Multi-File Image (gzip compressed)
   Data Size:    2617598 Bytes =  2.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Contents:
      Image 0: 2192626 Bytes =  2.1 MB
      Image 1: 417113 Bytes = 407.3 kB
      Image 2: 7838 Bytes =  7.7 kB
   Verifying Checksum ... OK
## Loading init Ramdisk from multi component Legacy Image at f8000000 ...
## Flattened Device Tree from multi component Image at F8000000
   Booting using the fdt at 0xf827d2a0
   Uncompressing Multi-File Image ... OK
   Loading Ramdisk to 0fdfe000, end 0fe63d59 ... OK
   Loading Device Tree to 007fb000, end 007ffe9d ... OK
Using OpenBlockS 600 machine description
Linux version 2.6.36_obs600 (root@squeeze) (gcc version 4.4.5 (Debian 4.4.5-8) ) ¥
#5 Mon Jun 20 18:01:14 JST 2011
Found initrd at 0xcfdfe000:0xcfe63d59
Zone PFN ranges:
  DMA      0x00000000 -> 0x00020000
  Normal   empty
  HighMem  0x00020000 -> 0x00040000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00040000
MMU: Allocated 1088 bytes of context maps for 255 contexts
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096
Kernel command line: console=ttyS0,115200 root=/dev/nfs rw ¥
nfsroot=192.168.1.70:/mnt/share/OBS600/Debian/nfs_squeeze ip=dhcp
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 1034648k/1048576k available (4540k kernel code, 13928k reserved, ¥
180k data, 146k bss, 164k init)
Kernel virtual memory layout:
  * 0xfffcf000..0xfffff000  : fixmap
  * 0xff800000..0xffc00000  : highmem PTEs
  * 0xff600000..0xff800000  : consistent mem
  * 0xff5fe000..0xff600000  : early ioremap
  * 0xe1000000..0xff5fe000  : vmalloc & ioremap
Hierarchical RCU implementation.
 RCU-based detection of stalled CPUs is disabled.
 Verbose stalled-CPUs detection is disabled.
NR_IRQS:512
UIC0 (32 IRQ sources) at DCR 0xc0
UIC1 (32 IRQ sources) at DCR 0xd0
UIC2 (32 IRQ sources) at DCR 0xe0
clocksource: timebase mult[6aaaab] shift[22] registered
Console: colour dummy device 80x25
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
devtmpfs: initialized
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource timebase
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 407k freed
audit: initializing netlink socket (disabled)
type=2000 audit(0.128:1): initialized
highmem bounce pool size: 64 pages
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
msgmni has been set to 997
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
OBS600 LED driver v0.2
Push switch driver v0.1
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xef600200 (irq = 26) is a U6_16550A
console [ttyS0] enabled
serial8250.0: ttyS1 at MMIO 0xef600300 (irq = 16) is a U6_16550A
brd: module loaded
f8000000.nor_flash: Found 1 x16 devices at 0x0 in 16-bit bank. ¥
Manufacturer ID 0x000001 Chip ID 0x002801
Amd/Fujitsu Extended Query Table at 0x0040
  Amd/Fujitsu Extended Query version 1.3.
number of CFI chips: 1
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Creating 7 MTD partitions on "f8000000.nor_flash":
0x000000000000-0x000003de0000 : "kernel + initrd"
0x000003de0000-0x000003e60000 : "user config area"
0x000003e60000-0x000007e60000 : "user program area"
0x000007e60000-0x000007ee0000 : "flat device tree"
0x000007ee0000-0x000007f60000 : "test program"
0x000007f60000-0x000007fa0000 : "u-boot env"
0x000007fa0000-0x000008000000 : "u-boot"
PPC 4xx OCP EMAC driver, version 3.54
MAL v2 /plb/mcmal, 2 TX channels, 2 RX channels
RGMII /plb/opb/emac-rgmii@ef600b00 initialized with MDIO support
/plb/opb/emac-rgmii@ef600b00: input 0 in RGMII mode
eth0: EMAC-0 /plb/opb/ethernet@ef600900, MAC 00:0a:85:04:19:9e
eth0: found Generic MII PHY (0x02)
/plb/opb/emac-rgmii@ef600b00: input 1 in RGMII mode
eth1: EMAC-1 /plb/opb/ethernet@ef600a00, MAC 00:0a:85:04:99:9e
eth1: found Generic MII PHY (0x03)
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
dwc_otg: version 1.05
Using DMA mode
of:dwc_otg ef6c0000.usbotg: DWC OTG Controller
of:dwc_otg ef6c0000.usbotg: new USB bus registered, assigned bus number 1
of:dwc_otg ef6c0000.usbotg: irq 33, io mem 0x00000000
Init: Port Power? op_state=a_host
Init: Power Port (0)
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: DWC OTG Controller
usb usb1: Manufacturer: Linux 2.6.36_obs600 dwc_otg_hcd
usb usb1: SerialNumber: dwc_otg_hcd
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
of:ibm-iic ef600400.i2c: using standard (100 kHz) mode
rtc-ds1307 0-0068: rtc core: registered ds1340 as rtc0
of:ibm-iic ef600500.i2c: using standard (100 kHz) mode
Netfilter messages via NETLINK v0.30.
NET: Registered protocol family 17
Registering the dns_resolver key type
registered taskstats version 1
rtc-ds1307 0-0068: setting system clock to 2011-06-21 05:54:49 UTC (1308635689)
 ++OTG Interrupt: Debounce Done++
usb 1-1: new high speed USB device using of:dwc_otg and address 2
eth0: link is down
eth1: link is down
usb 1-1: New USB device found, idVendor=0424, idProduct=2514
usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1.1: new high speed USB device using of:dwc_otg and address 3
usb 1-1.1: New USB device found, idVendor=05e3, idProduct=0702
usb 1-1.1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
usb 1-1.1: Product: USB Storage
usb-storage 1-1.1:1.0: Quirks match for vid 05e3 pid 0702: 520
scsi0 : usb-storage 1-1.1:1.0
eth0: link is up, 100 FDX, pause enabled
Sending DHCP requests ., OK
IP-Config: Got DHCP answer from 0.0.0.0, my address is 192.168.1.29
IP-Config: Complete:
     device=eth0, addr=192.168.1.29, mask=255.255.255.0, gw=192.168.1.28,
     host=192.168.1.29, domain=gjs.or.jp, nis-domain=(none),
     bootserver=0.0.0.0, rootserver=192.168.1.70, rootpath=
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
Setting real-root-dev to nfs.
Looking up port of RPC 100003/2 on 192.168.1.70
Looking up port of RPC 100005/1 on 192.168.1.70
VFS: Mounted root (nfs filesystem) on device 0:15.
Trying to move old root to /initrd ... /initrd does not exist. Ignored.
Unmounting old root
Trying to free ramdisk memory ... okay
[prepare_namespace] Executing flashcfg...
[prepare_namespace] Finished executing flashcfg
Freeing unused kernel memory: 164k init
scsi 0:0:0:0: Direct-Access     SanDisk  SDCFH-004G       0014 PQ: 0 ANSI: 0
sd 0:0:0:0: [sda] 7813120 512-byte logical blocks: (4.00 GB/3.72 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1 sda2
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI disk
INIT: version 2.88 booting
Using makefile-style concurrent boot in runlevel S.
.udev/ already exists on the static /dev! ... (warning).
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events...done.
Waiting for /dev to be fully populated...done.
Activating swap...done.
Cleaning up ifupdown....
Setting up networking....
Loading kernel modules...done.
Activating lvm and md swap...done.
Checking file systems...fsck from util-linux-ng 2.17.2
done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Cleaning up temporary files....
Configuring network interfaces...done.
Starting portmap daemon....
Starting NFS common utilities: statd.
Cleaning up temporary files....
Setting kernel variables ...done.
INIT: Entering runlevel: 2
Using makefile-style concurrent boot in runlevel 2.
Starting portmap daemon...Already running..
Starting NFS common utilities: statd.
Starting enhanced syslogd: rsyslogd.
Starting periodic command scheduler: cron.
Starting internet superserver: inetd.
Starting OpenBSD Secure Shell server: sshdNET: Registered protocol family 10
lo: Disabled Privacy Extensions

Debian GNU/Linux 6.0 squeeze ttyS0

squeeze login: root
Password: 
Last login: Tue Jun 21 14:46:10 JST 2011 on ttyS0
Linux squeeze 2.6.36_obs600 #5 Mon Jun 20 18:01:14 JST 2011 ppc

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.
root@squeeze:‾# 
root@squeeze:‾# df
Filesystem           1K-blocks      Used Available Use% Mounted on
192.168.1.70:/       112877656  90367260  16776540  85% /
tmpfs                   517608         0    517608   0% /lib/init/rw
udev                     10240        64     10176   1% /dev
tmpfs                   517608         4    517604   1% /dev/shm

root@squeeze:‾# mount   (NFSルートマウントになっています)
192.168.1.70:/ on / type nfs (rw,vers=4,addr=192.168.1.70,clientaddr=192.168.1.29)
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)
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)
root@squeeze:‾# 
root@squeeze:‾# fdisk -l  (CFディスクも見えています)

Disk /dev/sda: 3 GB, 3996647424 bytes
128 heads, 63 sectors/track, 968 cylinders
Units = cylinders of 8064 * 512 = 4128768 bytes

   Device Boot      Start         End      Blocks   Id  System 
/dev/sda1               1         892     3596512   83  Linux
/dev/sda2             893         968      302400   82  Linux swap
root@squeeze:‾# 
                (母艦側は 玄箱 KURO-BOX[100BASE-TX版]です。)
root@squeeze:‾# ssh 192.168.1.70 uname -a|nkf -w
root@192.168.1.70's password: 
Linux kuro 2.4.17_mvl21 #24 2004年 10月 19日 火曜日 17:17:03 JST ppc GNU/Linux
root@squeeze:‾# 

(bootargsのip=の書式)
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
ここでは、ip=dhcp としましたが、
ip=192.168.1.29:192.168.1.70:192.168.1.28:255.255.255.0:::off
とかでもよさそうです。
(母艦側の準備)
rsync -ax / 192.168.1.70:/mnt/share/OBS600/Debian/nfs_squeeze
CFディスクを、まるごと母艦側にコピーしました。
一箇所 etc/fstab は "192.168.1.70:/ / nfs defaults 0 0" に変更。
nfsroot指定の起動後、負荷をかけたテストとかはしていないので、問題があるかもしれません。今回参考になったのは、linux-2.6.36/Documentation/filesystems/nfs/nfsroot.txt や 3.4 NFS ルートファイルシステムに関する起動時引数 などです。
--

0 件のコメント:

コメントを投稿