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