File:  [NetBSD Developer Wiki] / wikisrc / ports / sandpoint / instsynology.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Thu Oct 31 21:05:10 2013 UTC (9 years, 1 month ago) by mspo
Branches: MAIN
CVS tags: HEAD
fix sandpoint links

    1: Introduction
    2: ============
    3: 
    4: This document describes in depth how to prepare your Synology
    5: Diskstation for installing OS/sandpoint. The following models are
    6: supported:
    7: 
    8: <table>
    9: <tbody>
   10: <tr class="odd">
   11: <td align="left"><strong>Model</strong></td>
   12: <td align="left"><strong>CPU</strong></td>
   13: <td align="left"><strong>Clock</strong></td>
   14: <td align="left"><strong>Disk</strong></td>
   15: <td align="left"><strong>RAM</strong></td>
   16: </tr>
   17: <tr class="even">
   18: <td align="left">DS-101g+</td>
   19: <td align="left">MPC8241</td>
   20: <td align="left">266MHz</td>
   21: <td align="left">SATA</td>
   22: <td align="left">64MB</td>
   23: </tr>
   24: <tr class="odd">
   25: <td align="left">DS-106</td>
   26: <td align="left">MPC8241</td>
   27: <td align="left">266MHz</td>
   28: <td align="left">SATA</td>
   29: <td align="left">64MB</td>
   30: </tr>
   31: <tr class="even">
   32: <td align="left">DS-106e</td>
   33: <td align="left">MPC8241</td>
   34: <td align="left">266MHz</td>
   35: <td align="left">SATA</td>
   36: <td align="left">32MB</td>
   37: </tr>
   38: <tr class="odd">
   39: <td align="left">DS-106j</td>
   40: <td align="left">MPC8241</td>
   41: <td align="left">200MHz</td>
   42: <td align="left">PATA</td>
   43: <td align="left">32MB</td>
   44: </tr>
   45: <tr class="even">
   46: <td align="left">DS-106x</td>
   47: <td align="left">MPC8241</td>
   48: <td align="left">266MHz</td>
   49: <td align="left">SATA</td>
   50: <td align="left">128MB</td>
   51: </tr>
   52: <tr class="odd">
   53: <td align="left">CS/RS-406</td>
   54: <td align="left">MPC8245</td>
   55: <td align="left">400MHz</td>
   56: <td align="left">SATA</td>
   57: <td align="left">128MB</td>
   58: </tr>
   59: <tr class="even">
   60: <td align="left">CS-406e</td>
   61: <td align="left">MPC8241</td>
   62: <td align="left">266MHz</td>
   63: <td align="left">SATA</td>
   64: <td align="left">64MB</td>
   65: </tr>
   66: <tr class="odd">
   67: <td align="left">DS-107</td>
   68: <td align="left">MPC8241</td>
   69: <td align="left">266MHz</td>
   70: <td align="left">SATA</td>
   71: <td align="left">64MB</td>
   72: </tr>
   73: <tr class="even">
   74: <td align="left">DS-107e</td>
   75: <td align="left">MPC8241</td>
   76: <td align="left">266MHz</td>
   77: <td align="left">SATA</td>
   78: <td align="left">32MB</td>
   79: </tr>
   80: <tr class="odd">
   81: <td align="left">DS-207</td>
   82: <td align="left">MPC8241</td>
   83: <td align="left">266MHz</td>
   84: <td align="left">SATA</td>
   85: <td align="left">64/128MB</td>
   86: </tr>
   87: <tr class="even">
   88: <td align="left">CS-407e</td>
   89: <td align="left">MPC8241</td>
   90: <td align="left">266MHz</td>
   91: <td align="left">SATA</td>
   92: <td align="left">64MB</td>
   93: </tr>
   94: <tr class="odd">
   95: <td align="left">DS-108j</td>
   96: <td align="left">MPC8241</td>
   97: <td align="left">200MHz</td>
   98: <td align="left">SATA</td>
   99: <td align="left">32MB</td>
  100: </tr>
  101: <tr class="even">
  102: <td align="left">DS-109j</td>
  103: <td align="left">MPC8241</td>
  104: <td align="left">266MHz</td>
  105: <td align="left">SATA</td>
  106: <td align="left">32MB</td>
  107: </tr>
  108: <tr class="odd">
  109: <td align="left">DS-209j</td>
  110: <td align="left">MPC8241</td>
  111: <td align="left">266MHz</td>
  112: <td align="left">SATA</td>
  113: <td align="left">64MB</td>
  114: </tr>
  115: </tbody>
  116: </table>
  117: 
  118: To install OS/sandpoint you will have to open the case, to get access to
  119: the serial console, and connect a serial converter from TTL to RS232
  120: signal levels.
  121: 
  122: Accessing the serial interface
  123: ==============================
  124: 
  125: Locate the serial header
  126: ------------------------
  127: 
  128: Open the case and search for a 6-pin header, which is labeled `COM1` or
  129: `JP2`. The left photo shows a DS-101g+ and the right photo a DS-106j.
  130: Note that the serial header is rotated by 180 degrees between these two
  131: models:
  132: 
  133: <table>
  134: <tbody>
  135: <tr class="odd">
  136: <td align="left"><img src="../../images/ports/sandpoint/syno_ser_header.jpg" alt=" Serial header in a DS-101g+ " /></td>
  137: <td align="left"><img src="../../images/ports/sandpoint/syno_ser_header106.jpg" alt=" Serial header in a DS-106j " /></td>
  138: </tr>
  139: </tbody>
  140: </table>
  141: 
  142: **Serial header pin assignments:**
  143: 
  144: <table>
  145: <tbody>
  146: <tr class="odd">
  147: <td align="left"><table>
  148: <tbody>
  149: <tr class="odd">
  150: <td align="left"><strong>Pin number</strong></td>
  151: <td align="left"><strong>Function</strong></td>
  152: </tr>
  153: <tr class="even">
  154: <td align="left">1</td>
  155: <td align="left">3.3V</td>
  156: </tr>
  157: <tr class="odd">
  158: <td align="left">2</td>
  159: <td align="left">GND</td>
  160: </tr>
  161: <tr class="even">
  162: <td align="left">4</td>
  163: <td align="left">TX</td>
  164: </tr>
  165: <tr class="odd">
  166: <td align="left">6</td>
  167: <td align="left">RX</td>
  168: </tr>
  169: </tbody>
  170: </table></td>
  171: <td align="left"><img src="../../images/ports/sandpoint/syno_ser_pins.jpg" alt="Header pin assignments" /></td>
  172: </tr>
  173: </tbody>
  174: </table>
  175: 
  176: Watch out for the thick, white angle, which marks pin 1.
  177: 
  178: Connect a serial cable
  179: ----------------------
  180: 
  181: The serial port on Synology NAS boxes is using 3.3V TTL levels, which
  182: have to be converted into regular RS232 levels by a level shifter
  183: circuit. If you are not anxious using a soldering iron you find detailed
  184: instructions how to build such a converter here:
  185: 
  186: -   Serial adapter for 3.3V TTL
  187: 
  188: Serial adapter installed
  189: This picture shows the installed serial adapter. When the installation
  190: is completed, and the Diskstation is available over the network, you can
  191: remove the serial adapter again. You will only need it in emergency
  192: situations.
  193: 
  194: Another option is to buy such a converter. There are solutions for a
  195: standard RS232 interface and for an USB interface. Look out for:
  196: 
  197: -   RS232 level shifter / breakout board (MAX3232 based)
  198: -   USB to TLL serial level shifter / breakout board (FT232 based)
  199: 
  200: First installation
  201: ==================
  202: 
  203: Accessing the Firmware
  204: ----------------------
  205: 
  206: Provided the serial converter is installed and working correctly you
  207: should be able to connect to the firmware's serial console. Synology is
  208: using [PPCBoot](http://ppcboot.sourceforge.net/). Most models have
  209: version `2.0.0` installed, but the newer ones have network support and
  210: limited functionality ([read below](#post_install)).
  211: 
  212: Now you can connect with any terminal program to the Diskstation's
  213: serial console. The easiest approach may be to use OS's `tip(1)` command
  214: to make a direct console connection at 115200bps.
  215: 
  216:     # tip -115200 console
  217: 
  218: Note that when using a serial connection via USB you may have to make an
  219: entry for `/dev/ttyU0` in `/etc/remote`. Immediately after switching
  220: your Diskstation on it will beep shortly, and you should see the
  221: following messages. Type CTRL-C within one second to avoid autobooting.
  222: In old firmwares (2005) you have three seconds and may press any key.
  223: 
  224:     PPCBoot 2.0.0 (Jan 30 2007 - 14:27:41)
  225: 
  226:     CPU:   MPC8245 Revision 1.4 at 199.999 MHz: 16 kB I-Cache 16 kB D-Cache
  227:     I2C:   ready
  228:     DRAM:  DRAM BANK = 1
  229:     MAX_DRAM_SIZE = 2000000
  230:     MCCR1 = 75a80000
  231:     MCCR4 = 35363331
  232:     MSAR1 = 0
  233:     EMSAR1 = 0
  234:     MEAR1 = 1f
  235:     EMEAR1 = 0
  236:     MSAR2 = 0
  237:     EMSAR2 = 0
  238:     MEAR2 = 0
  239:     EMEAR2 = 0
  240:     MBER = 32000001
  241:     PICR1 = 141b98
  242:     PICR2 = 40604
  243:     32 MB
  244:     addr_sp=1f2ff78, id=1f2ff98, addr=1fc0000
  245:     FLASH: flash id = 49
  246:     vendor = 1, flash id = 49 (flash_id:49)
  247:      2 MB
  248:     *** Warning - bad CRC, using default environment
  249: 
  250:     In:    serial
  251:     Out:   serial
  252:     Err:   serial
  253:     Net:   SK98#0
  254:     Press Ctrl+C to abort autoboot in 1 second
  255: 
  256: altboot
  257: -------
  258: 
  259: The `altboot(8)` utility functions as a bridge between the Synology
  260: firmware and the OS kernel startup environment. NAS firmware often
  261: provides no means to boot a kernel from disk or from the network and
  262: doesn't initialize all hardware correctly. We will also use it to pass a
  263: bootinfo list to the kernel.
  264: 
  265: The `altboot` boot loader has to be loaded into RAM at `0x1000000` and
  266: started using PPCBoot / U-Boot. Usually there are three ways to invoke
  267: it:
  268: 
  269: -   loadb
  270:     to load a binary file via serial line in
  271:     kermit
  272:     mode
  273: -   tftpboot
  274:     to load a binary file over the network with TFTP protocol
  275: -   start it from the flash memory
  276: 
  277: The last option is prefered once the installation is completed, but
  278: obviously it is not possible for the first time boot. Newer firmwares
  279: (2007) support the use of the network interface by setting the `ipaddr`
  280: and `serverip` environment variables with `setenv`. Once you have set up
  281: TFTP and DHCP ([read below](#altboot_install)) you can download
  282: `altboot` like this:
  283: 
  284:     _MPC824X > 
  285:     _MPC824X > 
  286:     _MPC824X > 
  287:     ARP broadcast 1
  288:     TFTP from server 192.168.0.5; our IP address is 192.168.0.106
  289:     Filename 'altboot.bin'.
  290:     Load address: 0x1000000
  291:     Loading: ###############
  292:     done
  293:     Bytes transferred = 74732 (123ec hex)
  294: 
  295: The old firmware (2005) doesn't activate the network at all, so we have
  296: to download `altboot` into RAM with Kermit protocol over the serial
  297: line.
  298: 
  299: Install `kermit(1)` from `pkgsrc(7)` or compile and install it yourself.
  300: To set up the file transfer you have to provide the following commands
  301: to `kermit`:
  302: 
  303:     set line /dev/tty00
  304:     set speed 115200
  305:     set carrier-watch off
  306:     set flow-control none
  307:     robust
  308:     set file type bin
  309: 
  310: For convenience you can write them into a file which you can pass as an
  311: argument to `kermit`.
  312: 
  313: Load `altboot` into memory using Kermit protocol. The binary is
  314: relocated at `0x1000000`, so type:
  315: 
  316:     _MPC824X > 
  317:     ## Ready for binary (kermit) download ...
  318: 
  319: Now quit your terminal program and launch `kermit cmdfile`. When you are
  320: already running `kermit`, enter the command mode by typing `CTRL-\`
  321: followed by `C`. Then send `altboot.bin`. Reconnect when the transfer is
  322: finished.
  323: 
  324:     C-Kermit 8.0.211, 10 Apr 2004, for NetBSD 1.6
  325:      Copyright (C) 1985, 2004,
  326:       Trustees of Columbia University in the City of New York.
  327:     Type ? or HELP for help.
  328:     (/tmp/) C-Kermit>
  329: 
  330: Boot the INSTALL kernel with altboot
  331: ------------------------------------
  332: 
  333: Now you can use `altboot` to launch the `netbsd-INSTALL` kernel for
  334: installing OS. You may choose to load it with TFTP or from NFS. For TFTP
  335: you have to enable `tftpd(8)` in `/etc/inetd.conf`, and for NFS there is
  336: a documentation at [The Network File
  337: System](http://www.NetBSD.org/docs/guide/en/chap-net-services.html#chap-net-services-nfs).
  338: But in both cases you have to set up a DHCP server, which is explained
  339: in the [DHCP Howto](http://www.NetBSD.org/docs/network/dhcp.html). An
  340: appropriate `dhcpd.conf` entry could look like this:
  341: 
  342:             host ds101g {
  343:                     hardware ethernet 00:11:32:xx:xx:xx;
  344:                     fixed-address 192.168.0.101;
  345:                     next-server 192.168.0.1;
  346:                     option root-path "/export/ds101g/root";
  347:             }
  348: 
  349: The `root-path` option is only needed when using NFS and should match
  350: your exported NFS directory. Uncompress `netbsd-INSTALL.gz` from the
  351: OS/sandpoint distribution and copy it into the NFS or TFTP directory.
  352: Then start the DHCP, NFS or TFTP server and boot the installation kernel
  353: from the firmware either with
  354: 
  355:     _MPC824X > 
  356: 
  357: or from NFS:
  358: 
  359:     _MPC824X > 
  360: 
  361: Our bootloader configures the hardware, determines the IP address, loads
  362: the kernel via network and launches it:
  363: 
  364:     ## Starting application at 0x01000000 ...
  365: 
  366:     >> NetBSD/sandpoint altboot, revision 1.5 (Fri Feb 18 23:21:15 CET 2011)
  367:     >> Synology DS, cpu 265 MHz, bus 132 MHz, 64MB SDRAM
  368:     channel 0 present
  369:     wd0: <SAMSUNG HD502HI> DMA LBA LBA48 476940 MB
  370:     wd0: no disklabel
  371:     MAC address 00:11:32:xx:xx:xx
  372:     100Mbps-FDX
  373:     loading "netbsd-INSTALL" 5089380+110916=0x4f5d6c
  374:     entry=0x00090000, ssym=0x005859a8, esym=0x00585d6c
  375:     ksyms: Symbol table not found
  376:     ksyms: String table not found
  377:     ksyms: Perhaps the kernel is stripped?
  378:     Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  379:         2006, 2007, 2008, 2009, 2010, 2011
  380:         The NetBSD Foundation, Inc.  All rights reserved.
  381:     Copyright (c) 1982, 1986, 1989, 1991, 1993
  382:         The Regents of the University of California.  All rights reserved.
  383: 
  384:     NetBSD 5.99.43 (INSTALL) #5: Mon Jan 10 10:58:12 CET 2011
  385:         frank@compaq.owl.de:/home/frank/netbsd/current/src/sys/arch/sandpoint/compile/obj/INSTALL
  386:     total memory = 65536 KB
  387:     avail memory = 58028 KB
  388:     OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
  389:     mainbus0 (root)
  390:     cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
  391:     cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
  392:     eumb0 at mainbus0
  393:     com0 at eumb0 unit 0: ns16550a, working fifo
  394:     com0: console
  395:     ociic0 at eumb0
  396:     iic0 at ociic0: I2C bus
  397:     rs5c372rtc0 at iic0 addr 0x32: RICOH RS5C372[AB] Real-time Clock
  398:     satmgr0 at eumb0 unit 1: button manager (synology)
  399:     pci0 at mainbus0 bus 0
  400:     pchb0 at pci0 dev 0 function 0
  401:     pchb0: vendor 0x1057 product 0x0006 (rev. 0x14)
  402:     satalink0 at pci0 dev 13 function 0: Silicon Image SATALink 3512 (rev. 0x01)
  403:     satalink0: using irq 16 for native-PCI interrupt
  404:     atabus0 at satalink0 channel 0
  405:     atabus1 at satalink0 channel 1
  406:     ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
  407:     ohci0: interrupting at irq 17
  408:     ohci0: OHCI version 1.0
  409:     usb0 at ohci0: USB revision 1.0
  410:     ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
  411:     ohci1: interrupting at irq 17
  412:     ohci1: OHCI version 1.0
  413:     usb1 at ohci1: USB revision 1.0
  414:     ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
  415:     ehci0: interrupting at irq 17
  416:     ehci0: companion controllers, 3 ports each: ohci0 ohci1
  417:     usb2 at ehci0: USB revision 2.0
  418:     skc0 at pci0 dev 15 function 0: irq 18
  419:     skc0: Marvell Yukon Lite Gigabit Ethernet rev. (0x9)
  420:     sk0 at skc0 port A: Ethernet address 00:11:32:xx:xx:xx
  421:     makphy0 at sk0 phy 0: Marvell 88E1011 Gigabit PHY, rev. 5
  422:     makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
  423:     biomask 8000038 netmask 8000038 ttymask 8000038
  424:     satalink0: port 0: device present, speed: 1.5Gb/s
  425:     wd0 at atabus0 drive 0: <SAMSUNG HD502HI>
  426:     wd0: 465 GB, 969021 cyl, 16 head, 63 sec, 512 bytes/sect x 976773168 sectors
  427:     uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
  428:     uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
  429:     uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
  430:     boot device: sk0
  431:     root on md0a dumps on md0b
  432:     root file system type: ffs
  433:     erase ^H, werase ^W, kill ^U, intr ^C, status ^T
  434:     Terminal type? [vt100]
  435: 
  436: Just follow the usual procedure to install a OS system.
  437: 
  438: Sandpoint installation window
  439: Post installation steps
  440: =======================
  441: 
  442: After a successful installation you want to make the system boot
  443: standalone when switched on, without the need for a serial console. So
  444: you have to find a way to make your firmware automatically boot
  445: `altboot` and the kernel.
  446: 
  447: Note that newer Synology models, especially those from 2007, may have
  448: the `saveenv` command disabled. If you have one of those skip forward to
  449: [this](#new_firmware) section.
  450: 
  451: Old firmware (2005)
  452: -------------------
  453: 
  454: When you have an old firmware you just have to modify the `bootcmd`
  455: setting in PPCBoot's environment and write the `altboot.bin` binary to
  456: any free location of the Flash ROM.
  457: 
  458: To find a suitable place on the flash you can use the `flinfo` command
  459: and look out for empty sectors `(E)`. On my Synology box I have chosen
  460: `0xff400000`. Replace that in all the following commands if you have
  461: chosen a different address.
  462: 
  463: Load `altboot.bin` into memory at `0x1000000` again, as explained above.
  464: Then execute the following commands to write it to Flash ROM:
  465: 
  466:     _MPC824X > 
  467:     Un-Protect Flash Bank # 1
  468:     _MPC824X > 
  469:     Erase Flash from 0xff400000 to 0xff41ffff 
  470:     . done
  471:     Erased 1 sectors
  472:     _MPC824X > 
  473:     Copy to Flash... done
  474:     _MPC824X > 
  475:     Protect Flash Bank # 1
  476: 
  477: Finally adapt the `bootcmd` environment string to auto-boot `altboot`
  478: and start the `netbsd` kernel (which is the default name) from `wd0` on
  479: each reboot:
  480: 
  481:     _MPC824X > 
  482:     _MPC824X > 
  483:     Saving Environment to Flash...
  484:     unProtect FFF40000 ... FFF5FFFF
  485:     Un-Protected 1 sectors
  486:     Erasing Flash...
  487:     . done
  488:     Erased 1 sectors
  489:     Writing to Flash... done
  490:     Protected 1 sectors
  491: 
  492: The `\` is important for `setenv` not to misinterpret the `;` as the end
  493: of the command.
  494: 
  495: New firmware (2007)
  496: -------------------
  497: 
  498: Without a working `saveenv` command the only way to make your system
  499: automatically boot OS is to replace the Linux kernel on flash by
  500: `altboot.img`, which is our bootloader in PPCBoot image format, faking a
  501: Linux kernel.
  502: 
  503: When viewing the environment variables with `printenv` you can see that
  504: the `bootcmd` is calling `bootm` to load the Linux kernel. The first
  505: address is the location which we have to overwrite with `altboot.img`.
  506: Here it is `0xffc00000`, which you have to replace in all the following
  507: commands, in case your `bootcmd` differs.
  508: 
  509:     bootcmd=bootm FFC00000 FFE00000
  510: 
  511: Load `altboot.img` into memory, for example at `0x1000000` again, as
  512: explained [above](#altboot). You might want to backup the Linux kernel
  513: image first. Then execute the following commands to overwrite it with
  514: `altboot.img`:
  515: 
  516:     _MPC824X > 
  517:     Un-Protect Flash Bank # 1
  518:     _MPC824X > 
  519:     Erase Flash from 0xffc00000 to 0xffc1ffff 
  520:     . done
  521:     Erased 1 sectors
  522:     _MPC824X > 
  523:     Copy to Flash... done
  524:     _MPC824X > 
  525:     Protect Flash Bank # 1
  526: 
  527: Optionally you may think about replacing the Linux RAM disk image at the
  528: second address (`0xffe00000` in the example above) by an empty PPCBoot
  529: image, like [this](dummy.img.gz) one (do not forget to uncompress it
  530: with `gunzip(1)`). Or use `mkubootimage` to make your own dummy. Write
  531: it to flash as shown above. This will speed up the boot process, but is
  532: not really required.
  533: 
  534: Have fun with your mini OS server!

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