Introduction
This document describes in depth how to prepare your NH-230/231 NAS for installing NetBSD/sandpoint. Models based on the NH-230 have an ITE PATA controller while those based on the NH-231 have a SiliconImage SataLink SATA controller. The following models are known to be compatible:
- Allnet 6250 (PATA)
- Allnet 6260 (SATA)
- Encore ENNHD-1000 (PATA)
- Fujitsu-Siemens AMS150 (SATA)
- Fujitsu-Siemens SBLAN2 (SATA)
- Lindy NAS Personal Server Premium, IDE (PATA)
- Lindy NAS Personal Server Premium, SATA (SATA)
- Longshine LCS-8311 (SATA)
- Netronix NH-230 (PATA)
- Netronix NH-231 (SATA)
- Planex NAS-01G (PATA)
- SinanPower GigaBit LAN NAS-349 (SATA)
- Vibe NS-349-S (SATA)
The hardware shown in these instructions is an Allnet 6250.
Accessing the serial interface
We need a serial console to get access to the firmware. Therefore you have to open the case and connect a serial adapter, which converts the NH-230/231 TTL levels to RS232 levels. You will also have to make a plug for the 4-pin serial header on the board.
Locate the serial port
Look out for a 4-pin header, which is labeled J6
on an Allnet 6250
board.
|
Connect a serial terminal via a converter
The serial port on the NH-230/231 compatibles is using 3.3V TTL levels, which have to be converted into regular RS232 levels by a level shifter circuit. Instructions how to build such a circuit yourself can be found here:
Make sure that the layout of the connector fits to the pinout of the boards serial header, as shown above.
Another option is to buy such a converter. There are solutions for a standard RS232 interface and for an USB interface. Look out for:
- RS232 level shifter / breakout board (MAX3232 based)
- USB to TLL serial level shifter / breakout board (FT232 based)
Now you can connect with any terminal program to the NH-230/231 serial
console. The easiest approach may be to use NetBSD's tip(1)
command to
make a direct console connection at 9600bps.
# tip console
Note that when using a serial connection via USB you may have to make an
entry for /dev/ttyU0
in /etc/remote
.
First time installation
The altboot bootloader
The altboot(8)
utility functions as a bridge between the PPCBoot
firmware and the NetBSD kernel startup environment. NAS firmware often
provides no means to boot a kernel from disk or from the network and
doesn't initialize all hardware correctly. We will also use it to pass a
bootinfo list to the kernel.
The altboot
boot loader has to be loaded and started using the
NH-230/231 firmware, which is PPCBoot 2.0.0-A9
.
PPCBoot 2.0.0-A9 (Feb 13 2006 - 14:56:11)
CPU: MPC8241 Revision 1.4 at 266.666 MHz: 16 kB I-Cache 16 kB D-Cache
Board: Sandpoint 8241 Unity ##Test not implemented yet##
DRAM: 64 MB
FLASH: Manufacturer code: 0xEC, Device code: 0xA2 : 4 MB
In: serial
Out: serial
Err: serial
EPIC: reset is in process ....doneNet:
RTL8169S driver v1.5-A4 03-15-2005
RTL8169#0
Press space to abort autoboot in 3 second
The functionality of this NH-230/231 PPCBoot version is restricted.
Probably to keep it small and to save space for a Linux kernel and
ramdisk in the 4MB Flash, but also to keep the user from hacking it. It
only allows to overwrite four predefined regions of the flash with
special load commands, and the lack of a cp command leaves us with
the only option to boot altboot(8)
as a Linux kernel image through
bootm.
Getting altboot into RAM
The altboot
boot loader has to be loaded and started using PPCBoot.
Usually there are three ways to invoke it:
- loadb to load a binary file via serial line in kermit mode
- tftpboot to load a binary file over the network with TFTP protocol
- start it from the flash memory
The last option is prefered once the installation is completed, but
obviously it is not possible for the first time boot. Fortunately
PPCBoot has set up the network interface, which we can use after
configuring the ipaddr
and serverip
environment variables:
_MPC824X > setenv ipaddr 192.168.0.107 _MPC824X > setenv serverip 192.168.0.5 _MPC824X > savenv Saving Environment to Flash... unProtect FFC00000 ... FFC01FFF Un-Protected 1 sectors Erasing Flash... . done Erased 1 sectors Writing to Flash... done Protected 1 sectors
Once you have set up TFTP and DHCP (read below) you
can download altboot
into RAM at 0x1000000
like this:
_MPC824X > tftp 1000000 altboot.bin TFTP from server 192.168.0.5; our IP address is 192.168.0.107 Filename 'altboot.bin'. Load address: 0x1000000 Loading: ################ done Bytes transferred = 76884 (12c54 hex)
Boot the INSTALL kernel with altboot
Now you can use altboot
to launch the netbsd-INSTALL
kernel for
installing NetBSD. You may choose to load it with TFTP or from NFS. For TFTP
you have to enable tftpd(8)
in /etc/inetd.conf
, and for NFS there is
a documentation at The Network File
System.
But in both cases you have to set up a DHCP server, which is explained
in the DHCP Howto. An
appropriate dhcpd.conf
entry could look like this:
host nh-nas {
hardware ethernet 00:08:54:xx:xx:xx;
fixed-address 192.168.0.107;
next-server 192.168.0.5;
option root-path "/export/nh-nas/root";
}
The root-path
option is only needed when using NFS and should match
your exported NFS directory. Uncompress netbsd-INSTALL.gz
from the
NetBSD/sandpoint distribution and copy it into the NFS or TFTP directory.
Then start the DHCP, NFS or TFTP server and boot the installation kernel
from the firmware either with
_MPC824X > go 1000000 tftp:netbsd-INSTALL
or from NFS:
_MPC824X > go 1000000 nfs:netbsd-INSTALL
Our bootloader configures the hardware, determines the IP address, loads the kernel via network and launches it:
## Starting application at 0x01000000 ...
>> NetBSD/sandpoint altboot, revision 1.9 (Thu Apr 26 21:37:17 CEST 2012)
>> Netronix NH-230/231, cpu 264 MHz, bus 132 MHz, 64MB SDRAM
channel 0 present
wd0: <Maxtor 2B020H1> DMA LBA LBA48 19541 MB
wd0: no disklabel
MAC address 00:08:54:xx:xx:xx
100Mbps-FDX
Hit any key to enter interactive mode: 0
loading "netbsd-INSTALL" 5365148+134572=0x53efd0
entry=0x90000, ssym=0x5ceb48, esym=0x5cefd0
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012
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 6.0_BETA (INSTALL)
Model: nhnas
total memory = 65536 KB
avail memory = 57820 KB
OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
mainbus0 (root)
cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
cpu0: 264.00 MHz
eumb0 at mainbus0
com0 at eumb0 unit 0: ns16550a, working fifo
com0: console
com0: interrupting at irq 40
ociic0 at eumb0
iic0 at ociic0: I2C bus
pcf8563rtc0 at iic0 addr 0x51: NXP PCF8563 Real-time Clock
satmgr0 at eumb0 unit 1: button manager (not supported)
nhpow0 at mainbus0: NH230/231 gpio board control, version 1
nhpow0: interrupting at irq 20
gpio0 at nhpow0: 8 pins
cfi at mainbus0 not configured
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0
pchb0: vendor 0x1057 product 0x0006 (rev. 0x14)
ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
ohci0: interrupting at irq 19
ohci0: OHCI version 1.0
usb0 at ohci0: USB revision 1.0
ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
ohci1: interrupting at irq 19
ohci1: OHCI version 1.0
usb1 at ohci1: USB revision 1.0
ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
ehci0: interrupting at irq 19
ehci0: companion controllers, 3 ports each: ohci0 ohci1
usb2 at ehci0: USB revision 2.0
re0 at pci0 dev 15 function 0: RealTek 8169/8110 Gigabit Ethernet (rev. 0x10)
re0: interrupting at irq 17
re0: Ethernet address 00:08:54:xx:xx:xx
rgephy0 at re0 phy 7: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 0
rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
iteide0 at pci0 dev 16 function 0: Integrated Technology Express IDE controller (rev. 0x11)
iteide0: using irq 18 for native-PCI interrupt
atabus0 at iteide0 channel 0
atabus1 at iteide0 channel 1
biomask 1c000000 netmask 1c000000 ttymask 1c000000
uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
wd0 at atabus0 drive 0
wd0: <Maxtor 2B020H1>
wd0: 19541 MB, 39703 cyl, 16 head, 63 sec, 512 bytes/sect x 40020624 sectors
boot device: re0
root on md0a dumps on md0b
root file system type: ffs
erase ^H, werase ^W, kill ^U, intr ^C, status ^T
Terminal type? [vt100]
Just follow the usual procedure to install a NetBSD system.
Post installation steps
After a successful installation you want to make the system boot
standalone when switched on, without the need for a serial console. So
you have to find a way to make your firmware automatically boot
altboot
and the kernel.
Without a working cp command the only way to make your system
automatically boot NetBSD is to replace the Linux kernel on flash by
altboot.img
, which is our bootloader in PPCBoot image format, faking a
Linux kernel.
When viewing the environment variables with printenv you can see that
the bootcmd
is calling bootm to load the Linux kernel. The first
address is the location which we have to overwrite with altboot.img
.
Here it is 0xffc10000
, which you have to replace in all the following
commands, in case your bootcmd
differs.
bootcmd=bootm ffc10000 fff20000
Load altboot.img
into memory, for example at 0x1000000
again, as
explained above. You might want to backup the Linux kernel
image first. Then execute the following commands to overwrite it with
altboot.img
:
_MPC824X > load -k 1000000 Flash: upgrade Linux kernel in unProtect FFC10000 ... FFD8FFFF Un-Protected 24 sectors Erasing Flash... ............. done Erased 24 sectors Writing to Flash... done
Additionally you may think about replacing the Linux RAM disk image at
the second address (0xfff20000
in the example above) by an empty
PPCBoot image, like this
one (do not forget to uncompress it with gunzip(1)
). Or use mkubootimage
to make your own dummy. Write it to flash as shown below. This will speed up
the boot process, but is not really required.
_MPC824X > tftp 1000000 dummy.img RTL8169#0 configured ARP broadcast 1 TFTP from server 192.168.0.5; our IP address is 192.168.0.107 Filename 'dummy.img'. Load address: 0x1000000 Loading: # done Bytes transferred = 64 (40 hex) _MPC824X > load -f 1000000 Flash: upgrade rootfs in unProtect FFF20000 ... FFFFFFFF Un-Protected 14 sectors Erasing Flash... ......... done Erased 14 sectors Writing to Flash... done
Have fun with your mini NetBSD server!