Annotation of wikisrc/ports/sandpoint/instdsm-g600.mdwn, revision 1.1

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

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