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