11.7Smbalmer$NetBSD: README,v 1.7 2009/11/22 19:09:15 mbalmer 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 - Flash ROM
351.1Sscw   You can write gzboot kernels (when support is added) to Flash using
361.1Sscw   RedBoot, so all is not lost.
371.1Sscw
381.1Sscw - Buzzer
391.1Sscw   In the absence of a decent API to expose the onboard buzzer to userland,
401.1Sscw   this is not yet supported. I envisage using timer1 to generate an
411.4Slukem   interrupt at the required rate (1-2 kHz). The handler will toggle the
421.1Sscw   buzzer GPIO pin. Obviously timer1 will be configured only when necessary
431.4Slukem   as a 1-2 kHz interrupt rate will sap a fair bit of CPU horsepower.
441.1Sscw
451.1SscwEverything else is fully supported, including the power/reset buttons and
461.1Sscwdisk activity/status LEDs.
471.1Sscw
481.1SscwNon-hardware items on the TODO list include:
491.1Sscw
501.1Sscw - gzboot support.
511.3Sscw   The Slug's 8MB of Flash is split into 5 segments:
521.3Sscw
531.3Sscw    1 0x50000000-0x5003ffff: RedBoot (with some additional bits at the end).
541.3Sscw    2 0x50040000-0x5005ffff: Sysconf (used by the Linksys firmware).
551.3Sscw    3 0x50060000-0x5015ffff: Self-extracting compressed kernel image.
561.3Sscw    4 0x50160000-0x507dffff: Compressed ramdisk image.
571.3Sscw    5 0x507e0000-0x507fffff: SerComm Flash trailer.
581.3Sscw
591.3Sscw   Segments 1, 2, and 5 should be considered immutable. Segments 3 and 4
601.3Sscw   have a 16-byte header, the first 4 bytes of which describe the length
611.3Sscw   of the image contained in that segment (not including the header).
621.3Sscw
631.3Sscw   On power-up, RedBoot copies the image in segment 3 into SDRAM at 0x01d00000,
641.3Sscw   and the image in segment 4 into SDRAM at 0x01000000. RedBoot then jumps to
651.3Sscw   0x01d00000. This is just a regular ARM Linux compressed kernel bootloader.
661.3Sscw
671.3Sscw   So, we need to create a version of gzboot linked not at Flash address
681.3Sscw   0x50060000, but at 0x01d00000 instead. The only downside is that it looks
691.3Sscw   like the combined size of gzboot plus compressed kernel cannot exceed 1MB.
701.3Sscw
711.3Sscw   To support an md(4) root filesystem, we will need to modify gzboot to
721.3Sscw   decompress the ramdisk image from segment 4 and copy it to the correct
731.3Sscw   place in the decompressed kernel image.
741.1Sscw
751.1Sscw - Move the kernel link address closer to the start of SDRAM. We waste a
761.1Sscw   little under 2MB with the current setup.
771.1Sscw
781.1Sscw
791.1Sscw
801.1SscwGetting NetBSD onto the NSLU2
811.1Sscw=============================
821.1Sscw
831.1SscwThanks to the efforts of the guys over at www.nslu2-linux.org, hacking the
841.1SscwSlug is a pretty easy proposition, but some soldering skills are essential.
851.1SscwFor a first-time install of NetBSD (at least until someone comes up with a
861.1Sscwnice easy binary install image) you will almost certainly require access to
871.1Sscwthe serial console. This means firing up your trusty soldering iron and
881.1Sscwhooking up a MAX3232 chip to your Slug. While your soldering iron is hot,
891.1Sscwyou should seriously consider de-restricting your Slug's CPU core clock
901.1Sscwspeed (133MHz stock, 266MHz de-restricted) by removing a single surface-
911.7Smbalmermount resistor. Full instructions for both these mods are on the above
921.1Sscwwebsite.
931.1Sscw
941.1SscwOnce you have console access you can interrupt RedBoot's auto-boot process
951.1Sscwusing CTRL-C. You are now in a position to download a NetBSD kernel into
961.1SscwSDRAM.
971.1Sscw
981.1SscwYou will have to configure a TFTP server on a machine hooked up to the same
991.1SscwEthernet segment as the Slug. This machine's Ethernet interface must also
1001.1Sscwbe configured to have an address in the 192.168.0.0/24 subnet since the
1011.1SscwSlug's Ethernet *always* defaults to 192.168.0.1 when running RedBoot.
1021.1SscwThere seems to be no way to alter this, so the best course of action will
1031.1Sscwprobably be to set up an alias on the server's interface. 192.168.0.2 is
1041.1Sscwa good choice.
1051.1Sscw
1061.1SscwAssuming you've done all that and have dropped a suitable kernel image
1071.1Sscwinto the TFTP directory, the following commands will load and run the
1081.1Sscwkernel.
1091.1Sscw
1101.1Sscwredboot> ip_address -h 192.168.0.2
1111.1Sscwredboot> load -r -b 0x200000 netbsd.bin
1121.1Sscwredboot> go
1131.1Sscw
1141.6SimpAt this point you should mount a root filesystem from a USB disk device.
1151.6SimpThe ethernet is now supported, so you may also be able to use a NFS root.
1161.6SimpUSB Ethernet devices can also be used for a NFS root.
1171.1Sscw
1181.1SscwNote that the kernel will always report the CPU core clock speed as 266MHz
1191.1Sscweven if your Slug's CPU clock is running at a stock 133MHz.
1201.1Sscw
1211.1Sscw
1221.1SscwBurning a NetBSD kernel into Flash
1231.1Sscw==================================
1241.1Sscw
1251.1SscwTBD (waiting for gzboot support).
1261.1Sscw
127