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 D-Link DSM-G600 for installing NetBSD/sandpoint. Be aware that there are two revisions of the G600, which look very similar:</p>
8: <ul>
9: <li>Revision A, running a 266MHz ARM IXP420</li>
10: <li>Revision B, running a 200MHz PowerPC 8241</li>
11: </ul>
12: <p>NetBSD/sandpoint runs on the B revisions only. You can determine the revision by looking on the sticker at the left side of the case, where you should find a line starting with: <code>HW Ver:</code>. The following letter is either an <code>A</code> or a <code>B</code>.</p></td>
13: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/g600_front.jpg" alt="DSM-G600 front view" /></td>
14: </tr>
15: </tbody>
16: </table>
17:
18: Accessing the serial interface
19: ==============================
20:
21: We need a serial console to get access to the firmware. That includes
22: soldering a four-wire ribbon cable and building (or buying) a serial
23: adapter from the G600's TTL levels to RS232 levels.
24:
25: Locate the serial port
26: ----------------------
27:
28: Look out for a connector labeled `J3`, near the battery. You will
29: usually see four unpopulated pads there. On a few boards there is
30: already a connector socket mounted, but it is hard to find the
31: appropriate plug.
32:
33: <table>
34: <tbody>
35: <tr class="odd">
36: <td align="left"><table>
37: <tbody>
38: <tr class="odd">
39: <td align="left"><strong>Pin number</strong></td>
40: <td align="left"><strong>Function</strong></td>
41: </tr>
42: <tr class="even">
43: <td align="left">1</td>
44: <td align="left">3.3V</td>
45: </tr>
46: <tr class="odd">
47: <td align="left">2</td>
48: <td align="left">TXD</td>
49: </tr>
50: <tr class="even">
51: <td align="left">3</td>
52: <td align="left">RXD</td>
53: </tr>
54: <tr class="odd">
55: <td align="left">4</td>
56: <td align="left">GND</td>
57: </tr>
58: </tbody>
59: </table></td>
60: <td align="left"><img src="http://www.netbsd.org/images/ports/sandpoint/g600_ser_locate.jpg" alt="Serial port pads" /></td>
61: </tr>
62: </tbody>
63: </table>
64:
65: Attaching a serial cable
66: ------------------------
67:
68: When there is no socket at `J3` I would suggest to solder a 4-wire
69: ribbon cable to the pads. Use the red wire to indicate pin 1. You may
70: attach a plug on the other end of the cable, which can be used to
71: connect it to an external serial level shifter circuit.
72:
73: <img src="http://www.netbsd.org/images/ports/sandpoint/g600_ser_cable.jpg" alt="Soldered serial ribbon cable" />
74:
75: Otherwise you have to find a matching plug for the socket and connect
76: the serial cable to it. Or desolder the socket.
77:
78: Connect a serial terminal via a converter
79: -----------------------------------------
80:
81: The serial port on the D-Link DSM-G600 is using 3.3V TTL levels, which
82: have to be converted into regular RS232 levels by a level shifter
83: circuit. Instructions how to build such a circuit yourself can be found
84: here:
85:
86: - [Serial adapter for 3.3V TTL](http://www.netbsd.org/ports/sandpoint/ttl2rs232.html)
87:
88: Make sure that the layout of the connector fits to the pinout of the
89: DSM-G600's serial port, as shown above.
90:
91: Another option is to buy such a converter. There are solutions for a
92: standard RS232 interface and for an USB interface. Look out for:
93:
94: - RS232 level shifter / breakout board (MAX3232 based)
95: - USB to TLL serial level shifter / breakout board (FT232 based)
96:
97: Now you can connect with any terminal program to the DSM-G600's serial
98: console. The easiest approach may be to use NetBSD's `tip(1)` command to
99: make a direct console connection at 9600bps.
100:
101: # tip console
102:
103: Note that when using a serial connection via USB you may have to make an
104: entry for `/dev/ttyU0` in `/etc/remote`.
105:
106: First time installation
107: =======================
108:
109: The altboot bootloader
110: ----------------------
111:
112: The `altboot(8)` program functions as a bridge between the U-Boot
113: firmware and the NetBSD kernel startup environment. NAS firmware often
114: provides no means to boot a kernel from disk or from the network and
115: doesn't initialize all hardware correctly. We will also use it to pass a
116: bootinfo list to the kernel.
117:
118: The `altboot` boot loader has to be loaded and started using the
119: DSM-G600's firmware, which is `U-Boot 0.2.0`.
120:
121: U-Boot 0.2.0 (May 26 2005 - 19:38:32)
122:
123: CPU: MPC8245 V1.2 at 170.503 MHz:
124: Board: Sandpoint 8245
125: DRAM: 32 MB
126: FLASH: FUJI_DL323BE
127: In: serial
128: Out: serial
129: Err: serial
130: Hit any key to stop autoboot: 0
131:
132: D-Link's U-Boot version is extremely restricted. Probably to keep it
133: small and to save space for a Linux kernel and ramdisk in the 4MB Flash,
134: but also to keep the user from hacking it. It does not allow any file
135: transfer besides replacing the Linux kernel image with another Linux
136: kernel image, and it doesn't have network support either. We can use
137: `altboot(8)` to overcome all those restrictions.
138:
139: Write altboot to Flash
140: ----------------------
141:
142: The only way to install, or even run, altboot is to make it look like a
143: Linux kernel U-Boot image and let the firmware boot it instead of Linux.
144: So this step will overwrite your Linux installation.
145:
146: To replace the Linux kernel in the Flash ROM we can use the U-Boot
147: command **loadb k**. This will expect an U-Boot image file to be
148: transfered over the serial port using `Kermit` protocol.
149:
150: So the next step is to install `kermit(1)` from `pkgsrc(7)`, or to
151: compile and install it yourself. To configure Kermit for the file
152: transfer you have to provide the following commands:
153:
154: set line /dev/tty00
155: set speed 9600
156: set carrier-watch off
157: set flow-control none
158: robust
159: set file type bin
160:
161: For convenience you can write them into a file which you can pass as an
162: argument to `kermit`.
163:
164: Run Kermit and start your DSM-G600. Quickly press a key to prevent
165: autobooting. Then type **loadb k** to start the file transfer:
166:
167: <pre>
168: => <strong>loadb k</strong>
169: ## Ready for binary (kermit) download ...
170: </pre>
171:
172: At this point you have to return to Kermit's command mode by typing
173: **CTRL-\\** followed by **c**. We have to send the file `altboot.img`, which
174: is our bootloader in U-Boot image format, faking a Linux kernel.
175:
176: <pre>
177: C-Kermit> <strong>send /local/path/to/altboot.img</strong>
178: </pre>
179:
180: The transfer may take a few minutes at 9600 bps. When done, let Kermit
181: reconnect to the NAS by entering **c**. You will see the following output:
182:
183: ## Total Size = 0x000132dc = 78556 Bytes
184: ## Start Addr = 0x00100000
185: Un-Protect Flash Bank # 1
186: Erase Kernel from 0xfff10000 to 0xffffffff ... done
187: Erased 15 sectors
188: Kernel Size = 78556
189: Copy to Flash... done
190: Protect Flash Bank # 1
191:
192: U-Boot always runs **bootm FFF10000 FFC20000** and there is no way to
193: change that. So it may be convenient to replace the RAMDisk image at
194: `0xffc20000` by an empty U-Boot image, like [this](http://www.NetBSD.org/~phx/Sandpoint/dummy.img.gz)
195: one (do not forget to uncompress it with `gunzip(1)`). Or use **mkubootimage** to
196: make your own dummy. Write this image to Flash, as shown above, by
197: entering the command **loadb r**.
198:
199: Boot the INSTALL kernel with altboot
200: ------------------------------------
201:
202: Now you can use `altboot` to launch the `netbsd-INSTALL` kernel for
203: installing NetBSD. You may choose to load it with TFTP or from NFS. For TFTP
204: you have to enable `tftpd(8)` in `/etc/inetd.conf`, and for NFS there is
205: a documentation at [The Network File
206: System](http://www.NetBSD.org/docs/guide/en/chap-net-services.html#chap-net-services-nfs).
207: But in both cases you have to set up a DHCP server, which is explained
208: in the [DHCP Howto](http://www.NetBSD.org/docs/network/dhcp.html). An
209: appropriate `dhcpd.conf` entry could look like this:
210:
211: host dsmg600 {
212: hardware ethernet 00:13:46:xx:xx:xx;
213: fixed-address 192.168.0.103;
214: next-server 192.168.0.1;
215: option root-path "/export/dsmg600/root";
216: }
217:
218: The `root-path` option is only needed when using NFS and should match
219: your exported NFS directory. Uncompress `netbsd-INSTALL.gz` from the
220: NetBSD/sandpoint distribution and copy it into the NFS or TFTP directory.
221: Reboot or power-cycle your DSM-G600. When `altboot` starts press a key
222: within two seconds to enter interactive mode.
223:
224: ## Booting image at fff10000 ...
225: Image Name: altboot
226: Image Type: PowerPC Linux Kernel Image (unknown compression)
227: Data Size: 76444 Bytes = 74.7 kB
228: Load Address: 01000000
229: Entry Point: 01000000
230: Verifying Checksum ... OK
231: OK
232: ## Loading RAMDisk Image at ffc20000 ...
233: Image Name: dummy
234: Image Type: PowerPC Linux RAMDisk Image (unknown compression)
235: Data Size: 0 Bytes = 0 kB
236: Load Address: 01f00000
237: Entry Point: 01f00000
238: Verifying Checksum ... OK
239: Loading Ramdisk to 01f2f000, end 01f2f000 ... OK
240:
241: >> NetBSD/sandpoint altboot, revision 1.7 (Sat Apr 9 21:38:08 CEST 2011)
242: >> D-Link DSM-G600, cpu 198 MHz, bus 99 MHz, 32MB SDRAM
243: channel 0 present
244: wd0: <WDC WD800BB-00JHC0> DMA LBA 76319 MB
245: wd0: no disklabel
246: MAC address 00:13:46:xx:xx:xx
247: 100Mbps-FDX
248: Hit any key to enter interactive mode: 2
249: bootargs>
250:
251: Now you can boot the installation kernel from TFTP with
252:
253: <pre>
254: bootargs> <strong>tftp:netbsd-INSTALL</strong>
255: </pre>
256:
257: or from NFS:
258:
259: <pre>
260: bootargs> <strong>nfs:netbsd-INSTALL</strong>
261: </pre>
262:
263: Our bootloader configures the hardware, determines the IP address, loads
264: the kernel via network and launches it:
265:
266: loading "netbsd-INSTALL" 5100772+110412=0x4f88b0
267: entry=0x00090000, ssym=0x00588430, esym=0x005888b0
268: Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
269: 2006, 2007, 2008, 2009, 2010, 2011
270: The NetBSD Foundation, Inc. All rights reserved.
271: Copyright (c) 1982, 1986, 1989, 1991, 1993
272: The Regents of the University of California. All rights reserved.
273:
274: NetBSD 5.99.48 (INSTALL) #9: Sat Mar 26 20:14:10 CET 2011
275: frank@compaq.owl.de:/home/frank/netbsd/current/src/sys/arch/sandpoint/compile/obj/INSTALL
276: total memory = 32768 KB
277: avail memory = 26136 KB
278: OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
279: mainbus0 (root)
280: cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
281: cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
282: eumb0 at mainbus0
283: com0 at eumb0 unit 0: ns16550a, working fifo
284: com0: console
285: com0: interrupting at irq 40
286: ociic0 at eumb0
287: iic0 at ociic0: I2C bus
288: strtc0 at iic0 addr 0x68: M41T8x Real-time Clock
289: satmgr0 at eumb0 unit 1: button manager (dlink)
290: satmgr0: interrupting at irq 41
291: pci0 at mainbus0 bus 0
292: pchb0 at pci0 dev 0 function 0
293: pchb0: vendor 0x1057 product 0x0006 (rev. 0x12)
294: ral0 at pci0 dev 13 function 0: vendor 0x1814 product 0x0201 (rev. 0x01)
295: ral0: interrupting at irq 16
296: ral0: 802.11 address 00:0f:a3:xx:xx:xx
297: ral0: MAC/BBP RT2560 (rev 0x04), RF RT2525
298: ral0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
299: ral0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
300: ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
301: ohci0: interrupting at irq 17
302: ohci0: OHCI version 1.0, legacy support
303: usb0 at ohci0: USB revision 1.0
304: ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
305: ohci1: interrupting at irq 17
306: ohci1: OHCI version 1.0, legacy support
307: usb1 at ohci1: USB revision 1.0
308: ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
309: ehci0: interrupting at irq 18
310: ehci0: companion controllers, 3 ports each: ohci0 ohci1
311: usb2 at ehci0: USB revision 2.0
312: stge0 at pci0 dev 15 function 0: Sundance ST-1023 Gigabit Ethernet, rev. 65
313: stge0: interrupting at irq 19
314: stge0: Ethernet address 00:13:46:xx:xx:xx
315: ukphy0 at stge0 phy 24: OUI 0x0009c3, model 0x0008, rev. 0
316: ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
317: acardide0 at pci0 dev 16 function 0: Acard ATP865 Ultra133 IDE Controller (rev. 0x10)
318: acardide0: using irq 20 for native-PCI interrupt
319: atabus0 at acardide0 channel 0
320: atabus1 at acardide0 channel 1
321: biomask 80000f8 netmask 80000f8 ttymask 80000f8
322: uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
323: uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
324: uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
325: wd0 at atabus0 drive 0
326: wd0: <WDC WD800BB-00JHC0>
327: wd0: 76319 MB, 155061 cyl, 16 head, 63 sec, 512 bytes/sect x 156301488 sectors
328: boot device: stge0
329: root on md0a dumps on md0b
330: root file system type: ffs
331: erase ^H, werase ^W, kill ^U, intr ^C, status ^T
332: Terminal type? [vt100]
333:
334: Just follow the usual procedure to install a NetBSD system.
335:
336: <img src="//www.netbsd.org/images/ports/sandpoint/install_window.jpg" alt="Sandpoint installation window" /></td>
337:
338: When the installation is finished the system will automatically boot
339: into multiuser mode, as `altboot` defaults to boot `wd0a:netbsd`. After
340: the network is configured you can disconnect the serial cable and close
341: the case.
342:
343: Have fun with your mini NetBSD server!
344:
345: Known Limitations
346: =================
347:
348: - No known method for a hardware reboot or shutdown of the board
349: exists. Therefore rebooting is simulated by jumping through U-Boot's
350: reset vector. A
351: poweroff(8)
352: will just halt the system and flashes the power LED to indicate that
353: it has to be switched off manually.
354:
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb