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

1.1       mspo        1: Introduction
                      2: ============
                      3: 
                      4: <table>
                      5: <tbody>
                      6: <tr class="odd">
1.2       phx         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>
1.1       mspo        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>
1.2       phx        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>
1.3     ! phx        16: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/qnap_front.jpg" alt="TS-101 front view" /></td>
1.1       mspo       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">
1.3     ! phx        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>
1.1       mspo       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>
1.3     ! phx        70: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/qnap_ser_pins.jpg" alt="Header pin assignments" /></td>
1.1       mspo       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
                     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
1.2       phx       103: serial console. The easiest approach may be to use NetBSD's `tip(1)` command
1.1       mspo      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
1.2       phx       132: and the NetBSD kernel startup environment. NAS firmware often provides no
1.1       mspo      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
                    141:     to load a binary file via serial line in kermit mode
                    142: -   tftpboot
                    143:     to load a binary file over the network with TFTP protocol
                    144: -   start it from the flash memory
                    145: 
                    146: The last option is prefered once the installation is completed, but
                    147: obviously it is not possible for the first time boot. As QNAP's U-Boot
                    148: also lacks network functionalities in this version, we will download
                    149: `altboot` into RAM with Kermit protocol over the serial line.
                    150: 
                    151: Install `kermit(1)` from `pkgsrc(7)` or compile and install it yourself.
                    152: To set up the file transfer you have to provide the following commands
                    153: to kermit:
                    154: 
                    155:     set line /dev/tty00
                    156:     set speed 115200
                    157:     set carrier-watch off
                    158:     set flow-control none
                    159:     robust
                    160:     set file type bin
                    161: 
                    162: For convenience you can write them into a file which you can pass as an
                    163: argument to `kermit`.
                    164: 
                    165: Load `altboot` into memory with Kermit protocol. The binary is relocated
                    166: at 0x1000000, so type:
                    167: 
                    168:     => 
                    169:     ## Ready for binary (kermit) download to 0x01000000 at 115200 bps...
                    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:     C-Kermit 8.0.211, 10 Apr 2004, for NetBSD 1.6
                    177:      Copyright (C) 1985, 2004,
                    178:       Trustees of Columbia University in the City of New York.
                    179:     Type ? or HELP for help.
                    180:     (/tmp/) C-Kermit>
                    181: 
                    182: Boot the INSTALL kernel with altboot
                    183: ------------------------------------
                    184: 
                    185: Now you can use `altboot` to launch the `netbsd-INSTALL` kernel for
1.2       phx       186: installing NetBSD. You may choose to load it via TFTP or from NFS. For TFTP
1.1       mspo      187: you have to enable `tftpd(8)` in `/etc/inetd.conf`, and for NFS there is
                    188: a documentation at [The Network File
                    189: System](http://www.NetBSD.org/docs/guide/en/chap-net-services.html#chap-net-services-nfs).
                    190: But in both cases you have to set up a DHCP server, which is explained
                    191: in the [DHCP Howto](http://www.NetBSD.org/docs/network/dhcp.html). An
                    192: appropriate `dhcpd.conf` entry could look like this:
                    193: 
                    194:             host turbostation {
                    195:                     hardware ethernet 00:e0:4c:xx:xx:xx;
                    196:                     fixed-address 192.168.0.104;
                    197:                     next-server 192.168.0.1;
                    198:                     option root-path "/export/turbostation/root";
                    199:             }
                    200: 
                    201: The `root-path` option is only needed when using NFS and should match
                    202: your exported NFS directory. Uncompress `netbsd-INSTALL.gz` from the
1.2       phx       203: NetBSD/sandpoint distribution and copy it into the NFS or TFTP directory.
1.1       mspo      204: Then start the DHCP, NFS or TFTP server and boot the installation kernel
                    205: from the firmware either with
                    206: 
                    207:     => 
                    208: 
                    209: or from NFS:
                    210: 
                    211:     => 
                    212: 
                    213: At the time of writing the network transfer will fail for the first time
                    214: after cold start. After an automatic reset, caused by five xmit
                    215: failures, it should succeed. This will hopefully improve in future.
                    216: 
                    217: Our bootloader configures the hardware, determines the IP address, loads
                    218: the kernel via network and launches it:
                    219: 
                    220:     ## Starting application at 0x01000000 ...
                    221: 
                    222:     >> NetBSD/sandpoint altboot, revision 1.7 (Sat May 28 12:36:26 CEST 2011)
                    223:     >> QNAP TS, cpu 265 MHz, bus 132 MHz, 64MB SDRAM
                    224:     wd0: <SAMSUNG HD502HI> DMA LBA LBA48 476940 MB
                    225:     wd0: no disklabel
                    226:     MAC address 00:e0:4c:xx:xx:xx
                    227:     100Mbps-FDX
                    228:     Hit any key to enter interactive mode: 0
                    229:     loading "netbsd-INSTALL" 5143540+110580=0x503068
                    230:     entry=0x90000, ssym=0x592be8, esym=0x593068
                    231:     Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
                    232:         2006, 2007, 2008, 2009, 2010, 2011
                    233:         The NetBSD Foundation, Inc.  All rights reserved.
                    234:     Copyright (c) 1982, 1986, 1989, 1991, 1993
                    235:         The Regents of the University of California.  All rights reserved.
                    236: 
                    237:     NetBSD 5.99.52 (INSTALL) #6: Sat May 28 12:44:03 CEST 2011
                    238:         frank@compaq.owl.de:/home/frank/netbsd/current/src/sys/arch/sandpoint/compile/obj/INSTALL
                    239:     total memory = 65536 KB
                    240:     avail memory = 57980 KB
                    241:     OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
                    242:     mainbus0 (root)
                    243:     cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
                    244:     cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
                    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:     s390rtc0 at iic0 addr 0x30: Seiko Instruments 35390A Real-time Clock
                    252:     satmgr0 at eumb0 unit 1: button manager (qnap)
                    253:     satmgr0: interrupting at irq 41
                    254:     pci0 at mainbus0 bus 0
                    255:     pchb0 at pci0 dev 0 function 0
                    256:     pchb0: vendor 0x1057 product 0x0006 (rev. 0x14)
                    257:     satalink0 at pci0 dev 13 function 0: Silicon Image SATALink 3512 (rev. 0x01)
                    258:     satalink0: using irq 16 for native-PCI interrupt
                    259:     atabus0 at satalink0 channel 0
                    260:     atabus1 at satalink0 channel 1
                    261:     ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
                    262:     ohci0: interrupting at irq 17
                    263:     ohci0: OHCI version 1.0
                    264:     usb0 at ohci0: USB revision 1.0
                    265:     ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
                    266:     ohci1: interrupting at irq 17
                    267:     ohci1: OHCI version 1.0
                    268:     usb1 at ohci1: USB revision 1.0
                    269:     ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
                    270:     ehci0: interrupting at irq 17
                    271:     ehci0: companion controllers, 3 ports each: ohci0 ohci1
                    272:     usb2 at ehci0: USB revision 2.0
                    273:     re0 at pci0 dev 15 function 0: RealTek 8169SC/8110SC Single-chip Gigabit Ethernet (rev. 0x10)
                    274:     re0: interrupting at irq 18
                    275:     re0: Ethernet address 00:e0:4c:xx:xx:xx
                    276:     rgephy0 at re0 phy 7: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 2
                    277:     rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
                    278:     biomask 8000038 netmask 8000038 ttymask 8000038
                    279:     satalink0: port 0: device present, speed: 1.5Gb/s
                    280:     wd0 at atabus0 drive 0
                    281:     wd0: <SAMSUNG HD502HI>
                    282:     wd0: 465 GB, 969021 cyl, 16 head, 63 sec, 512 bytes/sect x 976773168 sectors
                    283:     uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
                    284:     uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
                    285:     uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
                    286:     boot device: re0
                    287:     root on md0a dumps on md0b
                    288:     root file system type: ffs
                    289:     erase ^H, werase ^W, kill ^U, intr ^C, status ^T
                    290:     Terminal type? [vt100]
                    291: 
1.2       phx       292: Just follow the usual procedure to install a NetBSD system.
1.1       mspo      293: 
                    294: Sandpoint installation window
                    295: Post installation steps
                    296: =======================
                    297: 
                    298: After a successful installation you want to make the system boot
                    299: standalone when switched on, without the need for a serial console. So
                    300: you have to modify the `bootcmd` in U-Boot's environment and write the
                    301: `altboot.bin` binary to the Flash ROM.
                    302: 
                    303: To find a suitable place in the Flash ROM you can use the `flinfo`
                    304: command and look out for empty sectors `(E)`. On my Turbo Station I have
                    305: chosen `0xffe20000`. Replace that in all the following commands if you
                    306: have chosen a different address.
                    307: 
                    308: Load `altboot.bin` into memory at `0x1000000` again, as explained above.
                    309: Then execute the following commands to write it to Flash ROM:
                    310: 
                    311:     => protect off ffe20000 ffe3ffff
                    312:     Un-Protected 1 sectors
                    313:     => erase ffe20000 ffe3ffff
                    314:     . done
                    315:     Erased 1 sectors
                    316:     => cp.b 1000000 ffe20000 18000
                    317:     Copy to Flash... done
                    318:     => protect on ffe20000 ffe3ffff
                    319:     Protected 1 sectors
                    320: 
                    321: Finally adapt the `bootcmd` environment string to autoboot `altboot` and
                    322: start the `netbsd` kernel (which is the default name) from `wd0` on each
                    323: reboot:
                    324: 
                    325:     => setenv bootcmd cp.b ffe20000 1000000 18000\; go 1000000 wd0:
                    326:     => saveenv
                    327:     Saving Environment to Flash...
                    328:     Un-Protected 1 sectors
                    329:     Erasing Flash...
                    330:     . done
                    331:     Erased 1 sectors
                    332:     Writing to Flash... done
                    333:     Protected 1 sectors
                    334: 
                    335: The `\` is important for `setenv` not to misinterpret the `;` as the end
                    336: of the command.
                    337: 
1.2       phx       338: Have fun with your mini NetBSD server!

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