File:  [NetBSD Developer Wiki] / wikisrc / ports / sandpoint / instnh23x.mdwn
Revision 1.5: download - view: text, annotated - select for diffs
Sat Sep 5 19:18:06 2015 UTC (7 years ago) by phx
Branches: MAIN
CVS tags: HEAD
Fix dummy.img.gz path.

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

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