Annotation of wikisrc/ports/sandpoint/instsynology.mdwn, revision 1.12

1.2       jdc         1: <a name="introduction"></a>
1.1       mspo        2: Introduction
                      3: ============
                      4: 
                      5: This document describes in depth how to prepare your Synology
1.8       phx         6: Diskstation for installing NetBSD/sandpoint. The following models are
1.1       mspo        7: supported:
                      8: 
                      9: <table>
                     10: <tbody>
                     11: <tr class="odd">
1.7       jdc        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>
1.1       mspo       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: 
1.8       phx       119: To install NetBSD/sandpoint you will have to open the case, to get access to
1.1       mspo      120: the serial console, and connect a serial converter from TTL to RS232
                    121: signal levels.
                    122: 
1.2       jdc       123: <a name="serial_access"></a>
1.1       mspo      124: Accessing the serial interface
                    125: ==============================
                    126: 
1.2       jdc       127: <a name="locate_header"></a>
1.1       mspo      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">
1.10      phx       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>
1.1       mspo      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">
1.7       jdc       153: <td align="left"><strong>Pin number</strong></td>
                    154: <td align="left"><strong>Function</strong></td>
1.1       mspo      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>
1.10      phx       174: <td align="left"><img src="//www.NetBSD.org/images/ports/sandpoint/syno_ser_pins.jpg" alt="Header pin assignments" /></td>
1.1       mspo      175: </tr>
                    176: </tbody>
                    177: </table>
                    178: 
                    179: Watch out for the thick, white angle, which marks pin 1.
                    180: 
1.2       jdc       181: <a name="serial_cable"></a>
1.1       mspo      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: 
1.10      phx       190: -   [Serial adapter for 3.3V TTL](http://www.NetBSD.org/ports/sandpoint/ttl2rs232.html)
1.1       mspo      191: 
1.10      phx       192: <img src="//www.NetBSD.org/images/ports/sandpoint/syno_ser_adapter.jpg" alt="Serial adapter installed" /></td>
1.2       jdc       193: 
1.1       mspo      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: 
1.2       jdc       205: <a name="install"></a>
1.1       mspo      206: First installation
                    207: ==================
                    208: 
1.2       jdc       209: <a name="firmware_access"></a>
1.1       mspo      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
1.8       phx       220: serial console. The easiest approach may be to use NetBSD's `tip(1)` command
1.1       mspo      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: 
1.2       jdc       263: <a name="altboot"></a>
1.1       mspo      264: altboot
                    265: -------
                    266: 
                    267: The `altboot(8)` utility functions as a bridge between the Synology
1.8       phx       268: firmware and the NetBSD kernel startup environment. NAS firmware often
1.1       mspo      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: 
1.9       phx       277: -   **loadb** to load a binary file via serial line in kermit mode
                    278: -   **tftpboot** to load a binary file over the network with TFTP protocol
1.1       mspo      279: -   start it from the flash memory
                    280: 
                    281: The last option is prefered once the installation is completed, but
                    282: obviously it is not possible for the first time boot. Newer firmwares
                    283: (2007) support the use of the network interface by setting the `ipaddr`
1.9       phx       284: and `serverip` environment variables with **setenv**. Once you have set up
1.1       mspo      285: TFTP and DHCP ([read below](#altboot_install)) you can download
                    286: `altboot` like this:
                    287: 
1.6       jdc       288: <pre>
1.12    ! phx       289: _MPC824X &gt; <strong>setenv ipaddr 192.168.0.106</strong>
        !           290: _MPC824X &gt; <strong>setenv serverip 192.168.0.5</strong>
        !           291: _MPC824X &gt; <strong>setenv netmask 255.255.255.0</strong>
1.6       jdc       292: _MPC824X &gt; <strong>tftpboot 0x1000000 altboot.bin</strong>
                    293: ARP broadcast 1
                    294: TFTP from server 192.168.0.5; our IP address is 192.168.0.106
                    295: Filename 'altboot.bin'.
                    296: Load address: 0x1000000
                    297: Loading: ###############
                    298: done
                    299: Bytes transferred = 74732 (123ec hex)
                    300: </pre>
1.1       mspo      301: 
                    302: The old firmware (2005) doesn't activate the network at all, so we have
                    303: to download `altboot` into RAM with Kermit protocol over the serial
                    304: line.
                    305: 
                    306: Install `kermit(1)` from `pkgsrc(7)` or compile and install it yourself.
                    307: To set up the file transfer you have to provide the following commands
                    308: to `kermit`:
                    309: 
                    310:     set line /dev/tty00
                    311:     set speed 115200
                    312:     set carrier-watch off
                    313:     set flow-control none
                    314:     robust
                    315:     set file type bin
                    316: 
                    317: For convenience you can write them into a file which you can pass as an
                    318: argument to `kermit`.
                    319: 
                    320: Load `altboot` into memory using Kermit protocol. The binary is
                    321: relocated at `0x1000000`, so type:
                    322: 
1.6       jdc       323: <pre>
                    324: _MPC824X &gt; <strong>loadb 1000000</strong>
                    325: ## Ready for binary (kermit) download ...
                    326: </pre>
1.1       mspo      327: 
1.9       phx       328: Now quit your terminal program and launch **kermit cmdfile**. When you are
1.1       mspo      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: 
1.10      phx       333: <pre>
                    334: C-Kermit 8.0.211, 10 Apr 2004, for NetBSD 1.6
                    335:  Copyright (C) 1985, 2004,
                    336:   Trustees of Columbia University in the City of New York.
                    337: Type ? or HELP for help.
                    338: (/tmp/) C-Kermit><strong>send path_to/altboot.bin</strong>
                    339: </pre>
1.1       mspo      340: 
1.2       jdc       341: <a name="altboot_install"></a>
1.1       mspo      342: Boot the INSTALL kernel with altboot
                    343: ------------------------------------
                    344: 
                    345: Now you can use `altboot` to launch the `netbsd-INSTALL` kernel for
1.8       phx       346: installing NetBSD. You may choose to load it with TFTP or from NFS. For TFTP
1.1       mspo      347: you have to enable `tftpd(8)` in `/etc/inetd.conf`, and for NFS there is
                    348: a documentation at [The Network File
                    349: System](http://www.NetBSD.org/docs/guide/en/chap-net-services.html#chap-net-services-nfs).
                    350: But in both cases you have to set up a DHCP server, which is explained
                    351: in the [DHCP Howto](http://www.NetBSD.org/docs/network/dhcp.html). An
                    352: appropriate `dhcpd.conf` entry could look like this:
                    353: 
                    354:             host ds101g {
                    355:                     hardware ethernet 00:11:32:xx:xx:xx;
                    356:                     fixed-address 192.168.0.101;
                    357:                     next-server 192.168.0.1;
                    358:                     option root-path "/export/ds101g/root";
                    359:             }
                    360: 
                    361: The `root-path` option is only needed when using NFS and should match
                    362: your exported NFS directory. Uncompress `netbsd-INSTALL.gz` from the
1.8       phx       363: NetBSD/sandpoint distribution and copy it into the NFS or TFTP directory.
1.1       mspo      364: Then start the DHCP, NFS or TFTP server and boot the installation kernel
                    365: from the firmware either with
                    366: 
1.6       jdc       367: <pre>
                    368: _MPC824X &gt; <strong>go 1000000 tftp:netbsd-INSTALL</strong>
                    369: </pre>
1.1       mspo      370: 
                    371: or from NFS:
                    372: 
1.6       jdc       373: <pre>
                    374: _MPC824X &gt; <strong>go 1000000 nfs:netbsd-INSTALL</strong>
                    375: </pre>
1.1       mspo      376: 
                    377: Our bootloader configures the hardware, determines the IP address, loads
                    378: the kernel via network and launches it:
                    379: 
                    380:     ## Starting application at 0x01000000 ...
                    381: 
                    382:     >> NetBSD/sandpoint altboot, revision 1.5 (Fri Feb 18 23:21:15 CET 2011)
                    383:     >> Synology DS, cpu 265 MHz, bus 132 MHz, 64MB SDRAM
                    384:     channel 0 present
                    385:     wd0: <SAMSUNG HD502HI> DMA LBA LBA48 476940 MB
                    386:     wd0: no disklabel
                    387:     MAC address 00:11:32:xx:xx:xx
                    388:     100Mbps-FDX
                    389:     loading "netbsd-INSTALL" 5089380+110916=0x4f5d6c
                    390:     entry=0x00090000, ssym=0x005859a8, esym=0x00585d6c
                    391:     ksyms: Symbol table not found
                    392:     ksyms: String table not found
                    393:     ksyms: Perhaps the kernel is stripped?
                    394:     Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
                    395:         2006, 2007, 2008, 2009, 2010, 2011
                    396:         The NetBSD Foundation, Inc.  All rights reserved.
                    397:     Copyright (c) 1982, 1986, 1989, 1991, 1993
                    398:         The Regents of the University of California.  All rights reserved.
                    399: 
                    400:     NetBSD 5.99.43 (INSTALL) #5: Mon Jan 10 10:58:12 CET 2011
                    401:         frank@compaq.owl.de:/home/frank/netbsd/current/src/sys/arch/sandpoint/compile/obj/INSTALL
                    402:     total memory = 65536 KB
                    403:     avail memory = 58028 KB
                    404:     OpenPIC Version 1.2: Supports 1 CPUs and 26 interrupt sources.
                    405:     mainbus0 (root)
                    406:     cpu0 at mainbus0: 8245 (Revision 0.4), ID 0 (primary)
                    407:     cpu0: HID0 0x90c000<DOZE,DPM,ICE,DCE>, powersave: 1
                    408:     eumb0 at mainbus0
                    409:     com0 at eumb0 unit 0: ns16550a, working fifo
                    410:     com0: console
                    411:     ociic0 at eumb0
                    412:     iic0 at ociic0: I2C bus
                    413:     rs5c372rtc0 at iic0 addr 0x32: RICOH RS5C372[AB] Real-time Clock
                    414:     satmgr0 at eumb0 unit 1: button manager (synology)
                    415:     pci0 at mainbus0 bus 0
                    416:     pchb0 at pci0 dev 0 function 0
                    417:     pchb0: vendor 0x1057 product 0x0006 (rev. 0x14)
                    418:     satalink0 at pci0 dev 13 function 0: Silicon Image SATALink 3512 (rev. 0x01)
                    419:     satalink0: using irq 16 for native-PCI interrupt
                    420:     atabus0 at satalink0 channel 0
                    421:     atabus1 at satalink0 channel 1
                    422:     ohci0 at pci0 dev 14 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
                    423:     ohci0: interrupting at irq 17
                    424:     ohci0: OHCI version 1.0
                    425:     usb0 at ohci0: USB revision 1.0
                    426:     ohci1 at pci0 dev 14 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
                    427:     ohci1: interrupting at irq 17
                    428:     ohci1: OHCI version 1.0
                    429:     usb1 at ohci1: USB revision 1.0
                    430:     ehci0 at pci0 dev 14 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
                    431:     ehci0: interrupting at irq 17
                    432:     ehci0: companion controllers, 3 ports each: ohci0 ohci1
                    433:     usb2 at ehci0: USB revision 2.0
                    434:     skc0 at pci0 dev 15 function 0: irq 18
                    435:     skc0: Marvell Yukon Lite Gigabit Ethernet rev. (0x9)
                    436:     sk0 at skc0 port A: Ethernet address 00:11:32:xx:xx:xx
                    437:     makphy0 at sk0 phy 0: Marvell 88E1011 Gigabit PHY, rev. 5
                    438:     makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
                    439:     biomask 8000038 netmask 8000038 ttymask 8000038
                    440:     satalink0: port 0: device present, speed: 1.5Gb/s
                    441:     wd0 at atabus0 drive 0: <SAMSUNG HD502HI>
                    442:     wd0: 465 GB, 969021 cyl, 16 head, 63 sec, 512 bytes/sect x 976773168 sectors
                    443:     uhub0 at usb0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
                    444:     uhub1 at usb1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
                    445:     uhub2 at usb2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
                    446:     boot device: sk0
                    447:     root on md0a dumps on md0b
                    448:     root file system type: ffs
                    449:     erase ^H, werase ^W, kill ^U, intr ^C, status ^T
                    450:     Terminal type? [vt100]
                    451: 
1.8       phx       452: Just follow the usual procedure to install a NetBSD system.
1.1       mspo      453: 
1.10      phx       454: <img src="//www.NetBSD.org/images/ports/sandpoint/install_window.jpg" alt="Sandpoint installation window" /></td>
1.2       jdc       455: 
                    456: <a name="post_install"></a>
1.1       mspo      457: Post installation steps
                    458: =======================
                    459: 
                    460: After a successful installation you want to make the system boot
                    461: standalone when switched on, without the need for a serial console. So
                    462: you have to find a way to make your firmware automatically boot
                    463: `altboot` and the kernel.
                    464: 
                    465: Note that newer Synology models, especially those from 2007, may have
1.9       phx       466: the **saveenv** command disabled. If you have one of those skip forward to
1.1       mspo      467: [this](#new_firmware) section.
                    468: 
                    469: Old firmware (2005)
                    470: -------------------
                    471: 
                    472: When you have an old firmware you just have to modify the `bootcmd`
                    473: setting in PPCBoot's environment and write the `altboot.bin` binary to
                    474: any free location of the Flash ROM.
                    475: 
1.9       phx       476: To find a suitable place on the flash you can use the **flinfo** command
1.1       mspo      477: and look out for empty sectors `(E)`. On my Synology box I have chosen
                    478: `0xff400000`. Replace that in all the following commands if you have
                    479: chosen a different address.
                    480: 
                    481: Load `altboot.bin` into memory at `0x1000000` again, as explained above.
                    482: Then execute the following commands to write it to Flash ROM:
                    483: 
1.6       jdc       484: <pre>
                    485: _MPC824X &gt; <strong>protect off all</strong>
                    486: Un-Protect Flash Bank # 1
                    487: _MPC824X &gt; <strong>erase ff400000 ff41ffff</strong>
                    488: Erase Flash from 0xff400000 to 0xff41ffff 
                    489: . done
                    490: Erased 1 sectors
                    491: _MPC824X &gt; <strong>cp.b 1000000 ff400000 18000</strong>
                    492: Copy to Flash... done
                    493: _MPC824X &gt; <strong>protect on all</strong>
                    494: Protect Flash Bank # 1
                    495: </pre>
1.1       mspo      496: 
                    497: Finally adapt the `bootcmd` environment string to auto-boot `altboot`
                    498: and start the `netbsd` kernel (which is the default name) from `wd0` on
                    499: each reboot:
                    500: 
1.6       jdc       501: <pre>
                    502: _MPC824X &gt; <strong>setenv bootcmd cp.b ff400000 1000000 18000\; go 1000000 wd0:</strong>
                    503: _MPC824X &gt; <strong>saveenv</strong>
                    504: Saving Environment to Flash...
                    505: unProtect FFF40000 ... FFF5FFFF
                    506: Un-Protected 1 sectors
                    507: Erasing Flash...
                    508: . done
                    509: Erased 1 sectors
                    510: Writing to Flash... done
                    511: Protected 1 sectors
                    512: </pre>
1.1       mspo      513: 
1.9       phx       514: The `\` is important for **setenv** not to misinterpret the `;` as the end
1.1       mspo      515: of the command.
                    516: 
                    517: New firmware (2007)
                    518: -------------------
                    519: 
1.9       phx       520: Without a working **saveenv** command the only way to make your system
1.8       phx       521: automatically boot NetBSD is to replace the Linux kernel on flash by
1.1       mspo      522: `altboot.img`, which is our bootloader in PPCBoot image format, faking a
                    523: Linux kernel.
                    524: 
1.9       phx       525: When viewing the environment variables with **printenv** you can see that
                    526: the `bootcmd` is calling **bootm** to load the Linux kernel. The first
1.1       mspo      527: address is the location which we have to overwrite with `altboot.img`.
                    528: Here it is `0xffc00000`, which you have to replace in all the following
                    529: commands, in case your `bootcmd` differs.
                    530: 
                    531:     bootcmd=bootm FFC00000 FFE00000
                    532: 
                    533: Load `altboot.img` into memory, for example at `0x1000000` again, as
                    534: explained [above](#altboot). You might want to backup the Linux kernel
                    535: image first. Then execute the following commands to overwrite it with
                    536: `altboot.img`:
                    537: 
1.6       jdc       538: <pre>
                    539: _MPC824X &gt; <strong>protect off all</strong>
                    540: Un-Protect Flash Bank # 1
                    541: _MPC824X &gt; <strong>erase ffc00000 ffc1ffff</strong>
                    542: Erase Flash from 0xffc00000 to 0xffc1ffff 
                    543: . done
                    544: Erased 1 sectors
                    545: _MPC824X &gt; <strong>cp.b 1000000 ffc00000 18000</strong>
                    546: Copy to Flash... done
                    547: _MPC824X &gt; <strong>protect on all</strong>
                    548: Protect Flash Bank # 1
                    549: </pre>
1.1       mspo      550: 
                    551: Optionally you may think about replacing the Linux RAM disk image at the
                    552: second address (`0xffe00000` in the example above) by an empty PPCBoot
1.11      phx       553: image, like [this](http://www.NetBSD.org/~phx/Sandpoint/dummy.img.gz) one
                    554: (do not forget to uncompress it with `gunzip(1)`). Or use **mkubootimage** to
                    555: make your own dummy. Write it to flash as shown above. This will speed up the
                    556: boot process, but is not really required.
1.1       mspo      557: 
1.8       phx       558: Have fun with your mini NetBSD server!

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