README revision 1.3
11.3Sscw$NetBSD: README,v 1.3 2006/03/04 13:17:18 scw Exp $
21.1Sscw
31.1SscwNetBSD for the Linksys NSLU2 (a.k.a. "Slug")
41.1Sscw~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51.1Sscw
61.1SscwThe NSLU2 (Network Storage Link for USB 2.0 Disk Drives) is a small, cheap
71.1SscwNAS device consisting of an Intel IXP420 (Xscale) CPU, a 10/100mbit Ethernet
81.1Sscwport, and two USB 2.0 ports. It has 32MB of SDRAM and 8MB of Flash memory,
91.1Sscwand runs RedBoot/Linux out of the box.
101.1Sscw
111.1SscwIt is eminently hackable.
121.1Sscw
131.1SscwThe guys over at http://www.nslu2-linux.org/ have done a good job of
141.1Sscwdocumenting just about every aspect of the hardware and original firmware.
151.1SscwThey also provide a custom "Unslung" Linux distribution to replace the
161.1Sscworiginal hobbled kernel/userland.
171.1Sscw
181.1SscwBecause of the amount of documentation available, and the fact that Slugs
191.1Sscware available so cheaply (I paid just over UKP 50 for mine, brand new) I
201.1Sscwdecided to buy one and port NetBSD to it.
211.1Sscw
221.1SscwThis is the result of that effort.
231.1Sscw
241.1SscwNote: The Slug's IXP420 CPU runs in big-endian mode, so when building a
251.1Sscwcross toolchain you must pass "-m evbarm -a armeb" to build.sh.
261.1Sscw
271.1Sscw
281.1Sscw
291.1SscwCurrent status
301.1Sscw==============
311.1Sscw
321.1SscwThe following bits of Slug hardware are not (yet?) supported:
331.1Sscw
341.1Sscw - NPE Ethernet
351.1Sscw   Someone will have to port Intel's IXP425 access library before this can
361.1Sscw   be made to work. If that someone is you, the source code is available
371.1Sscw   online here:
381.1Sscw
391.1Sscw   http://www.intel.com/design/network/products/npfamily/ixp425.htm
401.1Sscw
411.1Sscw   Look under "Tools & Software", then select "Register/Login" to download
421.1Sscw   "Intel(R) IXP400 Software". Documentation is available in the
431.1Sscw   "Technical Documents" section.
441.1Sscw
451.1Sscw   The easiest option will be to download the non-crypto version of the
461.1Sscw   Access Library. The crypto-enabled version requires a lot more form
471.1Sscw   filling. The Slug's IXP420 has no crypto capabilities anyway.
481.1Sscw
491.1Sscw - Flash ROM
501.1Sscw   You can write gzboot kernels (when support is added) to Flash using
511.1Sscw   RedBoot, so all is not lost.
521.1Sscw
531.1Sscw - Buzzer
541.1Sscw   In the absence of a decent API to expose the onboard buzzer to userland,
551.1Sscw   this is not yet supported. I envisage using timer1 to generate an
561.1Sscw   interrupt at the required rate (1-2KHz). The handler will toggle the
571.1Sscw   buzzer GPIO pin. Obviously timer1 will be configured only when necessary
581.1Sscw   as a 1-2KHz interrupt rate will sap a fair bit of CPU horsepower.
591.1Sscw
601.1SscwEverything else is fully supported, including the power/reset buttons and
611.1Sscwdisk activity/status LEDs.
621.1Sscw
631.1SscwNon-hardware items on the TODO list include:
641.1Sscw
651.1Sscw - gzboot support.
661.3Sscw   The Slug's 8MB of Flash is split into 5 segments:
671.3Sscw
681.3Sscw    1 0x50000000-0x5003ffff: RedBoot (with some additional bits at the end).
691.3Sscw    2 0x50040000-0x5005ffff: Sysconf (used by the Linksys firmware).
701.3Sscw    3 0x50060000-0x5015ffff: Self-extracting compressed kernel image.
711.3Sscw    4 0x50160000-0x507dffff: Compressed ramdisk image.
721.3Sscw    5 0x507e0000-0x507fffff: SerComm Flash trailer.
731.3Sscw
741.3Sscw   Segments 1, 2, and 5 should be considered immutable. Segments 3 and 4
751.3Sscw   have a 16-byte header, the first 4 bytes of which describe the length
761.3Sscw   of the image contained in that segment (not including the header).
771.3Sscw
781.3Sscw   On power-up, RedBoot copies the image in segment 3 into SDRAM at 0x01d00000,
791.3Sscw   and the image in segment 4 into SDRAM at 0x01000000. RedBoot then jumps to
801.3Sscw   0x01d00000. This is just a regular ARM Linux compressed kernel bootloader.
811.3Sscw
821.3Sscw   So, we need to create a version of gzboot linked not at Flash address
831.3Sscw   0x50060000, but at 0x01d00000 instead. The only downside is that it looks
841.3Sscw   like the combined size of gzboot plus compressed kernel cannot exceed 1MB.
851.3Sscw
861.3Sscw   To support an md(4) root filesystem, we will need to modify gzboot to
871.3Sscw   decompress the ramdisk image from segment 4 and copy it to the correct
881.3Sscw   place in the decompressed kernel image.
891.1Sscw
901.1Sscw - Move the kernel link address closer to the start of SDRAM. We waste a
911.1Sscw   little under 2MB with the current setup.
921.1Sscw
931.1Sscw
941.1Sscw
951.1SscwGetting NetBSD onto the NSLU2
961.1Sscw=============================
971.1Sscw
981.1SscwThanks to the efforts of the guys over at www.nslu2-linux.org, hacking the
991.1SscwSlug is a pretty easy proposition, but some soldering skills are essential.
1001.1SscwFor a first-time install of NetBSD (at least until someone comes up with a
1011.1Sscwnice easy binary install image) you will almost certainly require access to
1021.1Sscwthe serial console. This means firing up your trusty soldering iron and
1031.1Sscwhooking up a MAX3232 chip to your Slug. While your soldering iron is hot,
1041.1Sscwyou should seriously consider de-restricting your Slug's CPU core clock
1051.1Sscwspeed (133MHz stock, 266MHz de-restricted) by removing a single surface-
1061.1Sscwmount resistor. Full instructions for both the these mods are on the above
1071.1Sscwwebsite.
1081.1Sscw
1091.1SscwOnce you have console access you can interrupt RedBoot's auto-boot process
1101.1Sscwusing CTRL-C. You are now in a position to download a NetBSD kernel into
1111.1SscwSDRAM.
1121.1Sscw
1131.1SscwYou will have to configure a TFTP server on a machine hooked up to the same
1141.1SscwEthernet segment as the Slug. This machine's Ethernet interface must also
1151.1Sscwbe configured to have an address in the 192.168.0.0/24 subnet since the
1161.1SscwSlug's Ethernet *always* defaults to 192.168.0.1 when running RedBoot.
1171.1SscwThere seems to be no way to alter this, so the best course of action will
1181.1Sscwprobably be to set up an alias on the server's interface. 192.168.0.2 is
1191.1Sscwa good choice.
1201.1Sscw
1211.1SscwAssuming you've done all that and have dropped a suitable kernel image
1221.1Sscwinto the TFTP directory, the following commands will load and run the
1231.1Sscwkernel.
1241.1Sscw
1251.1Sscwredboot> ip_address -h 192.168.0.2
1261.1Sscwredboot> load -r -b 0x200000 netbsd.bin
1271.1Sscwredboot> go
1281.1Sscw
1291.1SscwAt this point your only real option is to mount the root filesystem from
1301.1Sscwa USB disk device as the onboard Ethernet is not (yet?) supported. However,
1311.1Sscwthere's nothing to stop you using a USB-Ethernet interface...
1321.1Sscw
1331.1SscwNote that the kernel will always report the CPU core clock speed as 266MHz
1341.1Sscweven if your Slug's CPU clock is running at a stock 133MHz.
1351.1Sscw
1361.1Sscw
1371.1Sscw
1381.1SscwBurning a NetBSD kernel into Flash
1391.1Sscw==================================
1401.1Sscw
1411.1SscwTBD (waiting for gzboot support).
1421.1Sscw
143