DebianならLinkstationに簡単にインストールできて便利ですが、あえてNetBSD 7-currentをインストールしてみるメモ。(orion5x/kirkwood共通)
作業用PC (VirtualBox上のNetBSD 7)
NetBSDはクロスコンパイルが簡単にできるのでLinuxやFreeBSDでも構いません。ただし、ハードディスクをフォーマットするには結局NetBSDが必要でしょう。
カスタムカーネルとユーザーランドの作成。
NetBSD7-currentのsrc.tar.gzをダウンロードして展開。
# tar xvzf src.tar.gz -C /usr
# cd /usr/src
クロスコンパイラのビルド
これはインストール後にdistccでpkgsrcをコンパイルするのにも使います。
# ./build.sh -O obj -j5 -u -m evbarm -T /usr/tools/evbarm tools
カスタムコンフィグ
sys/arch/evbarm/conf/MARVELL_NAS をコピーしてMARVELL_NAS_WD0とします。
変更点
#config netbsd root on ? type ?
# wd0aをrootにする
config netbsd root on wd0a type ffs
ビルド
# ./build.sh -O obj -j5 -u -m evbarm -T /usr/tools/evbarm -V CPUFLAGS=-march=armv5te kernel=MARVELL_NAS_WD0
# ./build.sh -O obj -j5 -u -m evbarm -T /usr/tools/evbarm -V CPUFLAGS=-march=armv5te -V ALL_KERNELS=MARVELL_NAS_WD0 release
obj/releasedirに comp.tgz man.tgz tests.tgz etc.tgz misc.tgz text.tgz base.tgz games.tgz modules.tgz が作成される。
カーネルはobj/sys/arch/evbarm/compile/MARVELL_NAS_WD0/netbsd.ubで、uImage.buffaloにリネームすればよい。initrd.buffaloは不要。
ハードディスクの準備
作業用PCに接続しwd1と認識された。uImage.buffaloを置く先頭のパーティションはext2 (i-node 128バイト)にする。このへんはDebian化でもお馴染み。
fdisk
Partition table:
0: Linux native (sysid 131)
start 1, size 257040 (126 MB, Cyls 0/0/2-16/0/1)
PBR is not bootable: All bytes are identical (0x00)
1: NetBSD (sysid 169)
start 257041, size 116953199 (57106 MB, Cyls 16/0/2-7295)
PBR is not bootable: Bad magic number (0x54e0)
2: <UNUSED>
3: <UNUSED>
disklabel
# size offset fstype [fsize bsize cpg/sgs]
a: 115712000 257041 4.2BSD 0 0 0 # (Cyl. 255*- 115048*)
b: 1241199 115969041 swap # (Cyl. 115048*- 116279)
c: 117210240 0 unused 0 0 # (Cyl. 0 - 116279)
f: 257040 1 Linux Ext2 0 0 # (Cyl. 0*- 255*)
フォーマット
# newfs_ext2 -D 128 /dev/wd1f
# newfs -O 2 /dev/wd1a
あとはmountして、tar xpvzf base.tgz以下すべてを展開する。
起動前の設定
etc/rc.conf
rc_configured=YES
sshd=YES
dhclient=YES
hostname="mynetbsd7"
etc/fstab
/dev/wd0a / ffs rw,log 1 1
/dev/wd0b none swap sw 0 0
ptyfs /dev/pts ptyfs rw
etc/ssh/sshd_config
末尾に追加
Match Address 192.168.*.*
PasswordAuthentication yes
PermitRootLogin yes
vipw -d ./
pwhashでrootのパスワードを作成する。
cd dev/
./MAKEDEV all
ハードディスクを取り付けて起動
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 7.99.52 (MARVELL_NAS_WD0) #2: Wed Dec 28 06:29:49 JST 2016
root@netbsd.vbox:/usr/src/_obj/sys/arch/evbarm/compile/MARVELL_NAS_WD0
total memory = 256 MB
avail memory = 245 MB
sysctl_createv: sysctl_create(machine_arch) returned 17
timecounter: Timecounters tick every 10.000 msec
Kernelized RAIDframe activated
running cgd selftest aes-xts-256 aes-xts-512 done
mainbus0 (root)
cpu0 at mainbus0 core 0: Sheeva 88SV131 rev 1 (ARM9E-S V5TE core)
cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
cpu0: 16KB/32B 4-way L1 VIVT Instruction cache
cpu0: 16KB/32B 4-way write-back-locking-C L1 VIVT Data cache
mvsoc0 at mainbus0: Marvell 88F6281 Rev. A1 Kirkwood
mvsoc0: CPU Clock 1200.000 MHz SysClock 400.000 MHz TClock 200.000 MHz
mvsoctmr0 at mvsoc0 unit 0 offset 0x20300-0x203ff irq 65: Marvell SoC Timer
mvsocgpp0 at mvsoc0 unit 0 offset 0x10100-0x101ff irq 35: Marvell SoC General Purpose I/O Port Interface
mvsocgpp0: 50 gpio pins
mvsocgpp0: interrupts 96..103, intr 35
mvsocgpp0: interrupts 104..111, intr 36
mvsocgpp0: interrupts 112..119, intr 37
mvsocgpp0: interrupts 120..127, intr 38
mvsocgpp0: interrupts 128..135, intr 39
mvsocgpp0: interrupts 136..143, intr 40
mvsocgpp0: interrupts 144..151, intr 41
mvsocgpp0: Data Out: 0x00000580
mvsocgpp0: Data Out Enable Control: 0xfff3f27f
mvsocgpp0: Data Blink Enable: 0x00000000
mvsocgpp0: Data In Polarity: 0x000c0000
mvsocgpp0: Data In: 0x000c0780
mvsocgpp0: Interrupt Cause: 0x00000000
mvsocgpp0: Interrupt Mask: 0x00000000
mvsocgpp0: Interrupt Level Mask: 0x00000000
mvsocgpp0: High Data Out: 0x00010070
mvsocgpp0: High Data Out Enable Ctrl: 0xfffeff0f
mvsocgpp0: High Blink Enable: 0x00000080
mvsocgpp0: High Data In Polarity: 0x00034ef0
mvsocgpp0: High Data In: 0x00000500
mvsocgpp0: High Interrupt Cause: 0x00000000
mvsocgpp0: High Interrupt Mask: 0x00000000
mvsocgpp0: High Interrupt Level Mask: 0x00000000
gpio0 at mvsocgpp0: 50 pins
mvsocrtc at mvsoc0 unit 0 not configured
com0 at mvsoc0 unit 0 offset 0x12000-0x1201f irq 33: ns16550a, working fifo
com0: console
com1 at mvsoc0 unit 1 offset 0x12100-0x1211f irq 34: ns16550a, working fifo
ehci0 at mvsoc0 unit 0 offset 0x50000-0x50fff irq 19: Marvell USB 2.0 Interface
ehci0: EHCI version 1.0
usb0 at ehci0: USB revision 2.0
gtidmac0 at mvsoc0 unit 0 offset 0x60000-0x60fff: Marvell IDMA Controller/XOR Engine
gtidmac0: XOR Engine 4 channels, intr 5...8
gttwsi0 at mvsoc0 unit 0 offset 0x11000-0x110ff irq 29: Marvell TWSI controller
iic0 at gttwsi0: I2C bus
mvcesa0 at mvsoc0 unit 0 offset 0x3d000-0x3dfff irq 22: Marvell Cryptographic Engines and Security Accelerator
mvgbec0 at mvsoc0 unit 0 offset 0x70000-0x73fff: Marvell Gigabit Ethernet Controller
mvgbe0 at mvgbec0 port 0 irq 11
mvgbe0: Ethernet address 00:XX:XX:XX:XX:3b
makphy0 at mvgbe0 phy 8: Marvell 88E1116 Gigabit PHY, rev. 1
makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
mvgbec1 at mvsoc0 unit 1 offset 0x74000-0x77fff: Marvell Gigabit Ethernet Controller
mvgbe1 at mvgbec1 port 0 irq 15
mvgbe1: Ethernet address 00:24:a5:6a:3e:c0
mvgbe1: no PHY found!
mvpex0 at mvsoc0 unit 0 offset 0x40000-0x41fff irq 9: Marvell PCI Express Interface
pci0 at mvpex0
pci0: i/o space, memory space enabled
vendor 11ab product 6281 (miscellaneous memory, revision 0x03) at pci0 dev 0 function 0 not configured
mvsata0 at mvsoc0 unit 0 offset 0x80000-0x87fff irq 21: Marvell Serial-ATA Host Controller (SATAHC)
mvsata0: GenIIe, 1hc, 2port/hc
atabus0 at mvsata0 channel 0
atabus1 at mvsata0 channel 1
mvsdio at mvsoc0 unit 0 not configured
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
timecounter: Timecounter "mvsoctmr0" frequency 200000000 Hz quality 100
uhub0 at usb0: Marvell EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub0: 1 port with 1 removable, self powered
mvsata0 port 0: device present, speed: 1.5Gb/s
wd0 at atabus0 drive 0
wd0: <FUJITSU MHT2060BH>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 57231 MB, 116280 cyl, 16 head, 63 sec, 512 bytes/sect x 117210240 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(mvsata0:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
WARNING: 1 error while detecting hardware; check system log.
boot device: <unknown>
root on wd0a dumps on wd0b
kern.module.path=/stand/evbarm/7.99.52/modules