Home | History | Annotate | Line # | Download | only in nslu2
README revision 1.5.12.2
      1  1.5.12.2  rpaulo $NetBSD: README,v 1.5.12.2 2006/09/09 02:38:55 rpaulo Exp $
      2  1.5.12.2  rpaulo 
      3  1.5.12.2  rpaulo NetBSD for the Linksys NSLU2 (a.k.a. "Slug")
      4  1.5.12.2  rpaulo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      5  1.5.12.2  rpaulo 
      6  1.5.12.2  rpaulo The NSLU2 (Network Storage Link for USB 2.0 Disk Drives) is a small, cheap
      7  1.5.12.2  rpaulo NAS device consisting of an Intel IXP420 (Xscale) CPU, a 10/100mbit Ethernet
      8  1.5.12.2  rpaulo port, and two USB 2.0 ports. It has 32MB of SDRAM and 8MB of Flash memory,
      9  1.5.12.2  rpaulo and runs RedBoot/Linux out of the box.
     10  1.5.12.2  rpaulo 
     11  1.5.12.2  rpaulo It is eminently hackable.
     12  1.5.12.2  rpaulo 
     13  1.5.12.2  rpaulo The guys over at http://www.nslu2-linux.org/ have done a good job of
     14  1.5.12.2  rpaulo documenting just about every aspect of the hardware and original firmware.
     15  1.5.12.2  rpaulo They also provide a custom "Unslung" Linux distribution to replace the
     16  1.5.12.2  rpaulo original hobbled kernel/userland.
     17  1.5.12.2  rpaulo 
     18  1.5.12.2  rpaulo Because of the amount of documentation available, and the fact that Slugs
     19  1.5.12.2  rpaulo are available so cheaply (I paid just over UKP 50 for mine, brand new) I
     20  1.5.12.2  rpaulo decided to buy one and port NetBSD to it.
     21  1.5.12.2  rpaulo 
     22  1.5.12.2  rpaulo This is the result of that effort.
     23  1.5.12.2  rpaulo 
     24  1.5.12.2  rpaulo Note: The Slug's IXP420 CPU runs in big-endian mode, so when building a
     25  1.5.12.2  rpaulo cross toolchain you must pass "-m evbarm -a armeb" to build.sh.
     26  1.5.12.2  rpaulo 
     27  1.5.12.2  rpaulo 
     28  1.5.12.2  rpaulo 
     29  1.5.12.2  rpaulo Current status
     30  1.5.12.2  rpaulo ==============
     31  1.5.12.2  rpaulo 
     32  1.5.12.2  rpaulo The following bits of Slug hardware are not (yet?) supported:
     33  1.5.12.2  rpaulo 
     34  1.5.12.2  rpaulo  - NPE Ethernet
     35  1.5.12.2  rpaulo    Someone will have to port Intel's IXP425 access library before this can
     36  1.5.12.2  rpaulo    be made to work. If that someone is you, the source code is available
     37  1.5.12.2  rpaulo    online here:
     38  1.5.12.2  rpaulo 
     39  1.5.12.2  rpaulo    http://www.intel.com/design/network/products/npfamily/ixp425.htm
     40  1.5.12.2  rpaulo 
     41  1.5.12.2  rpaulo    Look under "Tools & Software", then select "Intel(R) IPXX400 Software"
     42  1.5.12.2  rpaulo    to downlod the documentation.  If you aren't registered, select
     43  1.5.12.2  rpaulo    "Register/Login" first.  Documentation is available in the
     44  1.5.12.2  rpaulo    "Technical Documents" section.
     45  1.5.12.2  rpaulo 
     46  1.5.12.2  rpaulo    The easiest option will be to download the non-crypto version of the
     47  1.5.12.2  rpaulo    Access Library. The crypto-enabled version requires a lot more form
     48  1.5.12.2  rpaulo    filling. The Slug's IXP420 has no crypto capabilities anyway.
     49  1.5.12.2  rpaulo 
     50  1.5.12.2  rpaulo  - Flash ROM
     51  1.5.12.2  rpaulo    You can write gzboot kernels (when support is added) to Flash using
     52  1.5.12.2  rpaulo    RedBoot, so all is not lost.
     53  1.5.12.2  rpaulo 
     54  1.5.12.2  rpaulo  - Buzzer
     55  1.5.12.2  rpaulo    In the absence of a decent API to expose the onboard buzzer to userland,
     56  1.5.12.2  rpaulo    this is not yet supported. I envisage using timer1 to generate an
     57  1.5.12.2  rpaulo    interrupt at the required rate (1-2 kHz). The handler will toggle the
     58  1.5.12.2  rpaulo    buzzer GPIO pin. Obviously timer1 will be configured only when necessary
     59  1.5.12.2  rpaulo    as a 1-2 kHz interrupt rate will sap a fair bit of CPU horsepower.
     60  1.5.12.2  rpaulo 
     61  1.5.12.2  rpaulo Everything else is fully supported, including the power/reset buttons and
     62  1.5.12.2  rpaulo disk activity/status LEDs.
     63  1.5.12.2  rpaulo 
     64  1.5.12.2  rpaulo Non-hardware items on the TODO list include:
     65  1.5.12.2  rpaulo 
     66  1.5.12.2  rpaulo  - gzboot support.
     67  1.5.12.2  rpaulo    The Slug's 8MB of Flash is split into 5 segments:
     68  1.5.12.2  rpaulo 
     69  1.5.12.2  rpaulo     1 0x50000000-0x5003ffff: RedBoot (with some additional bits at the end).
     70  1.5.12.2  rpaulo     2 0x50040000-0x5005ffff: Sysconf (used by the Linksys firmware).
     71  1.5.12.2  rpaulo     3 0x50060000-0x5015ffff: Self-extracting compressed kernel image.
     72  1.5.12.2  rpaulo     4 0x50160000-0x507dffff: Compressed ramdisk image.
     73  1.5.12.2  rpaulo     5 0x507e0000-0x507fffff: SerComm Flash trailer.
     74  1.5.12.2  rpaulo 
     75  1.5.12.2  rpaulo    Segments 1, 2, and 5 should be considered immutable. Segments 3 and 4
     76  1.5.12.2  rpaulo    have a 16-byte header, the first 4 bytes of which describe the length
     77  1.5.12.2  rpaulo    of the image contained in that segment (not including the header).
     78  1.5.12.2  rpaulo 
     79  1.5.12.2  rpaulo    On power-up, RedBoot copies the image in segment 3 into SDRAM at 0x01d00000,
     80  1.5.12.2  rpaulo    and the image in segment 4 into SDRAM at 0x01000000. RedBoot then jumps to
     81  1.5.12.2  rpaulo    0x01d00000. This is just a regular ARM Linux compressed kernel bootloader.
     82  1.5.12.2  rpaulo 
     83  1.5.12.2  rpaulo    So, we need to create a version of gzboot linked not at Flash address
     84  1.5.12.2  rpaulo    0x50060000, but at 0x01d00000 instead. The only downside is that it looks
     85  1.5.12.2  rpaulo    like the combined size of gzboot plus compressed kernel cannot exceed 1MB.
     86  1.5.12.2  rpaulo 
     87  1.5.12.2  rpaulo    To support an md(4) root filesystem, we will need to modify gzboot to
     88  1.5.12.2  rpaulo    decompress the ramdisk image from segment 4 and copy it to the correct
     89  1.5.12.2  rpaulo    place in the decompressed kernel image.
     90  1.5.12.2  rpaulo 
     91  1.5.12.2  rpaulo  - Move the kernel link address closer to the start of SDRAM. We waste a
     92  1.5.12.2  rpaulo    little under 2MB with the current setup.
     93  1.5.12.2  rpaulo 
     94  1.5.12.2  rpaulo 
     95  1.5.12.2  rpaulo 
     96  1.5.12.2  rpaulo Getting NetBSD onto the NSLU2
     97  1.5.12.2  rpaulo =============================
     98  1.5.12.2  rpaulo 
     99  1.5.12.2  rpaulo Thanks to the efforts of the guys over at www.nslu2-linux.org, hacking the
    100  1.5.12.2  rpaulo Slug is a pretty easy proposition, but some soldering skills are essential.
    101  1.5.12.2  rpaulo For a first-time install of NetBSD (at least until someone comes up with a
    102  1.5.12.2  rpaulo nice easy binary install image) you will almost certainly require access to
    103  1.5.12.2  rpaulo the serial console. This means firing up your trusty soldering iron and
    104  1.5.12.2  rpaulo hooking up a MAX3232 chip to your Slug. While your soldering iron is hot,
    105  1.5.12.2  rpaulo you should seriously consider de-restricting your Slug's CPU core clock
    106  1.5.12.2  rpaulo speed (133MHz stock, 266MHz de-restricted) by removing a single surface-
    107  1.5.12.2  rpaulo mount resistor. Full instructions for both the these mods are on the above
    108  1.5.12.2  rpaulo website.
    109  1.5.12.2  rpaulo 
    110  1.5.12.2  rpaulo Once you have console access you can interrupt RedBoot's auto-boot process
    111  1.5.12.2  rpaulo using CTRL-C. You are now in a position to download a NetBSD kernel into
    112  1.5.12.2  rpaulo SDRAM.
    113  1.5.12.2  rpaulo 
    114  1.5.12.2  rpaulo You will have to configure a TFTP server on a machine hooked up to the same
    115  1.5.12.2  rpaulo Ethernet segment as the Slug. This machine's Ethernet interface must also
    116  1.5.12.2  rpaulo be configured to have an address in the 192.168.0.0/24 subnet since the
    117  1.5.12.2  rpaulo Slug's Ethernet *always* defaults to 192.168.0.1 when running RedBoot.
    118  1.5.12.2  rpaulo There seems to be no way to alter this, so the best course of action will
    119  1.5.12.2  rpaulo probably be to set up an alias on the server's interface. 192.168.0.2 is
    120  1.5.12.2  rpaulo a good choice.
    121  1.5.12.2  rpaulo 
    122  1.5.12.2  rpaulo Assuming you've done all that and have dropped a suitable kernel image
    123  1.5.12.2  rpaulo into the TFTP directory, the following commands will load and run the
    124  1.5.12.2  rpaulo kernel.
    125  1.5.12.2  rpaulo 
    126  1.5.12.2  rpaulo redboot> ip_address -h 192.168.0.2
    127  1.5.12.2  rpaulo redboot> load -r -b 0x200000 netbsd.bin
    128  1.5.12.2  rpaulo redboot> go
    129  1.5.12.2  rpaulo 
    130  1.5.12.2  rpaulo At this point your only real option is to mount the root filesystem from
    131  1.5.12.2  rpaulo a USB disk device as the onboard Ethernet is not (yet?) supported. However,
    132  1.5.12.2  rpaulo there's nothing to stop you using a USB-Ethernet interface...
    133  1.5.12.2  rpaulo 
    134  1.5.12.2  rpaulo Note that the kernel will always report the CPU core clock speed as 266MHz
    135  1.5.12.2  rpaulo even if your Slug's CPU clock is running at a stock 133MHz.
    136  1.5.12.2  rpaulo 
    137  1.5.12.2  rpaulo 
    138  1.5.12.2  rpaulo 
    139  1.5.12.2  rpaulo Burning a NetBSD kernel into Flash
    140  1.5.12.2  rpaulo ==================================
    141  1.5.12.2  rpaulo 
    142  1.5.12.2  rpaulo TBD (waiting for gzboot support).
    143  1.5.12.2  rpaulo 
    144