Subject: Re: Instructions for installing NetBSD onto the NSLU2
To: Donald T Hayford <don@donhayford.com>
From: Donald T Hayford <don@donhayford.com>
List: port-arm
Date: 01/27/2008 09:45:19
Thanks to Havard Eidness for pointint out a typo (/ instead of a \) in 
the edit to .../instkernel/Makefile.  I'll repeat the entire section to 
minimize the confusion.

Next, add NSLU2_INSTALL to the compile targets:

$ cd ~/net/src/distrib/evbarm/instkernel/instkernel
$ cp Makefile Makefile.orig
$ nano Makefile

Change the line
MDSETTARGETS= ADI_BRH_INSTALL ${RAMDISK} -
to
MDSETTARGETS= ADI_BRH_INSTALL ${RAMDISK} - \
NSLU2_INSTALL ${RAMDISK} -


Donald T Hayford wrote:
> Everything I've learned thus far about building/running NetBSD on the 
> NSLU2.
>
> Though there doesn't seem to be a huge demand for this, I thought I'd 
> put the steps into one location to make it easier for someone else to 
> follow. The instructions below are for a Debian Linux (i386) OS build 
> system, but should be pretty adaptable to most other *nix systems. The 
> original source for this material is the documentation that comes with 
> NetBSD as well as advice given by several of the kind people at the 
> NetBSD/arm mailing list ( http://www.netbsd.org/mailinglists/#port-arm 
> ). Incidentally, my hat's off to the people who brought us build.sh. 
> That is one slick script.
>
> You will need a serial port connection to your NSLU2; see
> http://www.nslu2-linux.org/wiki/HowTo/AddASerialPort
> for more details. You'll also need to setup a tftp server to load the 
> NSLU2 kernel from. You'll end up with a USB drive that contains the 
> NetBSD operating system, though you will continue to need tftp to boot 
> the kernel. Finally, I used an NFS server so that the install kernel 
> could find the binary files that make up the base system. Conceivably, 
> you can put these on the same USB drive that you'll use later to 
> install NetBSD on, but I've had problems with that. The binary system 
> files that are on the NetBSD ftp site are built for little-endian 
> processors and won't work for the NSLU2.
>
> Get the source code (current):
>
> $ mkdir ~/net
> $ export CVS_RSH=ssh
> $ export CVSROOT=:ext:anoncvs@anoncvs.NetBSD.org:/cvsroot
> $ cd ~/net
> $ cvs checkout -A -P src
>
> This will create a directory ~/net/src with the source tree in it. 
> Build the tools before you do anything else, since building the tools 
> will overwrite some of the files you need to modify later.
>
> $ cd ~/net/src
> $ ./build.sh -m evbarm -a armeb tools
>
> You need to get the Intel proprietary firmware for the NSLU2 ethernet 
> controller. Follow the instructions at this location:
> ~/net/src/sys/arch/arm/xscale/ixp425-fw.README.
> After building the firmware as described in the readme file, copy the 
> file “IxNPEMicrocode.dat” to the directory 
> ~/net/src/sys/arch/arm/xscale (the same directory as the README).
>
> Next, you need to create/edit four files so you can build both the 
> install version and normal version of the netbsd.bin file that gets 
> loaded into the NSLU2 RAM by the Redboot program from your tftp server.
>
> $ cd ~/net/src/sys/arch/evbarm/conf
> $ cp ADI_BRH_INSTALL NSLU2_INSTALL
> $ nano NSLU2_INSTALL (use whatever editor you are most comfortable with)
>
> Change the line that reads
> include "arch/evbarm/conf/ADI_BRH"
> to
> include "arch/evbarm/conf/NSLU2".
> Feel free to change the first and third lines to accurately reflect 
> what the file does as well. Now, add an option to the NSLU2 
> configuration file.
>
> $ cp NSLU2 NSLU2.orig
> $ nano NSLU2
> Change the line that reads
> #options FFS_EI # FFS Endian Independant support
> to
> options FFS_EI # FFS Endian Independant support.
>
> Next, add NSLU2_INSTALL to the compile targets:
>
> $ cd ~/net/src/distrib/evbarm/instkernel/instkernel
> $ cp Makefile Makefile.orig
> $ nano Makefile
>
> Change the line
> MDSETTARGETS= ADI_BRH_INSTALL ${RAMDISK} -
> to
> MDSETTARGETS= ADI_BRH_INSTALL ${RAMDISK} - /
> NSLU2_INSTALL ${RAMDISK} -
>
> Finally,
>
> $ cd ~/net/src/etc/etc.evbarm
> $ cp Makefile.inc Makefile.inc.orig
> $ nano Makefile.inc
>
> Change the line
> EVBARM_BOARDS= ADI_BRH
> to
> EVBARM_BOARDS= ADI_BRH NSLU2
>
> Now for the slow part, building NetBSD itself. This is covered in 
> chapter 30 of the NetBSD guide,
> http://www.netbsd.org/docs/guide/en/index.html .
>
> $ cd ~/net/src
> $ ./build.sh -u -m evbarm -a armeb kernel=NSLU2
> $ ./build.sh -u -U -m evbarm -a armeb build
> $ ./build.sh -u -U -m evbarm -a armeb release
>
> When this is finished, you'll find a number of zipped files under 
> ~/net/src/obj/releasedir/evbarm that you'll need. First, unzip the 
> install binary and normal binaries and put them on the tftp server 
> directory (I'll assume it is /tftpboot).
>
> $ cd ~/net/src/obj/releasedir/evbarm/installation/instkernel
> $ gunzip netbsd-NSLU2_INSTALL.bin.gz
> $ cp netbsd-NSLU2_INSTALL.bin /tftpboot
> $ cd ~/net/src/obj/releasedir/evbarm/binary/sets
> $ tar -xvzpf kern-NSLU2.tgz
> $ cp netbsd.bin /tftpboot
>
> Also in this directory are eight zipped files that the installation 
> kernel will need to install NetBSD to the USB drive. I put them on an 
> NFS drive.
>
> Now for the fun stuff. Turn on the NSLU2 and hit <control-C> when you 
> see the following:
>
> RedBoot(tm) bootstrap and debug environment [ROMRAM]
> Red Hat certified release, version 1.92 - built 15:16:07, Feb 3 2004
>
> Platform: IXDP425 Development Platform (XScale)
> Copyright (C) 2000, 2001, 2002, Red Hat, Inc.
>
> RAM: 0x00000000-0x02000000, 0x000723a0-0x01ff3000 available
> FLASH: 0x50000000 - 0x50800000, 64 blocks of 0x00020000 bytes each.
> == Executing boot script in 2.000 seconds - enter ^C to abort
>
> Set up the host address to tell RedBoot where to find the tftp server. 
> Then tell RedBoot what file to get and where to put it, and finally, 
> to execute it. Note that the NSLU2's default IP address is 
> 192.168.0.1, so your tftp server needs to be on the same subnet. I use 
> 192.168.0.2.
>
> RedBoot> ip_address -h 192.168.0.2
> IP: 192.168.0.1/255.255.255.0, Gateway: 192.168.0.1
> Default server: 192.168.0.2, DNS server IP: 0.0.0.0
> RedBoot> load -r -b 0x200000 netbsd-NSLU2_INSTALL.bin
> Using default protocol (TFTP)
> Raw file loaded 0x00200000-0x007ab94f, assumed entry at 0x00200000
> RedBoot> g
>
> At this point, what you should see is:
>
> Loaded initial symtab at 0xc043a6c8, strtab at 0xc04607f4, # entries 9084
> pmap_postinit: Allocated 9 static L1 descriptor tables
> Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
> 2006, 2007, 2008
> The NetBSD Foundation, Inc. All rights reserved.
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
>
> NetBSD 4.99.50 (NSLU2_INSTALL) #1: Sat Jan 26 06:00:00 EST 2008
> hayford@debian:/home/hayford/net/src/sys/arch/evbarm/compile/obj/NSLU2_INSTALL 
>
> total memory = 32768 KB
> avail memory = 24056 KB
> mainbus0 (root)
> cpu0 at mainbus0: IXP425 266MHz rev 1 (XScale core)
> cpu0: DC enabled IC enabled WB enabled LABT branch prediction enabled
> cpu0: 32KB/32B 32-way Instruction cache
> cpu0: 32KB/32B 32-way write-back-locking Data cache
> ixpsip0 at mainbus0
> com0 at ixpsip0 addr 0xc8000000-0xc8000fff: ns16550a, working fifo
> com0: console
> ixp425_intr_establish(irq=15, ipl=3, func=c027ce14, arg=c10ab200)
> ixpclk0 at ixpsip0 addr 0xc8005000-0xc800502f
> ixpclk0: IXP425 Interval Timer
> ixpdog0 at ixpsip0: Watchdog Timer
> slugiic0 at ixpsip0: I2C bus
> slugbutt0 at ixpsip0: Power and Reset buttons
> slugled0 at ixpsip0: LED support
> ixpio0 at mainbus0
> ixpio0: configuring PCI bus
> pci0 at ixpio0 bus 0
> ohci0 at pci0 dev 1 function 0: vendor 0x1033 product 0x0035 (rev. 0x43)
> ixp425_intr_establish(irq=28, ipl=1, func=c02840e8, arg=c1105000)
> ohci0: interrupting at INTA
> ohci0: OHCI version 1.0
> usb0 at ohci0: USB revision 1.0
> uhub0 at usb0
> uhub0: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
> ohci1 at pci0 dev 1 function 1: vendor 0x1033 product 0x0035 (rev. 0x43)
> ixp425_intr_establish(irq=27, ipl=1, func=c02840e8, arg=c1108000)
> ohci1: interrupting at INTB
> ohci1: OHCI version 1.0
> usb1 at ohci1: USB revision 1.0
> uhub1 at usb1
> uhub1: vendor 0x1033 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
> ehci0 at pci0 dev 1 function 2: vendor 0x1033 product 0x00e0 (rev. 0x04)
> ixp425_intr_establish(irq=26, ipl=1, func=c0284f5c, arg=c110a800)
> ehci0: interrupting at INTC
> ehci0: companion controllers, 3 ports each: ohci0 ohci1
> usb2 at ehci0: USB revision 2.0
> uhub2 at usb2
> uhub2: vendor 0x1033 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
> ixme0 at mainbus0: IXP4xx MicroEngine Support
> ixp425_intr_establish(irq=3, ipl=1, func=c03d5264, arg=c1103000)
> ixp425_intr_establish(irq=4, ipl=1, func=c03d5264, arg=c1103000)
> ixpnpe0 at ixme0 NPE-B
> ixp425_intr_establish(irq=1, ipl=1, func=c03d6fc4, arg=c1102000)
> npe0 at ixpnpe0: Ethernet co-processor
> npe0: remember to fix rx q setup
> npe0: Ethernet address 00:18:39:a2:26:7c
> rlphy0 at npe0 phy 1: RTL8201L 10/100 media interface, rev. 1
> rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> clock: hz=100 stathz=0 profhz=0
> ixp425_intr_establish(irq=5, ipl=2, func=c03d44a8, arg=00000000)
> iic0 at slugiic0: I2C bus
> xrtc0 at iic0 addr 0x6f: Xicor X1226 Real-time Clock/NVRAM
> ixp425_intr_establish(irq=22, ipl=1, func=c03d9f2c, arg=c10b4000)
> ixp425_intr_establish(irq=29, ipl=1, func=c03d9ec0, arg=c10b4000)
> ixp425_intr_establish(irq=28, ipl=1, func=c03da2cc, arg=c1102f00)
> ixp425_intr_establish(irq=27, ipl=1, func=c03da220, arg=c1102f00)
>
> Welcome to sysinst, the NetBSD-4.99.50 system installation tool. This
> menu-driven tool is designed to help you install NetBSD to a hard 
> disk, or
> upgrade an existing NetBSD system, with a minimum of work.
> In the following menus type the reference letter (a, b, c, ...) to 
> select an
> item, or type CTRL+N/CTRL+P to select the next/previous item.
> The arrow keys and Page-up/Page-down may also work.
> Activate the current selection from the menu by typing the enter key.
>
>
>
>
> lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
> x>a: Installation messages in English x
> x b: Komunikaty instalacyjne w jezyku polskim x
> x c: Messages d'installation en fran�ais x
> x d: Installation auf Deutsch x
> x e: Mensajes de instalaci�n en castellano x
> mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
>
>
> At this point, you can follow the installation instructions to install 
> NetBSD onto a USB. The installation program will need to have access 
> to the base.tgz, comp.tgz, etc. files that are located in 
> ~/net/src/obj/releasedir/evbarm/binary/sets. As I wrote above, I used 
> a NFS server for that.
>
> Once NetBSD is installed on the USB disk, reboot the system and go 
> through the tftp process again, except this time, use the netbsd.bin 
> file that you put on the tftp server.
>
> Good luck. As always, comments are welcome.
>
> Thanks, Don
>
>