2012年2月29日

SheevaPlugが届いたので遊んでみた(2)

このエントリーをブックマークに追加 このエントリーを含むはてなブックマーク

Amazonで注文していた白芝ことTOSHIBA製SDHCカードが届いたので前回の続きを。
容量は8GBを買いましたが4GBでも十分という感じ。Classは6以上、10くらいあったら幸せ。
(Class4だと後述のbootcmdにmmcinitを2回ほど入れないとSDが起きてくれませんでした)
今回は、購入したSDカードに最新のKernelとFedora12をインストールします。

今回はちょっと特殊で、NAND内のkernelを2.6.39.4まで上げてから、SDカード内に最新kernel 3.2.7を入れます。
別にNANDにも3.2.7を入れても良いのですが、一応、2系のkernelを入れておこうかなぁ... という訳で。
アップデート用のスクリプトがあるので、それを使います。
# wget http://sheeva.with-linux.com/sheeva/README-PLUG-UPDATE.sh
# chmod u+x README-PLUG-UPDATE.sh
# ./README-PLUG-UPDATE.sh 2.6.39.4 --nandkernel
# shutdown -r now
こんな感じで楽々スクリプトに感謝です。

Kernelを更新するとOSが起動してこなくなるので、U-bootの環境設定も書き換えます。
Marvell>> setenv mainlineLinux yes
Marvell>> setenv arcNumber 2097
Marvell>> setenv bootargs rootfstype=jffs2 console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1
Marvell>> saveenv
Marvell>> reset
これでNAND内のkernel更新完了。

次にSDカードにKernelとFedoraを入れる準備。
fdiskでパーティション切ってmkfsでフォーマットしていきます。
SDカード内のデータは全削除です。(新品を前提に話を進めます)
# fdisk /dev/mmcblk0
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3521, default 1): (空Enter)
Last cylinder, +cylinders or +size{K,M,G} (1-3521, default ):200
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (201-3521, default 201): (空Enter)
Last cylinder, +cylinders or +size{K,M,G} (201-3521, default 3521):3000
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (3001-3521, default 3001): (空Enter)
Last cylinder, +cylinders or +size{K,M,G} (3001-3521, default 3521):
Command (m for help): w
上記はAmazonで買った8GB白芝のパーティション切り例です。
切った後はこんな感じ。
Command (m for help): p

Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
221 heads, 20 sectors/track, 3521 cylinders
Units = cylinders of 4420 * 512 = 2263040 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1               1         200      441990   83  Linux
/dev/mmcblk0p2             201        3000     6188000   83  Linux
/dev/mmcblk0p3            3001        3521     1151410   83  Linux

Command (m for help): q
次にフォーマット。
# mkfs.ext2 /dev/mmcblk0p1
# mkfs.ext3 /dev/mmcblk0p2
# mkswap /dev/mmcblk0p3
# tune2fs -O ^has_journal /dev/mmcblk0p2
最後の行はジャーナリングをOFFにする設定。
まぁ... SDカードなんでジャーナリングは必要ないだろうと。

次はSDカードに最新のKernelをインストール。
# cd
# mount /dev/mmcblk0p1 /boot
# ./README-PLUG-UPDATE.sh 3.2.7 --rootkernel
# umount /boot
SDカードにFedoraをインストール。
# mkdir /mnt/sdcard
# mount /dev/mmcblk0p2 /mnt/sdcard
# cd /mnt/sdcard
# wget http://ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/rootfs-f12.tar.bz2
# tar xvjf rootfs-f12.tar.bz2
# mv rootfs-f12/* .
# cp -ax /dev/* /mnt/sdcard/dev
# mkdir temp //SDカード内に作業用フォルダをつくる(今更)
# cd temp
# wget http://sheeva.with-linux.com/sheeva/3/3.2/3.2.7/sheeva-3.2.7-Modules.tar.gz
# tar xvzf sheeva-3.2.7-Modules.tar.gz
# cp -rp lib/modules/3.2.7 /mnt/sdcard/lib/modules
# cp -rp lib/firmware/* /mnt/sdcard/lib/firmware
一旦Fedoraに入ってパスワードの設定やユーザの追加など。
# chroot /mnt/sdcard
# passwd
(省略)
# useradd sheeva //適当にユーザを追加
# passwd sheeva //新規ユーザのパスワード変更
# logout
Fedoraを抜けて再起動
# shutdown -r now
U-bootに入って環境設定を変更。
Marvell>> setenv bootargs_nand 'rootfstype=jffs2 console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1'
Marvell>> setenv bootcmd_nand 'setenv bootargs $(bootargs_nand); nand read.e 0x800000 0x100000 0x400000; bootm 0x800000'
Marvell>> setenv 'bootargs_sd=console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mmcblk0p2 rootdelay=3 panic=10'
Marvell>> setenv bootcmd_sd 'setenv bootargs $(bootargs_sd); mmcinit; mmcinit; ext2load mmc 0:1 0x800000 /sheeva-3.2.7-uImage; bootm 0x800000'
Marvell>> saveenv
Marvell>> reset
あとはFedoraの起動を待つのみ。意味も無くloginまでの処理を貼ってみる。
         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Dec 16 2009 - 15:20:43) Marvell version: 3.4.23

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CFB00

Soc: 88F6281 A1 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB
Flash:  0 kB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0
SDHC found. Card desciption is:
Manufacturer:       0x02, OEM "TM"
Product name:       "SD08G", revision 8.2
Serial number:      **********
Manufacturing date: 12/2011
CRC:                0x00, b0 = 0
SDHC found. Card desciption is:
Manufacturer:       0x02, OEM "TM"
Product name:       "SD08G", revision 8.2
Serial number:      **********
Manufacturing date: 12/2011
CRC:                0x00, b0 = 0

2920160 bytes read
## Booting image at 00800000 ...
   Image Name:   Linux-3.2.7
   Created:      2012-02-21   9:30:40 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2920096 Bytes =  2.8 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Initializing cgroup subsys cpu
Linux version 3.2.7 (kelly@bbb.internal) (gcc version 4.5.3 (PlugComputer G++ 20110530) ) #2 PREEMPT Tue Feb 21 02:30:36 MST 2012
CPU: Feroceon 88FR131 [********] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell SheevaPlug Reference Board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyS0,115200=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mmcblk0p2 rootdelay=3 panic=10
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: 512MB = 512MB total
Memory: 513424k/513424k available, 10864k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xe0800000 - 0xfe800000   ( 480 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc056cb1c   (5523 kB)
      .init : 0xc056d000 - 0xc0597000   ( 168 kB)
      .data : 0xc0598000 - 0xc05d2df8   ( 236 kB)
       .bss : 0xc05d2e1c - 0xc062e66c   ( 367 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:114
sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 21474ms
Console: colour dummy device 80x30
Calibrating delay loop... 1191.11 BogoMIPS (lpj=5955584)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys cpuacct
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys blkio
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
Kirkwood: MV88F6281-A1, TCLK=200000000.
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource orion_clocksource
FS-Cache: Loaded
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
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 named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
FS-Cache: Netfs 'nfs' registered for caching
JFFS2 version 2.2. (NAND) c 2001-2006 Red Hat, Inc.
JFS: nTxBlock = 4011, nTxLock = 32089
msgmni has been set to 1002
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
mv_xor_shared mv_xor_shared.1: Marvell shared XOR driver
mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
mv_xor mv_xor.2: Marvell XOR: ( xor cpy )
mv_xor mv_xor.3: Marvell XOR: ( xor fill cpy )
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
brd: module loaded
loop: module loaded
NAND device: Manufacturer ID: 0xec, Chip ID: 0xdc (Samsung NAND 512MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 519 at 0x0000040e0000
Bad eraseblock 2942 at 0x000016fc0000
Bad eraseblock 3726 at 0x00001d1c0000
Creating 3 MTD partitions on "orion_nand":
0x000000000000-0x000000100000 : "u-boot"
0x000000100000-0x000000500000 : "uImage"
0x000000500000-0x000020000000 : "root"
mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
mv643xx_eth smi: probed
mv643xx_eth_port mv643xx_eth_port.0: eth0: port 0 with MAC address **:**:**:**:**:**
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
orion-ehci orion-ehci.0: Marvell Orion EHCI
orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
orion-ehci orion-ehci.0: irq 19, io mem 0xf1050000
orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
mousedev: PS/2 mouse device common for all mice
rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
i2c /dev entries driver
cpuidle: using governor ladder
cpuidle: using governor menu
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc0: mvsdio driver initialized, lacking card detect (fall back to polling)
sdhci-pltfm: SDHCI platform and OF driver helper
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
registered taskstats version 1
rtc-mv rtc-mv: setting system clock to 2012-02-28 05:12:07 UTC (1330405927)
Waiting 3sec before mounting root device...
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new high speed SDHC card at address a3b3
mmcblk0: mmc0:a3b3 SD08G 7.42 GiB
 mmcblk0: p1 p2 p3
VFS: Mounted root (ext2 filesystem) on device 179:2.
devtmpfs: mounted
Freeing init memory: 168K
                Welcome to Fedora
                Press 'I' to enter interactive startup.
Starting udev: [  OK  ]
Setting hostname fedora-arm:  [  OK  ]
Checking filesystems
Checking all file systems.
[  OK  ]
Mounting local filesystems:  [  OK  ]
Enabling /etc/fstab swaps:  [  OK  ]
Entering non-interactive startup
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[  OK  ]
Starting system logger: [  OK  ]
rpcbind: unrecognized service
Mounting NFS filesystems:  [  OK  ]
Mounting other filesystems:  [  OK  ]
Retrigger failed udev events[  OK  ]
Generating SSH1 RSA host key: [  OK  ]
Generating SSH2 RSA host key: [  OK  ]
Generating SSH2 DSA host key: [  OK  ]
Starting sshd: [  OK  ]

Fedora release 12 (Constantine)
Kernel 3.2.7 on an armv5tel (/dev/ttyS0)

fedora-arm login:
この状態だとyumでエラーが出るので、RPMデータベースを再構成。その後yum updateする。
# rm -f /var/lib/rpm/__db*
# rpm --rebuilddb
# yum -y update
適宜、タイムゾーンを日本に変更するなど。
# cp /usr/share/zoneinfo/Japan /etc/localtime

あとはx86版と何も変わらないFedora生活です。
次回はSheevaPlugを買った主たる目的、AirPrintアダプタ化を目指しCUPSのインストールからスタート予定。

0 件のコメント:

コメントを投稿

Recent Photos from Atelier (Flickr)

作業場で撮影した写真をアップロードしています。記事にする前の試作なども公開中です。