File:  [NetBSD Developer Wiki] / wikisrc / ports / sandpoint / instqnap.mdwn
Revision 1.5: download - view: text, annotated - select for diffs
Sun Feb 25 14:34:03 2018 UTC (4 years, 9 months ago) by jdc
Branches: MAIN
CVS tags: HEAD
Add missing "go 1000000" command to the initial boot instructions.

    1: Introduction
    2: ============
    3: 
    4: <table>
    5: <tbody>
    6: <tr class="odd">
    7: <td align="left"><p>This document describes in depth how to prepare your QNAP Turbo Station for installing NetBSD/sandpoint. The following models are supported:</p>
    8: <ul>
    9: <li>TS-100 (32MB, 200MHz, Intel GBit Ethernet, V1.02 board)</li>
   10: <li>TS-100 (32MB, 200MHz, Realtek GBit Ethernet, V200 board)</li>
   11: <li>TS-101 (64MB, 266MHz, Intel GBit Ethernet, V1.02 board)</li>
   12: <li>TS-101 (64MB, 266MHz, Realtek GBit Ethernet, V200 board)</li>
   13: <li>TS-201 (128MB, 266MHz, Realtek GBit Ethernet)</li>
   14: </ul>
   15: <p>To install NetBSD/sandpoint you will have to open the case, to get access to the serial console, and connect a serial converter from TTL to RS232 signal levels.</p></td>
   16: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/qnap_front.jpg" alt="TS-101 front view" /></td>
   17: </tr>
   18: </tbody>
   19: </table>
   20: 
   21: Accessing the serial interface
   22: ==============================
   23: 
   24: Locate the serial header
   25: ------------------------
   26: 
   27: There is a 6-pin header near the LEDs, labeled `JP2`. On the V1.02 board
   28: it is a male connector with pins (left picture), while it is a female
   29: socket on V200 boards (right picture). Nevertheless, the signal
   30: assignments on both connectors are the same.
   31: 
   32: <table>
   33: <tbody>
   34: <tr class="odd">
   35: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/qnap_v102board.jpg" alt="TS-101 V1.02 board" /></td>
   36: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/qnap_v200board.jpg" alt="TS-101 V200 board" /></td>
   37: </tr>
   38: </tbody>
   39: </table>
   40: 
   41: **Serial header pin assignments (both boards):**
   42: 
   43: <table>
   44: <tbody>
   45: <tr class="odd">
   46: <td align="left"><table>
   47: <tbody>
   48: <tr class="odd">
   49: <td align="left"><strong>Pin number</strong></td>
   50: <td align="left"><strong>Function</strong></td>
   51: </tr>
   52: <tr class="even">
   53: <td align="left">1</td>
   54: <td align="left">3.3V</td>
   55: </tr>
   56: <tr class="odd">
   57: <td align="left">2</td>
   58: <td align="left">GND</td>
   59: </tr>
   60: <tr class="even">
   61: <td align="left">4</td>
   62: <td align="left">TX</td>
   63: </tr>
   64: <tr class="odd">
   65: <td align="left">6</td>
   66: <td align="left">RX</td>
   67: </tr>
   68: </tbody>
   69: </table></td>
   70: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/qnap_ser_pins.jpg" alt="Header pin assignments" /></td>
   71: </tr>
   72: </tbody>
   73: </table>
   74: 
   75: Connect a serial cable
   76: ----------------------
   77: 
   78: The Turbo Station's serial port is using 3.3V TTL levels, which have to
   79: be converted into regular RS232 levels by a level shifter circuit. If
   80: you are not anxious using a soldering iron you find detailed
   81: instructions how to build such a converter here:
   82: 
   83: -   [Serial adapter for 3.3V TTL](http://www.netbsd.org/ports/sandpoint/ttl2rs232.html)
   84: 
   85: Another option is to buy such a converter. There are solutions for a
   86: standard RS232 interface and for an USB interface. Look out for:
   87: 
   88: -   RS232 level shifter / breakout board (MAX3232 based)
   89: -   USB to TLL serial level shifter / breakout board (FT232 based)
   90: 
   91: First installation
   92: ==================
   93: 
   94: Accessing the Firmware
   95: ----------------------
   96: 
   97: Provided the serial converter is installed and working correctly you
   98: should be able to connect to the firmware's serial console. QNAP is
   99: using [U-Boot](http://www.denx.de/wiki/U-Boot/), the Universal Boot
  100: Loader.
  101: 
  102: Now you can connect with any terminal program to the Turbo Station's
  103: serial console. The easiest approach may be to use NetBSD's `tip(1)` command
  104: to make a direct console connection at 115200bps.
  105: 
  106:     # tip -115200 console
  107: 
  108: Note that when using a serial connection via USB you may have to make an
  109: entry for `/dev/ttyU0` in `/etc/remote`.
  110: 
  111: Immediately after switching your Turbo Station on it will display the
  112: following information (output is from a TS-101) and gives you two
  113: seconds to stop autobooting.
  114: 
  115:     U-Boot 1.1.2 (Aug 28 2005 - 13:37:25) QNAP System, Inc.
  116: 
  117:     CPU:   MPC8245 Revision 1.4 at 266.666 MHz: 16 kB I-Cache 16 kB D-Cache
  118:     Board: Sandpoint 8245 Unity ##Test not implemented yet##
  119:     I2C:   ready
  120:     DRAM:  64 MB
  121:     FLASH: S29GL128N, 16 MB
  122:     In:    serial
  123:     Out:   serial
  124:     Err:   serial
  125:     Net:   No ethernet found.
  126:     Hit any key to stop autoboot:  1
  127: 
  128: altboot
  129: -------
  130: 
  131: The `altboot(8)` utility functions as a bridge between the QNAP firmware
  132: and the NetBSD kernel startup environment. NAS firmware often provides no
  133: means to boot a kernel from disk or from the network and doesn't
  134: initialize all hardware correctly. We will also use it to pass a
  135: bootinfo list to the kernel.
  136: 
  137: The `altboot` boot loader has to be loaded and started using U-Boot.
  138: Usually there are three ways to invoke it:
  139: 
  140: -   **loadb** to load a binary file via serial line in kermit mode
  141: -   **tftpboot** to load a binary file over the network with TFTP protocol
  142: -   start it from the flash memory
  143: 
  144: The last option is prefered once the installation is completed, but
  145: obviously it is not possible for the first time boot. As QNAP's U-Boot
  146: also lacks network functionalities in this version, we will download
  147: `altboot` into RAM with Kermit protocol over the serial line.
  148: 
  149: Install `kermit(1)` from `pkgsrc(7)` or compile and install it yourself.
  150: To set up the file transfer you have to provide the following commands
  151: to kermit:
  152: 
  153:     set line /dev/tty00
  154:     set speed 115200
  155:     set carrier-watch off
  156:     set flow-control none
  157:     robust
  158:     set file type bin
  159: 
  160: For convenience you can write them into a file which you can pass as an
  161: argument to `kermit`.
  162: 
  163: Load `altboot` into memory with Kermit protocol. The binary is relocated
  164: at 0x1000000, so type:
  165: 
  166: <pre>
  167: =&gt; <strong>loadb 1000000</strong>
  168: ## Ready for binary (kermit) download to 0x01000000 at 115200 bps...
  169: </pre>
  170: 
  171: Now quit your terminal program and launch **kermit cmdfile**. When you are
  172: already running `kermit` enter the command mode by typing **CTRL-\\**
  173: followed by **C**. Then send `altboot.bin`. Reconnect when the transfer is
  174: finished.
  175: 
  176: <pre>
  177: C-Kermit 8.0.211, 10 Apr 2004, for NetBSD 1.6
  178:  Copyright (C) 1985, 2004,
  179:   Trustees of Columbia University in the City of New York.
  180: Type ? or HELP for help.
  181: (/tmp/) C-Kermit><strong>send path_to/altboot.bin</strong>
  182: </pre>
  183: 
  184: Boot the INSTALL kernel with altboot
  185: ------------------------------------
  186: 
  187: Now you can use `altboot` to launch the `netbsd-INSTALL` kernel for
  188: installing NetBSD. You may choose to load it via TFTP or from NFS. For TFTP
  189: you have to enable `tftpd(8)` in `/etc/inetd.conf`, and for NFS there is
  190: a documentation at [The Network File
  191: System](http://www.NetBSD.org/docs/guide/en/chap-net-services.html#chap-net-services-nfs).
  192: But in both cases you have to set up a DHCP server, which is explained
  193: in the [DHCP Howto](http://www.NetBSD.org/docs/network/dhcp.html). An
  194: appropriate `dhcpd.conf` entry could look like this:
  195: 
  196:             host turbostation {
  197:                     hardware ethernet 00:e0:4c:xx:xx:xx;
  198:                     fixed-address 192.168.0.104;
  199:                     next-server 192.168.0.1;
  200:                     option root-path "/export/turbostation/root";
  201:             }
  202: 
  203: The `root-path` option is only needed when using NFS and should match
  204: your exported NFS directory. Uncompress `netbsd-INSTALL.gz` from the
  205: NetBSD/sandpoint distribution and copy it into the NFS or TFTP directory.
  206: 
  207: Run altboot and press a key to enter interactive mode:
  208: 
  209: <pre>
  210: =&gt; <strong>go 1000000</strong>
  211: </pre>
  212: 
  213:     ## Starting application at 0x01000000 ...
  214: 
  215:     >> NetBSD/sandpoint altboot, revision 1.7 (Sat May 28 12:36:26 CEST 2011)
  216:     >> QNAP TS, cpu 265 MHz, bus 132 MHz, 64MB SDRAM
  217:     wd0: <SAMSUNG HD502HI> DMA LBA LBA48 476940 MB
  218:     wd0: no disklabel
  219:     MAC address 00:e0:4c:xx:xx:xx
  220:     100Mbps-FDX
  221:     Hit any key to enter interactive mode: 0
  222: 
  223: Then start the DHCP, NFS or TFTP server and boot the installation kernel
  224: from the firmware either with:
  225: 
  226: <pre>
  227: =&gt; <strong>tftp:netbsd-INSTALL</strong>
  228: </pre>
  229: 
  230: or from NFS:
  231: 
  232: <pre>
  233: =&gt; <strong>nfs:netbsd-INSTALL</strong>
  234: </pre>
  235: 
  236: At the time of writing the network transfer will fail for the first time
  237: after cold start. After an automatic reset, caused by five xmit
  238: failures, it should succeed. This will hopefully improve in future.
  239: 
  240: Our bootloader configures the hardware, determines the IP address, loads
  241: the kernel via network and launches it:
  242: 
  243:     loading "netbsd-INSTALL" 5143540+110580=0x503068
  244:     entry=0x90000, ssym=0x592be8, esym=0x593068
  245:     Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  246:         2006, 2007, 2008, 2009, 2010, 2011
  247:         The NetBSD Foundation, Inc.  All rights reserved.
  248:     Copyright (c) 1982, 1986, 1989, 1991, 1993
  249:         The Regents of the University of California.  All rights reserved.
  250: 
  251:     NetBSD 5.99.52 (INSTALL) #6: Sat May 28 12:44:03 CEST 2011
  252:         frank@compaq.owl.de:/home/frank/netbsd/current/src/sys/arch/sandpoint/compile/obj/INSTALL
  253:     total memory = 65536 KB
  254:     avail memory = 57980 KB
  255:     OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
  256:     mainbus0 (root)
  257:     cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
  258:     cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
  259:     eumb0 at mainbus0
  260:     com0 at eumb0 unit 0: ns16550a, working fifo
  261:     com0: console
  262:     com0: interrupting at irq 40
  263:     ociic0 at eumb0
  264:     iic0 at ociic0: I2C bus
  265:     s390rtc0 at iic0 addr 0x30: Seiko Instruments 35390A Real-time Clock
  266:     satmgr0 at eumb0 unit 1: button manager (qnap)
  267:     satmgr0: interrupting at irq 41
  268:     pci0 at mainbus0 bus 0
  269:     pchb0 at pci0 dev 0 function 0
  270:     pchb0: vendor 0x1057 product 0x0006 (rev. 0x14)
  271:     satalink0 at pci0 dev 13 function 0: Silicon Image SATALink 3512 (rev. 0x01)
  272:     satalink0: using irq 16 for native-PCI interrupt
  273:     atabus0 at satalink0 channel 0
  274:     atabus1 at satalink0 channel 1
  275:     ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
  276:     ohci0: interrupting at irq 17
  277:     ohci0: OHCI version 1.0
  278:     usb0 at ohci0: USB revision 1.0
  279:     ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
  280:     ohci1: interrupting at irq 17
  281:     ohci1: OHCI version 1.0
  282:     usb1 at ohci1: USB revision 1.0
  283:     ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
  284:     ehci0: interrupting at irq 17
  285:     ehci0: companion controllers, 3 ports each: ohci0 ohci1
  286:     usb2 at ehci0: USB revision 2.0
  287:     re0 at pci0 dev 15 function 0: RealTek 8169SC/8110SC Single-chip Gigabit Ethernet (rev. 0x10)
  288:     re0: interrupting at irq 18
  289:     re0: Ethernet address 00:e0:4c:xx:xx:xx
  290:     rgephy0 at re0 phy 7: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 2
  291:     rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
  292:     biomask 8000038 netmask 8000038 ttymask 8000038
  293:     satalink0: port 0: device present, speed: 1.5Gb/s
  294:     wd0 at atabus0 drive 0
  295:     wd0: <SAMSUNG HD502HI>
  296:     wd0: 465 GB, 969021 cyl, 16 head, 63 sec, 512 bytes/sect x 976773168 sectors
  297:     uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
  298:     uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
  299:     uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
  300:     boot device: re0
  301:     root on md0a dumps on md0b
  302:     root file system type: ffs
  303:     erase ^H, werase ^W, kill ^U, intr ^C, status ^T
  304:     Terminal type? [vt100]
  305: 
  306: Just follow the usual procedure to install a NetBSD system.
  307: 
  308: <img src="//www.netbsd.org/images/ports/sandpoint/install_window.jpg" alt="Sandpoint installation window" /></td>
  309: 
  310: Post installation steps
  311: =======================
  312: 
  313: After a successful installation you want to make the system boot
  314: standalone when switched on, without the need for a serial console. So
  315: you have to modify the `bootcmd` in U-Boot's environment and write the
  316: `altboot.bin` binary to the Flash ROM.
  317: 
  318: To find a suitable place in the Flash ROM you can use the **flinfo**
  319: command and look out for empty sectors `(E)`. On my Turbo Station I have
  320: chosen `0xffe20000`. Replace that in all the following commands if you
  321: have chosen a different address.
  322: 
  323: Load `altboot.bin` into memory at `0x1000000` again, as explained above.
  324: Then execute the following commands to write it to Flash ROM:
  325: 
  326: <pre>
  327: =&gt; <strong>protect off ffe20000 ffe3ffff</strong>
  328: Un-Protected 1 sectors
  329: =&gt; <strong>erase ffe20000 ffe3ffff</strong>
  330: . done
  331: Erased 1 sectors
  332: =&gt; <strong>cp.b 1000000 ffe20000 18000</strong>
  333: Copy to Flash... done
  334: =&gt; <strong>protect on ffe20000 ffe3ffff</strong>
  335: Protected 1 sectors
  336: </pre>
  337: 
  338: Finally adapt the `bootcmd` environment string to autoboot `altboot` and
  339: start the `netbsd` kernel (which is the default name) from `wd0` on each
  340: reboot:
  341: 
  342: <pre>
  343: =&gt; <strong>setenv bootcmd cp.b ffe20000 1000000 18000\; go 1000000 wd0:</strong>
  344: =&gt; <strong>saveenv</strong>
  345: Saving Environment to Flash...
  346: Un-Protected 1 sectors
  347: Erasing Flash...
  348: . done
  349: Erased 1 sectors
  350: Writing to Flash... done
  351: Protected 1 sectors
  352: </pre>
  353: 
  354: The `\` is important for **setenv** not to misinterpret the `;` as the end
  355: of the command.
  356: 
  357: Have fun with your mini NetBSD server!

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