Annotation of wikisrc/ports/sandpoint/instnh23x.mdwn, revision 1.3

1.1       mspo        1: Introduction
                      2: ============
                      3: 
                      4: This document describes in depth how to prepare your NH-230/231 NAS for
1.2       phx         5: installing NetBSD/sandpoint. Models based on the NH-230 have an ITE PATA
1.1       mspo        6: controller while those based on the NH-231 have a SiliconImage SataLink
                      7: SATA controller. The following models are known to be compatible:
                      8: 
                      9: -   Allnet 6250 (PATA)
                     10: -   Allnet 6260 (SATA)
                     11: -   Encore ENNHD-1000 (PATA)
                     12: -   Fujitsu-Siemens AMS150 (SATA)
                     13: -   Fujitsu-Siemens SBLAN2 (SATA)
                     14: -   Lindy NAS Personal Server Premium, IDE (PATA)
                     15: -   Lindy NAS Personal Server Premium, SATA (SATA)
                     16: -   Longshine LCS-8311 (SATA)
                     17: -   Netronix NH-230 (PATA)
                     18: -   Netronix NH-231 (SATA)
                     19: -   Planex NAS-01G (PATA)
                     20: -   SinanPower GigaBit LAN NAS-349 (SATA)
                     21: -   Vibe NS-349-S (SATA)
                     22: 
                     23: The hardware shown in these instructions is an Allnet 6250.
                     24: 
                     25: Accessing the serial interface
                     26: ==============================
                     27: 
                     28: We need a serial console to get access to the firmware. Therefore you
                     29: have to open the case and connect a serial adapter, which converts the
                     30: NH-230/231 TTL levels to RS232 levels. You will also have to make a plug
                     31: for the 4-pin serial header on the board.
                     32: 
                     33: Locate the serial port
                     34: ----------------------
                     35: 
                     36: Look out for a 4-pin header, which is labeled `J6` on an Allnet 6250
                     37: board.
                     38: 
                     39: <table>
                     40: <tbody>
                     41: <tr class="odd">
                     42: <td align="left"><table>
                     43: <tbody>
                     44: <tr class="odd">
                     45: <td align="left"><strong>Pin number</strong></td>
                     46: <td align="left"><strong>Function</strong></td>
                     47: </tr>
                     48: <tr class="even">
                     49: <td align="left">1</td>
                     50: <td align="left">3.3V</td>
                     51: </tr>
                     52: <tr class="odd">
                     53: <td align="left">2</td>
                     54: <td align="left">TXD</td>
                     55: </tr>
                     56: <tr class="even">
                     57: <td align="left">3</td>
                     58: <td align="left">RXD</td>
                     59: </tr>
                     60: <tr class="odd">
                     61: <td align="left">4</td>
                     62: <td align="left">GND</td>
                     63: </tr>
                     64: </tbody>
                     65: </table></td>
1.3     ! phx        66: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/nhnas_ser_header.jpg" alt="Serial port header" /></td>
1.1       mspo       67: </tr>
                     68: </tbody>
                     69: </table>
                     70: 
                     71: Connect a serial terminal via a converter
                     72: -----------------------------------------
                     73: 
                     74: The serial port on the NH-230/231 compatibles is using 3.3V TTL levels,
                     75: which have to be converted into regular RS232 levels by a level shifter
                     76: circuit. Instructions how to build such a circuit yourself can be found
                     77: here:
                     78: 
                     79: -   Serial adapter for 3.3V TTL
                     80: 
                     81: Make sure that the layout of the connector fits to the pinout of the
                     82: boards serial header, as shown above.
                     83: 
                     84: Another option is to buy such a converter. There are solutions for a
                     85: standard RS232 interface and for an USB interface. Look out for:
                     86: 
                     87: -   RS232 level shifter / breakout board (MAX3232 based)
                     88: -   USB to TLL serial level shifter / breakout board (FT232 based)
                     89: 
                     90: Now you can connect with any terminal program to the NH-230/231 serial
1.2       phx        91: console. The easiest approach may be to use NetBSD's `tip(1)` command to
1.1       mspo       92: make a direct console connection at 9600bps.
                     93: 
                     94:     # tip console
                     95: 
                     96: Note that when using a serial connection via USB you may have to make an
                     97: entry for `/dev/ttyU0` in `/etc/remote`.
                     98: 
                     99: First time installation
                    100: =======================
                    101: 
                    102: The altboot bootloader
                    103: ----------------------
                    104: 
                    105: The `altboot(8)` utility functions as a bridge between the PPCBoot
1.2       phx       106: firmware and the NetBSD kernel startup environment. NAS firmware often
1.1       mspo      107: provides no means to boot a kernel from disk or from the network and
                    108: doesn't initialize all hardware correctly. We will also use it to pass a
                    109: bootinfo list to the kernel.
                    110: 
                    111: The `altboot` boot loader has to be loaded and started using the
                    112: NH-230/231 firmware, which is `PPCBoot 2.0.0-A9`.
                    113: 
                    114:     PPCBoot 2.0.0-A9 (Feb 13 2006 - 14:56:11)
                    115: 
                    116:     CPU:   MPC8241 Revision 1.4 at 266.666 MHz: 16 kB I-Cache 16 kB D-Cache
                    117:     Board: Sandpoint 8241 Unity ##Test not implemented yet##
                    118:     DRAM:  64 MB
                    119:     FLASH: Manufacturer code: 0xEC, Device code: 0xA2 :  4 MB
                    120:     In:    serial
                    121:     Out:   serial
                    122:     Err:   serial
                    123:     EPIC: reset is in process ....doneNet:   
                    124:     RTL8169S driver v1.5-A4  03-15-2005
                    125:     RTL8169#0
                    126:     Press space to abort autoboot in 3 second
                    127: 
                    128: The functionality of this NH-230/231 PPCBoot version is restricted.
                    129: Probably to keep it small and to save space for a Linux kernel and
                    130: ramdisk in the 4MB Flash, but also to keep the user from hacking it. It
                    131: only allows to overwrite four predefined regions of the flash with
                    132: special `load` commands, and the lack of a `cp` command leaves us with
                    133: the only option to boot `altboot(8)` as a Linux kernel image through
                    134: `bootm`.
                    135: 
                    136: Getting altboot into RAM
                    137: ------------------------
                    138: 
                    139: The `altboot` boot loader has to be loaded and started using PPCBoot.
                    140: Usually there are three ways to invoke it:
                    141: 
                    142: -   loadb
                    143:     to load a binary file via serial line in kermit mode
                    144: -   tftpboot
                    145:     to load a binary file over the network with TFTP protocol
                    146: -   start it from the flash memory
                    147: 
                    148: The last option is prefered once the installation is completed, but
                    149: obviously it is not possible for the first time boot. Fortunately
                    150: PPCBoot has set up the network interface, which we can use after
                    151: configuring the `ipaddr` and `serverip` environment variables:
                    152: 
                    153:     _MPC824X > 
                    154:     _MPC824X > 
                    155:     _MPC824X > 
                    156:     Saving Environment to Flash...
                    157:     unProtect FFC00000 ... FFC01FFF
                    158:     Un-Protected 1 sectors
                    159:     Erasing Flash...
                    160:     . done
                    161:     Erased 1 sectors
                    162:     Writing to Flash... done
                    163:     Protected 1 sectors
                    164: 
                    165: Once you have set up TFTP and DHCP ([read below](#altboot_install)) you
                    166: can download `altboot` into RAM at `0x1000000` like this:
                    167: 
                    168:     _MPC824X > 
                    169:     TFTP from server 192.168.0.5; our IP address is 192.168.0.107
                    170:     Filename 'altboot.bin'.
                    171:     Load address: 0x1000000
                    172:     Loading: ################
                    173:     done
                    174:     Bytes transferred = 76884 (12c54 hex)
                    175: 
                    176: Boot the INSTALL kernel with altboot
                    177: ------------------------------------
                    178: 
                    179: Now you can use `altboot` to launch the `netbsd-INSTALL` kernel for
1.2       phx       180: installing NetBSD. You may choose to load it with TFTP or from NFS. For TFTP
1.1       mspo      181: you have to enable `tftpd(8)` in `/etc/inetd.conf`, and for NFS there is
                    182: a documentation at [The Network File
                    183: System](http://www.&os;.org/docs/guide/en/chap-net-services.html#chap-net-services-nfs).
                    184: But in both cases you have to set up a DHCP server, which is explained
                    185: in the [DHCP Howto](http://www.&os;.org/docs/network/dhcp.html). An
                    186: appropriate `dhcpd.conf` entry could look like this:
                    187: 
                    188:             host nh-nas {
                    189:                     hardware ethernet 00:08:54:xx:xx:xx;
                    190:                     fixed-address 192.168.0.107;
                    191:                     next-server 192.168.0.5;
                    192:                     option root-path "/export/nh-nas/root";
                    193:             }
                    194: 
                    195: The `root-path` option is only needed when using NFS and should match
                    196: your exported NFS directory. Uncompress `netbsd-INSTALL.gz` from the
1.2       phx       197: NetBSD/sandpoint distribution and copy it into the NFS or TFTP directory.
1.1       mspo      198: Then start the DHCP, NFS or TFTP server and boot the installation kernel
                    199: from the firmware either with
                    200: 
                    201:     _MPC824X > 
                    202: 
                    203: or from NFS:
                    204: 
                    205:     _MPC824X > 
                    206: 
                    207: Our bootloader configures the hardware, determines the IP address, loads
                    208: the kernel via network and launches it:
                    209: 
                    210:     ## Starting application at 0x01000000 ...
                    211: 
                    212:     >> NetBSD/sandpoint altboot, revision 1.9 (Thu Apr 26 21:37:17 CEST 2012)
                    213:     >> Netronix NH-230/231, cpu 264 MHz, bus 132 MHz, 64MB SDRAM
                    214:     channel 0 present
                    215:     wd0: <Maxtor 2B020H1> DMA LBA LBA48 19541 MB
                    216:     wd0: no disklabel
                    217:     MAC address 00:08:54:xx:xx:xx
                    218:     100Mbps-FDX
                    219:     Hit any key to enter interactive mode: 0
                    220:     loading "netbsd-INSTALL" 5365148+134572=0x53efd0
                    221:     entry=0x90000, ssym=0x5ceb48, esym=0x5cefd0
                    222:     Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
                    223:         2006, 2007, 2008, 2009, 2010, 2011, 2012
                    224:         The NetBSD Foundation, Inc.  All rights reserved.
                    225:     Copyright (c) 1982, 1986, 1989, 1991, 1993
                    226:         The Regents of the University of California.  All rights reserved.
                    227: 
                    228:     NetBSD 6.0_BETA (INSTALL)
                    229:     Model: nhnas
                    230:     total memory = 65536 KB
                    231:     avail memory = 57820 KB
                    232:     OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
                    233:     mainbus0 (root)
                    234:     cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
                    235:     cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
                    236:     cpu0: 264.00 MHz
                    237:     eumb0 at mainbus0
                    238:     com0 at eumb0 unit 0: ns16550a, working fifo
                    239:     com0: console
                    240:     com0: interrupting at irq 40
                    241:     ociic0 at eumb0
                    242:     iic0 at ociic0: I2C bus
                    243:     pcf8563rtc0 at iic0 addr 0x51: NXP PCF8563 Real-time Clock
                    244:     satmgr0 at eumb0 unit 1: button manager (not supported)
                    245:     nhpow0 at mainbus0: NH230/231 gpio board control, version 1
                    246:     nhpow0: interrupting at irq 20
                    247:     gpio0 at nhpow0: 8 pins
                    248:     cfi at mainbus0 not configured
                    249:     pci0 at mainbus0 bus 0
                    250:     pchb0 at pci0 dev 0 function 0
                    251:     pchb0: vendor 0x1057 product 0x0006 (rev. 0x14)
                    252:     ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
                    253:     ohci0: interrupting at irq 19
                    254:     ohci0: OHCI version 1.0
                    255:     usb0 at ohci0: USB revision 1.0
                    256:     ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
                    257:     ohci1: interrupting at irq 19
                    258:     ohci1: OHCI version 1.0
                    259:     usb1 at ohci1: USB revision 1.0
                    260:     ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
                    261:     ehci0: interrupting at irq 19
                    262:     ehci0: companion controllers, 3 ports each: ohci0 ohci1
                    263:     usb2 at ehci0: USB revision 2.0
                    264:     re0 at pci0 dev 15 function 0: RealTek 8169/8110 Gigabit Ethernet (rev. 0x10)
                    265:     re0: interrupting at irq 17
                    266:     re0: Ethernet address 00:08:54:xx:xx:xx
                    267:     rgephy0 at re0 phy 7: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 0
                    268:     rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
                    269:     iteide0 at pci0 dev 16 function 0: Integrated Technology Express IDE controller (rev. 0x11)
                    270:     iteide0: using irq 18 for native-PCI interrupt
                    271:     atabus0 at iteide0 channel 0
                    272:     atabus1 at iteide0 channel 1
                    273:     biomask 1c000000 netmask 1c000000 ttymask 1c000000
                    274:     uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
                    275:     uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
                    276:     uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
                    277:     wd0 at atabus0 drive 0
                    278:     wd0: <Maxtor 2B020H1>
                    279:     wd0: 19541 MB, 39703 cyl, 16 head, 63 sec, 512 bytes/sect x 40020624 sectors
                    280:     boot device: re0
                    281:     root on md0a dumps on md0b
                    282:     root file system type: ffs
                    283:     erase ^H, werase ^W, kill ^U, intr ^C, status ^T
                    284:     Terminal type? [vt100]
                    285: 
1.2       phx       286: Just follow the usual procedure to install a NetBSD system.
1.1       mspo      287: 
                    288: Sandpoint installation window
                    289: Post installation steps
                    290: =======================
                    291: 
                    292: After a successful installation you want to make the system boot
                    293: standalone when switched on, without the need for a serial console. So
                    294: you have to find a way to make your firmware automatically boot
                    295: `altboot` and the kernel.
                    296: 
                    297: Without a working `cp` command the only way to make your system
1.2       phx       298: automatically boot NetBSD is to replace the Linux kernel on flash by
1.1       mspo      299: `altboot.img`, which is our bootloader in PPCBoot image format, faking a
                    300: Linux kernel.
                    301: 
                    302: When viewing the environment variables with `printenv` you can see that
                    303: the `bootcmd` is calling `bootm` to load the Linux kernel. The first
                    304: address is the location which we have to overwrite with `altboot.img`.
                    305: Here it is `0xffc10000`, which you have to replace in all the following
                    306: commands, in case your `bootcmd` differs.
                    307: 
                    308:     bootcmd=bootm ffc10000 fff20000
                    309: 
                    310: Load `altboot.img` into memory, for example at `0x1000000` again, as
                    311: explained [above](#altboot). You might want to backup the Linux kernel
                    312: image first. Then execute the following commands to overwrite it with
                    313: `altboot.img`:
                    314: 
                    315:     _MPC824X > 
                    316:     Flash: upgrade Linux kernel in unProtect FFC10000 ... FFD8FFFF
                    317:     Un-Protected 24 sectors
                    318:     Erasing Flash...
                    319:     ............. done
                    320:     Erased 24 sectors
                    321:     Writing to Flash... done
                    322: 
                    323: Additionally you may think about replacing the Linux RAM disk image at
                    324: the second address (`0xfff20000` in the example above) by an empty
                    325: PPCBoot image, like [this](dummy.img.gz) one (do not forget to
                    326: uncompress it with `gunzip(1)`). Or use `mkubootimage` to make your own
                    327: dummy. Write it to flash as shown below. This will speed up the boot
                    328: process, but is not really required.
                    329: 
                    330:     _MPC824X > 
                    331:     RTL8169#0 configured
                    332:     ARP broadcast 1
                    333:     TFTP from server 192.168.0.5; our IP address is 192.168.0.107
                    334:     Filename 'dummy.img'.
                    335:     Load address: 0x1000000
                    336:     Loading: #
                    337:     done
                    338:     Bytes transferred = 64 (40 hex)
                    339:     _MPC824X > 
                    340:     Flash: upgrade rootfs in unProtect FFF20000 ... FFFFFFFF
                    341:     Un-Protected 14 sectors
                    342:     Erasing Flash...
                    343:     ......... done
                    344:     Erased 14 sectors
                    345:     Writing to Flash... done
                    346: 
1.2       phx       347: Have fun with your mini NetBSD server!

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb