digital西行庵 wiki  Index  Search  Changes  PageRank  RSS  Login

Revenge of FreeBSD8 on SheevaPlug

ページを編集するにはログインが必要です。

復讐

昨年9月の段階では、DHCP/TFTP/NFSでの起動しかできなかった為、暫し休養。そろそろ頃合いかと・・・いう訳で、リベンジである。

手順

手順は、

http://www.openplug.org/plugwiki/index.php/FreeBSD_8.0_Setup

に従った。

FreeBSD 8 release を入手する

ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.0/

から8.0release のISOイメージをダウンロード。

母艦にインストール 今回は、IBM ThinkCentre S50(8086-2KJ)

Pentium4 3GHz / RAM 512MB / HDD 80GB

cvsupの設定を行い、make update / makeworld / makekernel で最新状態にアップデート

fb8# uname -a
FreeBSD fb8.saigyo.net 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Sat Mar 27 16:54:32 JST 2010     root@fb8.saigyo.net:/usr/obj/usr/src/sys/NITOBE  i386

SheevaPlug用にUSB-HDDを用意して、buildworld

何故かエラー停止するので、-j オプションははずした。

fb8# cd /usr/src
fb8# time make buildworld TARGET_ARCH=arm
	:
chmod 444 freebsd.submit.cf

--------------------------------------------------------------
>>> World build completed on Sun Mar 28 11:49:16 JST 2010
--------------------------------------------------------------
3828.633u 551.942s 1:10:40.00 103.3%    -4381+1714k 24937+5552io 10545pf+0w

USBパッチ適用

fb8# patch < /path/to/cam_hook.diff
/path/to/cam_hook.diff: No such file or directory.
fb8# patch < /root/Cam_hook.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- sys/sys/kernel.h   2009/07/23 20:50:15
|+++ sys/sys/kernel.h   2009/10/01 18:45:12
--------------------------
Patching file sys/sys/kernel.h using Plan A...
Hunk #1 succeeded at 155 (offset 1 line).
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- sys/cam/cam_xpt.c  2009/09/15 00:20:41
|+++ sys/cam/cam_xpt.c  2009/10/02 05:00:03
--------------------------
Patching file sys/cam/cam_xpt.c using Plan A...
Hunk #1 succeeded at 107.
Hunk #2 succeeded at 908.
Hunk #3 succeeded at 4630 (offset 2 lines).
Hunk #4 succeeded at 4685 (offset 2 lines).
Hunk #5 succeeded at 4742 (offset 2 lines).
done
fb8# patch < /root/Usb_hook.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- sys/dev/usb/controller/usb_controller.c     2009/09/28 07:05:14
|+++ sys/dev/usb/controller/usb_controller.c     2009/10/02 21:07:21
--------------------------
Patching file sys/dev/usb/controller/usb_controller.c using Plan A...
Hunk #1 succeeded at 67.
Hunk #2 succeeded at 80.
Hunk #3 succeeded at 138.
Hunk #4 succeeded at 169.
Hunk #5 succeeded at 245.
Hunk #6 succeeded at 454.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- sys/dev/usb/usb_bus.h       2009/09/28 07:45:13
|+++ sys/dev/usb/usb_bus.h       2009/10/02 21:07:21
--------------------------
Patching file sys/dev/usb/usb_bus.h using Plan A...
Hunk #1 succeeded at 51.
done

マルチユーザ・パッチ適用

fb8# patch < /root/Disable_forcedsingle.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- sys/arm/mv/mv_machdep.c.orig       2009-12-09 21:42:53.000000000 +0000
|+++ sys/arm/mv/mv_machdep.c    2009-12-09 21:42:40.000000000 +0000
--------------------------
Patching file sys/arm/mv/mv_machdep.c using Plan A...
Hunk #1 succeeded at 408.
done

buildkernel

SHEEVAPLUG_UFSをダウンロードし、解凍。/usr/src/sys/arm/conf/に置いておく。

fb8# cd /usr/src
fb8# make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG_UFS
	:
sys/SHEEVAPLUG_UFS" SYSDIR="/usr/src/sys" make  all
--------------------------------------------------------------
>>> Kernel build for SHEEVAPLUG_UFS completed on Sun Mar 28 14:01:45 JST 2010
--------------------------------------------------------------
190.236u 15.743s 3:23.31 101.3% 5740+1757k 1083+487io 75pf+0w

USB-HDDを初期化

BUFFALO HD-PF160U2-BK を、母艦に接続。

もともと、前回のFreeBSDが入っている。消しちまえ。


fb8# dmesg
Copyright (c) 1992-2009 The FreeBSD Project.
	:
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <WDC WD16 00BEVT-22ZCT0 > Fixed Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: 152627MB (312581808 512 byte sectors: 255H 63S/T 19457C)
fb8# gpart destroy da0
gpart: Device busy
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63      65520    1  freebsd  (32M)
      65583  312516225    2  freebsd  (149G)

fb8# gpart delete -i 1 da0
da0s1 deleted
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63      65520       - free -  (32M)
      65583  312516225    2  freebsd  (149G)

fb8# gpart show da2
gpart: No such geom: da2.
fb8# gpart delete -i 2 da0
da0s2 deleted
fb8# gpart show da2
gpart: No such geom: da2.
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63  312581745       - free -  (149G)

fb8# gpart destroy da0
da0 destroyed
fb8# gpart show da0
gpart: No such geom: da0.

MBRを生成

fb8# gpart create -s MBR da0
da0 created
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63  312581745       - free -  (149G)

kernel領域 /dev/da0s1 を生成

fb8# gpart add -s 32M -t freebsd da0
da0s1 added
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63      65520    1  freebsd  (32M)
      65583  312516225       - free -  (149G)

/ 領域 /dev/da0s2 を生成

fb8# gpart add -t freebsd da0
da0s2 added
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63      65520    1  freebsd  (32M)
      65583  312516225    2  freebsd  (149G)

fb8# bsdlabel -w /dev/da0s2
fb8# gpart show da0
=>       63  312581745  da0  MBR  (149G)
         63      65520    1  freebsd  (32M)
      65583  312516225    2  freebsd  (149G)

/dev/da0s1 をmsdos フォーマット

fb8# newfs_msdos /dev/da0s1
/dev/da0s1: 65416 sectors in 8177 FAT16 clusters (4096 bytes/cluster)
bps=512 spc=8 res=1 nft=2 rde=512 sec=65520 mid=0xf0 spf=32 spt=63 hds=255 hid=0

/dev/da0s2a をUFS フォーマット

fb8# newfs -n da0s2a
/dev/da0s2a: 152595.8MB (312516208 sectors) block size 16384, fragment size 2048
        using 831 cylinder groups of 183.77MB, 11761 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
 160, 376512, 752864, 1129216, 1505568, 1881920, 2258272, 2634624, 3010976, 3387328,
	:
 311619616, 311995968, 312372320

kernel コピー


fb8# mount -t msdosfs /dev/da0s1 /mnt
fb8# cp /usr/obj/arm/usr/src/sys/SHEEVAPLUG_UFS/kernel.bin /mnt
fb8# ls -al /mnt
total 2778
drwxr-xr-x   1 root  wheel    16384 Jan  1  1980 .
drwxr-xr-x  20 root  wheel      512 Mar 28 00:56 ..
-rwxr-xr-x   1 root  wheel  2823604 Mar 28 14:03 kernel.bin
fb8# umount /mnt

/ コピー、/etc/rc.conf、/etc/fstab設定

fb8# csh
fb8# cd /usr/src
fb8# mount /dev/da0s2a /mnt
fb8# setenv DESTDIR /mnt
fb8# make installworld TARGET_ARCH=arm
	:
makewhatis /mnt/usr/share/openssl/man
fb8# make distrib-dirs TARGET_ARCH=arm
	:
 ] ;  do  rm -rf "$1";  ln -s "$2" "$1";  shift; shift;  done
fb8# make distribution TARGET_ARCH=arm
	:
cd /usr/src/etc/..; install -o root -g wheel -m 444  COPYRIGHT /mnt/
fb8# echo 'hostname="sheeva"' > /mnt/etc/rc.conf
fb8# echo 'ifconfig_mge0="DHCP"'>> /mnt/etc/rc.conf
fb8# echo 'sshd_enable="YES"' >> /mnt/etc/rc.conf
fb8# echo '# Device                Mountpoint      FStype  Options         Dump    Pass#'
> /mnt/etc/fstab
fb8# echo '/dev/da0s2a             /               ufs     rw,noclusterr,noclusterw
      0       0' >> /mnt/etc/fstab
fb8# umount /mnt

USB-HDDをSheevaPlugに繋ぎ変え PowerON !

Marvell>>printenv bootcmd
bootcmd=nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
Marvell>>setenv bootcmd 'usb start;fatload usb 0:1 900000 kernel.bin;go 900000'
Marvell>>saveenv
Marvell>>boot
         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Apr  9 2009 - 12:23:12) Marvell version: 3.4.16

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

Soc: 88F6281 A0 (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
Flash:  0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
(Re)start USB...
USB:   scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found
reading kernel.bin
...................................................................................................................................................................................................................................................................................

2823604 bytes read
## Starting application at 0x00900000 ...
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-RELEASE-p2 #0: Sun Mar 28 14:01:40 JST 2010
    root@fb8.saigyo.net:/usr/obj/arm/usr/src/sys/SHEEVAPLUG_UFS
Preloaded elf kernel "elf kernel" at 0xc0bcb030.
CPU: Feroceon 88FR131 rev 1 (write-through core)
  WB enabled EABT branch prediction enabled
  16KB/32B 4-way Instruction cache
  16KB/32B 4-way write-back-locking-C Data cache
real memory  = 536870912 (512 MB)
Physical memory chunk(s):
00000000 - 0x8fffff, 9437184 bytes (2304 pages)
0xcbf000 - 0x1f64bfff, 513331200 bytes (125325 pages)
avail memory = 520536064 (496 MB)
SOC: (0x6281:0x02) Marvell 88F6281 rev A0, TClock 200MHz
nfslock: pseudo-device
null: <null device, zero device>
random: <entropy source, Software, Yarrow>
mem: <memory>
mbus0: <Marvell Internal Bus (Mbus)> on motherboard
ic0: <Marvell Integrated Interrupt Controller> at mem 0xf1020200-0xf102023b on mbus0
timer0: <Marvell CPU Timer> at mem 0xf1020300-0xf102032f irq 1 on mbus0
timer0: [FILTER]
rtc0: <Marvell Integrated RTC> at mem 0xf1010300-0xf1010307 on mbus0
rtc0: registered as a time-of-day clock (resolution 1000000us)
gpio0: <Marvell Integrated GPIO Controller> at mem 0xf1010100-0xf101011f irq 35,36,37,38,39,40,41 on mbus0
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
uart0: <16550 or compatible> at mem 0xf1012000-0xf101201f irq 33 on mbus0
uart0: [FILTER]
uart0: fast interrupt
uart0: console (115740,n,8,1)
uart1: <16550 or compatible> at mem 0xf1012100-0xf101211f irq 34 on mbus0
uart1: [FILTER]
uart1: fast interrupt
ehci0: <Marvell Integrated USB 2.0 controller> at mem 0xf1050000-0xf1050fff irq 48,19 on mbus0
ehci0: [FILTER]
ehci0: [MPSAFE]
ehci0: [ITHREAD]
ehci0: 5.24 GL USB-2 workaround enabled
usbus0: EHCI version 1.0
usbus0: set host controller mode
usbus0: <Marvell Integrated USB 2.0 controller> on ehci0
mge0: <Marvell Gigabit Ethernet controller> at mem 0xf1072000-0xf1073fff irq 12,13,14,11,46 on mbus0
mge0: bpf attached
mge0: Ethernet address: 00:50:43:01:ca:bb
miibus0: <MII bus> on mge0
e1000phy0: <Marvell 88E1116R Gigabit PHY> PHY 0 on miibus0
e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
mge0: [MPSAFE]
mge0: [ITHREAD]
mge0: [MPSAFE]
mge0: [ITHREAD]
procfs registered
Timecounter "CPU Timer" frequency 200000000 Hz quality 1000
Timecounters tick every 1.000 msec
vlan: initialized, using hash tables with chaining
lo0: bpf attached
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <Marvell> at usbus0
uhub0: <Marvell EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub0: 1 port with 1 removable, self powered
ugen0.2: <BUFFALO INC.> at usbus0
umass0: <Bulk Only Interface> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
pass0 at umass-sim0 bus 0 target 0 lun 0
pass0: <WDC WD16 00BEVT-22ZCT0 > Fixed Direct Access SCSI-2 device
pass0: 40.000MB/s transfers
GEOM: new disk da0
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <WDC WD16 00BEVT-22ZCT0 > Fixed Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: 152627MB (312581808 512 byte sectors: 255H 63S/T 19457C)
Trying to mount root from ufs:/dev/da0s2a
ct_to_ts([2010-03-28 05:53:31]) = 1269755611.000000000
start_init: trying /sbin/init
Setting hostuuid: a95e9d66-3a28-11df-bae6-00504301cabb.
Setting hostid: 0xe952c992.
Entropy harvesting: interrupts ethernet point_to_point kickstart.
Starting file system checks:
Mounting local file systems:.
Setting hostname: sheeva.
Starting Network: lo0 mge0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0mge0: link state changed to UP
xff000000
mge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=b<RXCSUM,TXCSUM,VLAN_MTU>
        ether 00:50:43:01:ca:bb
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
Starting devd.
DHCPREQUEST on mge0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.4 -- renewal in 7200 seconds.

Creating and/or trimming log files.
Starting syslogd.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Clearing /tmp (X related).
Updating motd:.
Starting sshd.
Starting cron.
Starting background file system checks in 60 seconds.

Sun Mar 28 05:53:41 UTC 2010

FreeBSD/arm (sheeva) (ttyu0)

login:

んん。あっさり動いたね。

root パスワードを設定

ユーザを追加

ssh パブリック・キーを置いて ネットワーク経由で ssh 接続できることを確認。

Last modified:2010/03/29 07:37:43
Keyword(s):
References: