Annotation of wikisrc/tutorials/how_to_install_netbsd_on_the_linksys_nslu2___40__slug__41___without_a_serial_port__44___using_nfs_and_telnet.mdwn, revision 1.1

1.1     ! mspo        1: **Contents**
        !             2: 
        !             3: [[!toc levels=3]]
        !             4: 
        !             5: #Introduction
        !             6: 
        !             7: The standard kernel that you build for the NSLU2 requires that the Slug be modified to provide a serial port so that you can interact with the Slug during the boot process and to log in. This page will show you how to boot your Slug into NetBSD using only an ethernet connection. The strategy is to configure and build the kernel so that it automatically finds and mounts the root disk through DHCP and NFS without requiring that we type in the location of the root drive through the serial port. The root disk is a modification of the typical setup that allows an insecure telnet login to the NetBSD kernel running on the NSLU2. Once logged in, you can set up a username and password, enable ssh, and close out the insecure telnet connection.
        !             8: 
        !             9: The command line instructions that follow are for a Linux system using bash. They should be pretty much the same for another *nix system, except for the differences due to the shell.
        !            10: 
        !            11: #Get the source code
        !            12: 
        !            13: To get the source code (current):
        !            14: 
        !            15:     $ mkdir ~/net
        !            16:     $ export CVS_RSH="ssh"
        !            17:     $ export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
        !            18:     $ cd ~/net
        !            19:     $ cvs checkout -A -P src
        !            20: 
        !            21: */!\ The CVS address didnt work for me. I used: **export CVSROOT="anoncvs@anoncvs.se.NetBSD.org:/cvsroot"** /!\*
        !            22: 
        !            23: This will create a directory ~/net/src with the source tree in it.
        !            24: 
        !            25: See the section below (*Versions that are known to work*) to get an older version of NetBSD-current that should build and boot correctly. This section also has an update for changes to build.sh. 
        !            26: 
        !            27: #Build the kernel
        !            28: 
        !            29: **Note: The procedure shown here works for versions of NetBSD before about August 5, 2008. See the section below (Versions that are known to work) for changes to the three build.sh command lines.**
        !            30: 
        !            31: First, build the tools.
        !            32: 
        !            33:     $ cd ~/net/src
        !            34:     $ ./build.sh -m evbarm -a armeb tools
        !            35: 
        !            36: 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).
        !            37: 
        !            38: **NOTE:** *Versions 3.0 and later of the Intel firmware don't work.  Use version 2.3.2 or 2.4.*
        !            39: 
        !            40: We'll build three versions of the kernel, though only one will be used here. The other two kernels will be used when we move from mounting NetBSD using an NFS root to a disk drive connected to one of the USB ports. Add a configuration file, NSLU2_ALL, with the configuration for the three kernels. This file goes in the same directory as the standard NSLU2 configuration file. Note that we're including the standard file in our configuration file.
        !            41: <pre><code>
        !            42: $ cd ~/net/src/sys/arch/evbarm/conf
        !            43: $ echo 'include "arch/evbarm/conf/NSLU2"' >NSLU2_ALL
        !            44: $ echo 'config netbsd-nfs root on npe0 type nfs' >>NSLU2_ALL
        !            45: $ echo 'config netbsd-sd0 root on sd0a type ffs' >>NSLU2_ALL
        !            46: $ echo 'config netbsd-sd1 root on sd1a type ffs' >>NSLU2_ALL
        !            47: $ cat NSLU2_ALL
        !            48: include "arch/evbarm/conf/NSLU2"
        !            49: config netbsd-nfs root on npe0 type nfs
        !            50: config netbsd-sd0 root on sd0a type ffs
        !            51: config netbsd-sd1 root on sd1a type ffs
        !            52: </code></pre>
        !            53: Now build everything. (Much appreciation to Iain Hibbert for his help in understanding build.sh and its numerous configuration variables!)
        !            54: 
        !            55:     $ cd ~/net/src
        !            56:     $ ./build.sh -u -U -m evbarm -a armeb build
        !            57:     $ ./build.sh -u -U -m evbarm -a armeb -V KERNEL_SETS=NSLU2_ALL release
        !            58: 
        !            59: When finished, you'll find all of the necessary files in ~/net/src/obj/releasedir/evbarm/binary/sets.
        !            60: <pre><code>
        !            61: $ ls -la ~/net/src/obj/releasedir/evbarm/binary/sets/
        !            62: total 116200
        !            63: drwxr-xr-x 2 owner owner     4096 2008-03-07 10:22 .
        !            64: drwxr-xr-x 5 owner owner     4096 2008-03-07 10:19 ..
        !            65: -rw-rw-r-- 1 owner owner 24189627 2008-03-07 10:21 base.tgz
        !            66: -rw-rw-r-- 1 owner owner      272 2008-03-07 10:22 BSDSUM
        !            67: -rw-rw-r-- 1 owner owner      366 2008-03-07 10:22 CKSUM
        !            68: -rw-rw-r-- 1 owner owner 33559987 2008-03-07 10:21 comp.tgz
        !            69: -rw-rw-r-- 1 owner owner   369051 2008-03-07 10:21 etc.tgz
        !            70: -rw-rw-r-- 1 owner owner  3233648 2008-03-07 10:21 games.tgz
        !            71: -rw-rw-r-- 1 owner owner 25920807 2008-03-07 10:19 kern-ADI_BRH.tgz
        !            72: -rw-rw-r-- 1 owner owner  1267036 2008-03-07 10:19 kern-IXM1200.tgz
        !            73: -rw-rw-r-- 1 owner owner  8615170 2008-03-07 10:19 kern-NSLU2_ALL.tgz
        !            74: -rw-rw-r-- 1 owner owner  2872331 2008-03-07 10:19 kern-NSLU2.tgz
        !            75: -rw-rw-r-- 1 owner owner  8455973 2008-03-07 10:22 man.tgz
        !            76: -rw-rw-r-- 1 owner owner      632 2008-03-07 10:22 MD5
        !            77: -rw-rw-r-- 1 owner owner  3318310 2008-03-07 10:22 misc.tgz
        !            78: -rw-rw-r-- 1 owner owner     1820 2008-03-07 10:22 SHA512
        !            79: -rw-rw-r-- 1 owner owner      274 2008-03-07 10:22 SYSVSUM
        !            80: -rw-rw-r-- 1 owner owner  3815709 2008-03-07 10:22 tests.tgz
        !            81: -rw-rw-r-- 1 owner owner  3073516 2008-03-07 10:22 text.tgz
        !            82: </code></pre>
        !            83: The kern-ADI_BRH.tgz and kern-IXM1200.tgz are kernels for other ARM boards that are built automatically when you specify -m evbarm. We won't use them. 
        !            84: 
        !            85: #Set up the NFS file system
        !            86: 
        !            87: To setup the NFS server, see http://www.netbsd.org/docs/network/netboot/nfs.html and http://www.netbsd.org/docs/network/netboot/files.html. NOTEThe instructions that follow are written for system configurations where the NFS/tftp/DHCP server is a different machine than your build machine. If they are the same system, then ignore the ssh and scp commands.
        !            88: 
        !            89: Log into the nfs server using ssh, and setup the NetBSD file structure:
        !            90: 
        !            91:     $ sudo mkdir -p /export/client/root/dev
        !            92:     $ sudo mkdir /export/client/home
        !            93:     $ sudo touch /export/client/swap
        !            94:     $ sudo dd if=/dev/zero of=/export/client/swap bs=4k count=4k
        !            95:     $ sudo chmod 600 /export/client/swap
        !            96:     $ sudo mkdir /export/client/root/swap
        !            97: 
        !            98: Copy the necessary files from the build machine to the NFS system. On your build machine:
        !            99: 
        !           100:     $ cd ~/net/src/obj
        !           101:     $ scp -r releasedir/evbarm/binary/sets nfsserver:/export/client
        !           102: 
        !           103: Build the NetBSD root file system on the NFS server:
        !           104: 
        !           105:     $ cd /export/client/root
        !           106:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/base.tgz
        !           107:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/comp.tgz
        !           108:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/etc.tgz
        !           109:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/games.tgz
        !           110:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/man.tgz
        !           111:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/misc.tgz
        !           112:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/tests.tgz
        !           113:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/text.tgz
        !           114: 
        !           115: The next part is slightly more complicated for the two-system configuration. To make the /dev directory for the NFS file system, mount the NFS file system on your build machine:
        !           116: 
        !           117:     $ sudo mount -t nfs nfsserver:/export/client/root /mnt/root
        !           118:     $ cd /mnt/root/dev
        !           119: 
        !           120: Then execute the MAKEDEV shell script from your build machine. Skip the mounting part if you use only one system.
        !           121: 
        !           122:     $ sudo sh ./MAKEDEV -m ~/net/src/obj/tooldir.YOUR.SYSTEM.HERE/bin/nbmknod all
        !           123: 
        !           124: Save the original NetBSD /etc directory, just in case you would like to refer to it later:
        !           125: 
        !           126:     $ sudo cp -r /export/client/root/etc /export/client/root/orig.etc
        !           127:     $ cd /export/client/root/etc
        !           128: 
        !           129: Setup the various files in the exported etc so that the system will boot up and allow logins via telnet. The edit command is shown, along with the final file configuration, except for inetd.conf which is very long.
        !           130: 
        !           131: ##/export/client/root/etc/hosts
        !           132: 
        !           133:     $ sudo nano hosts
        !           134: <pre><code>
        !           135: #      $NetBSD: hosts,v 1.7 2004/08/29 13:26:17 chs Exp $
        !           136: #
        !           137: # Host Database
        !           138: # This file should contain the addresses and aliases
        !           139: # for local hosts that share this file.
        !           140: # It is used only for "ifconfig" and other operations
        !           141: # before the nameserver is started.
        !           142: #
        !           143: #
        !           144: ::1                    localhost localhost.
        !           145: 127.0.0.1              localhost localhost.
        !           146: #
        !           147: # RFC 1918 specifies that these networks are "internal".
        !           148: # 10.0.0.0     10.255.255.255
        !           149: # 172.16.0.0   172.31.255.255
        !           150: # 192.168.0.0  192.168.255.255
        !           151: 192.168.1.102  nfsserver  # my NFS server
        !           152: 192.168.1.240  slug1           # my NSLU2
        !           153: </code></pre>
        !           154: 
        !           155: ##/export/client/root/etc/fstab
        !           156: 
        !           157:     $ sudo nano fstab
        !           158: 
        !           159:     #/etc/fstab
        !           160:     nfsserver:/client/swap   none  swap  sw,nfsmntpt=/swap
        !           161:     nfsserver:/client/root   /     nfs   rw 0 0
        !           162: 
        !           163: ##/export/client/root/etc/ifconfig.npe0
        !           164: 
        !           165:     $ sudo nano ifconfig.npe0
        !           166: 
        !           167:     inet client netmask 255.255.255.0 broadcast 192.168.1.255
        !           168: 
        !           169: ##/export/client/root/etc/inetd.conf
        !           170: <pre><code>
        !           171: $ sudo nano inetd.conf
        !           172: 
        !           173: Change the two lines:
        !           174: 
        !           175: #telnet         stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd -a valid 
        !           176: #telnet         stream  tcp6    nowait  root    /usr/libexec/telnetd    telnetd -a valid 
        !           177: 
        !           178: to
        !           179: 
        !           180: telnet          stream  tcp     nowait  root    /usr/libexec/telnetd    telnetd 
        !           181: telnet          stream  tcp6    nowait  root    /usr/libexec/telnetd    telnetd 
        !           182: </code></pre>
        !           183: ##/export/client/root/etc/rc.conf
        !           184: <pre><code>
        !           185: $ sudo nano rc.conf
        !           186: 
        !           187: #      $NetBSD: rc.conf,v 1.96 2000/10/14 17:01:29 wiz Exp $
        !           188: #
        !           189: # see rc.conf(5) for more information.
        !           190: #
        !           191: # Use program=YES to enable program, NO to disable it. program_flags are
        !           192: # passed to the program on the command line.
        !           193: #
        !           194: # Load the defaults in from /etc/defaults/rc.conf (if it's readable).
        !           195: # These can be overridden below.
        !           196: #
        !           197: if [ -r /etc/defaults/rc.conf ]; then
        !           198:         . /etc/defaults/rc.conf
        !           199: fi
        !           200: 
        !           201: # If this is not set to YES, the system will drop into single-user mode.
        !           202: #
        !           203: rc_configured=YES
        !           204: # Add local overrides below
        !           205: #
        !           206: sshd=YES
        !           207: hostname="slug1"
        !           208: defaultroute="192.168.1.1"
        !           209: nfs_client=YES
        !           210: auto_ifconfig=NO
        !           211: net_interfaces=""
        !           212: </code></pre>
        !           213: 
        !           214: ##/export/client/root/etc/ttys
        !           215: <pre><code>
        !           216: $ sudo nano ttys
        !           217: 
        !           218: #      $NetBSD: ttys,v 1.5 2004/06/20 21:30:27 christos Exp $
        !           219: #
        !           220: #      from: @(#)ttys  5.1 (Berkeley) 4/17/89
        !           221: #
        !           222: # name getty                           type    status          comments
        !           223: #
        !           224: console        "/usr/libexec/getty default"    vt100   on secure
        !           225: ttyp0  "/usr/libexec/getty Pc"         vt100   off secure
        !           226: ttyE0  "/usr/libexec/getty Pc"         vt220   off secure
        !           227: ttyE1  "/usr/libexec/getty Pc"         vt220   off secure
        !           228: ttyE2  "/usr/libexec/getty Pc"         vt220   off secure
        !           229: ttyE3  "/usr/libexec/getty Pc"         vt220   off secure
        !           230: tty00  "/usr/libexec/getty default"    unknown off secure
        !           231: tty01  "/usr/libexec/getty default"    unknown off secure
        !           232: tty02  "/usr/libexec/getty default"    unknown off secure
        !           233: tty03  "/usr/libexec/getty default"    unknown off secure
        !           234: tty04  "/usr/libexec/getty default"    unknown off secure
        !           235: tty05  "/usr/libexec/getty default"    unknown off secure
        !           236: tty06  "/usr/libexec/getty default"    unknown off secure
        !           237: tty07  "/usr/libexec/getty default"    unknown off secure
        !           238: </code></pre>
        !           239: 
        !           240: #Setup the tftp, NFS, and DHCP servers
        !           241: 
        !           242: Now, setup tftp, NFS, and DHCP. On my Fedora 7 system, I use the following setup. Please note that the files shown below are believed to be correct, but if tftp, NFS, or DHCP isn't working for you, try Googling “<service name> <operating system> howto”. Also, check your SELinux settings – mine were preventing the slug from attaching to the NFS files. Remember - the kern-NSLU2_ALL.tgz was copied to the NFS server /export/client directory in the previous section. (NB: It wouldn't be a bad idea for somebody to add the settings required for a NetBSD system here.) As in the previous section, edit or create the files as necessary using nano or your favorite text editor.
        !           243: 
        !           244:     $ cd /export/client/root
        !           245:     $ sudo tar --numeric-owner -xvpzf /export/client/releasedir/evbarm/binary/sets/kern-NSLU2_ALL.tgz
        !           246:     $ cp *.bin /tftpboot
        !           247:     $ sudo chmod 666 /tftpboot/*bin
        !           248: 
        !           249: ##/etc/hosts
        !           250: 
        !           251:     192.168.1.240           slug1 
        !           252:     192.168.0.1             redboot 
        !           253:     192.168.1.102              your_host_name #use your host address
        !           254: 
        !           255: ##/etc/hosts.allow
        !           256: 
        !           257:     in.tftpd:   192.168.0.1
        !           258:     rpcbind:    192.168.1.240 
        !           259:     lockd:      192.168.1.240 
        !           260:     rquotad:    192.168.1.240 
        !           261:     mountd:     192.168.1.240 
        !           262:     statd:      192.168.1.240 
        !           263: 
        !           264: ##/etc/xinetd.d/tftp
        !           265: <pre><code>
        !           266: service tftp 
        !           267: { 
        !           268:         disable = no 
        !           269:         socket_type             = dgram 
        !           270:         protocol                = udp 
        !           271:         wait                    = yes 
        !           272:         user                    = root 
        !           273:         server                  = /usr/sbin/in.tftpd 
        !           274:         server_args             = -s /tftpboot 
        !           275:         per_source              = 11 
        !           276:         cps                     = 100 2 
        !           277:         flags                   = IPv4 
        !           278: } 
        !           279: </code></pre>
        !           280: 
        !           281: ##/etc/dhcpd.conf
        !           282: <pre><code>
        !           283: ddns-update-style ad-hoc; 
        !           284: option subnet-mask 255.255.255.0; 
        !           285: option broadcast-address 192.168.1.255; 
        !           286: option domain-name-servers xxx.xxx.xxx.xxx; #Use your nameserver address
        !           287: default-lease-time 2592000; 
        !           288: allow bootp; 
        !           289: allow booting;  
        !           290: 
        !           291: #option ip-forwarding    false;  # No IP forwarding 
        !           292: #option mask-supplier    false;  # Don't respond to ICMP Mask req  
        !           293: 
        !           294: subnet 192.168.1.0 netmask 255.255.255.0 { 
        !           295:         option routers        192.168.1.1; 
        !           296:         range 192.168.1.110 192.168.1.189; 
        !           297:         } 
        !           298: 
        !           299: group   { 
        !           300:       next-server 192.168.1.102;          # IP address of your TFTP server 
        !           301:       option routers 192.168.1.1; 
        !           302:       default-lease-time 2592000; 
        !           303:       host slug1 { 
        !           304:                 hardware ethernet 00:18:39:a2:26:7c; 
        !           305:                 fixed-address 192.168.1.240;
        !           306:                 option root-path "/client/root"; 
        !           307:                 } 
        !           308:         } 
        !           309: </code></pre>
        !           310: 
        !           311: ##/etc/exports
        !           312: 
        !           313: /export/client/root 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
        !           314: /export/client/swap 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
        !           315: 
        !           316: #Interrupting Slug bootup using telnet
        !           317: 
        !           318: Unless we modify the flash memory of the Slug, the normal boot process is to load RedBoot, wait a few seconds, then load a kernel and memory disk image from flash and execute it. This process can be interrupted if you install a serial port by typing a ^C within two seconds after seeing the following message appear on the serial port screen:
        !           319: 
        !           320:     RedBoot(tm) bootstrap and debug environment [ROMRAM]
        !           321:     Red Hat certified release, version 1.92 - built 15:16:07, Feb  3 2004
        !           322:     
        !           323:     Platform: IXDP425 Development Platform (XScale)
        !           324:     Copyright (C) 2000, 2001, 2002, Red Hat, Inc.
        !           325: 
        !           326:     RAM: 0x00000000-0x02000000, 0x000723a0-0x01ff3000 available
        !           327:     FLASH: 0x50000000 - 0x50800000, 64 blocks of 0x00020000 bytes each.
        !           328:     == Executing boot script in 2.000 seconds - enter ^C to abort
        !           329: 
        !           330: 
        !           331: The good people at www.nslu2-linux.org have also documented a way to do the same thing with telnet. This means you can use telnet to interrupt the boot process and instruct the Slug to load an executable using tftp. Of course, the Slug will still revert back to the serial port as the login console, but the changes we made above will also allow you to login in as root using telnet. Note that this process requires two different telnet sessions, even though they are to the same device (in general, they will use two different IP addresses), since one is to RedBoot and the second will be to NetBSD.
        !           332: 
        !           333: There are several methods described for using telnet to interrupt RedBoot, which you can find at <http://www.nslu2-linux.org/wiki/HowTo/TelnetIntoRedBoot>. My personal preference is the one near the bottom of the web page entitled “C program using Berkeley Sockets”. Just copy the source code from the web page, paste it into a file (telnet_slug.c) using any editor, and compile. I had to add two header files, string.h and stdlib.h, to get the program to compile using Fedora 8 and gcc 4.1.2. The first three lines in my file look like:
        !           334: 
        !           335:     #include <stdio.h> 
        !           336:     #include <string.h> 
        !           337:     #include <stdlib.h> 
        !           338: 
        !           339: Then,
        !           340: 
        !           341:     $ gcc telnet_slug.c -o telnet_slug
        !           342: 
        !           343: to compile the program. You also need to set your network configuration so that your computer can respond to the Slug when it starts up with IP address 192.168.0.1. For my Fedora 8 system, I use the following:
        !           344: 
        !           345:     $ sudo /sbin/ifconfig eth0:1 inet 192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0 
        !           346: 
        !           347: You'll find other suggestions for other operating systems at the top of the aforementioned web page. Now, run the program before you power on the Slug and you should see:
        !           348: 
        !           349:     $ ./telnet_slug
        !           350:     == Executing boot script in 1.950 seconds - enter ^C to abort 
        !           351:     Telnet escape character is '~'. 
        !           352:     Trying 192.168.0.1... 
        !           353:     Connected to 192.168.0.1. 
        !           354:     Escape character is '~'. 
        !           355:     RedBoot> 
        !           356: 
        !           357: What could be easier? Occasionally, the system trying to telnet into RedBoot will be a little too slow, so if you don't see anything happening after a minute or so, try again. For reference, my Slug with the clock speed-up modification, takes 12 seconds from power on to the RedBoot prompt. Presumably, it will take 24 seconds if you have an older Slug without the modification.
        !           358: 
        !           359: #Booting the Slug with NFS
        !           360: 
        !           361: Now, start up the NSLU2 and interrupt the boot process as described above:
        !           362: <pre><code>
        !           363: $ ./telnet_slug
        !           364: == Executing boot script in 1.960 seconds - enter ^C to abort
        !           365: Telnet escape character is '~'.
        !           366: Trying 192.168.0.1...
        !           367: Connected to 192.168.0.1.
        !           368: Escape character is '~'.
        !           369: RedBoot> ip_address -h 192.168.0.2
        !           370: IP: 192.168.0.1/255.255.255.0, Gateway: 192.168.0.1
        !           371: Default server: 192.168.0.2, DNS server IP: 0.0.0.0
        !           372: RedBoot> load -r -b 0x200000 netbsd-nfs.bin
        !           373: Using default protocol (TFTP)
        !           374: Raw file loaded 0x00200000-0x004a2ba7, assumed entry at 0x00200000
        !           375: RedBoot> g
        !           376: ~
        !           377: 
        !           378: telnet> q
        !           379: Connection closed.
        !           380: 
        !           381: $ telnet slug1
        !           382: Trying 192.168.1.240...
        !           383: Connected to slug1.
        !           384: Escape character is '^]'.
        !           385: 
        !           386: NetBSD/evbarm (slug1) (ttyp0)
        !           387: 
        !           388: login: root
        !           389: Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
        !           390:     2006, 2007, 2008
        !           391:     The NetBSD Foundation, Inc.  All rights reserved.
        !           392: Copyright (c) 1982, 1986, 1989, 1991, 1993
        !           393:     The Regents of the University of California.  All rights reserved.
        !           394: 
        !           395: NetBSD 4.99.54 (NSLU2_NFS) #0: Fri Feb 15 23:04:29 EST 2008
        !           396: 
        !           397: Welcome to NetBSD!
        !           398: 
        !           399: This system is running a development snapshot of the NetBSD operating system,
        !           400: also known as NetBSD-current.  It is highly possible for it to contain serious
        !           401: bugs, regressions, broken features or other problems.  Please bear this in mind
        !           402: and use the system with care. 
        !           403: 
        !           404: You are encouraged to test this version as thoroughly as possible.  Should you
        !           405: encounter any problem, please report it back to the development team using the
        !           406: send-pr(1) utility (requires a working MTA).  If yours is not properly set up,
        !           407: use the web interface at: http://www.NetBSD.org/support/send-pr.html 
        !           408: 
        !           409: Thank you for helping us test and improve NetBSD.
        !           410: We recommend creating a non-root account and using su(1) for root access.
        !           411: slug1#
        !           412: </code></pre>
        !           413: The first time I booted the Slug using NFS, it took several minutes to setup up files and such, so be patient.
        !           414: 
        !           415: #Using sysinst to install NetBSD onto a USB drive
        !           416: 
        !           417: If you're new to NetBSD, you might feel more comfortable using the NetBSD installer to set up NetBSD on your USB thumb or hard disk. Everything you need was built during the kernel build steps above. The installer consists of five files; one is the executable and the other four are the installation messages in German, French, Spanish, and Polish. To use the installer, move it to the NFS server used above to boot up the NSLU2 and add the installation directory to the exported NFS directories in /etc/exports on the NFS server. Don't forget to update the exports list.
        !           418: 
        !           419:     $ cd ~/net/src/distrib/evbarm/instkernel/ramdisk/obj/work/
        !           420:     $ scp sysinst* nfsserver:/export/client/
        !           421:     $ sudo nano /etc/exports
        !           422:     $ sudo /usr/sbin/exportfs -ra
        !           423: 
        !           424: NFS server's /etc/exports:
        !           425: 
        !           426:     /export/client     192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
        !           427:     /export/client/root 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
        !           428:     /export/client/swap 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
        !           429: 
        !           430: Boot up the slug as before, and mount the newly exported directory.
        !           431: <pre><code>
        !           432: slug1# mkdir /mnt/inst
        !           433: slug1# mount -t nfs nfsserver:/export/client /mnt/inst
        !           434: slug1# ls -la /mnt/inst
        !           435: total 18064 
        !           436: drwxrwxrwx   6 root  wheel      4096 Mar  7 19:41 . 
        !           437: drwxr-xr-x   5 root  wheel      4096 Mar  7 19:52 .. 
        !           438: drwxr-xr-x   2 root  wheel      4096 Feb 26 21:53 home 
        !           439: drwxr-xr-x   3 500   501        4096 Mar  7 16:03 releasedir 
        !           440: drwxr-xr-x  20 root  wheel      4096 Mar  7 16:05 root 
        !           441: -rw-------   1 root  wheel  16777216 Feb 28 03:15 swap 
        !           442: -r-xr-xr-x   1 500   501     1571140 Mar  7 19:41 sysinst 
        !           443: -r--r--r--   1 500   501       23994 Mar  7 19:41 sysinstmsgs.de 
        !           444: -r--r--r--   1 500   501       23727 Mar  7 19:41 sysinstmsgs.es 
        !           445: -r--r--r--   1 500   501       23785 Mar  7 19:41 sysinstmsgs.fr 
        !           446: -r--r--r--   1 500   501       21140 Mar  7 19:41 sysinstmsgs.pl 
        !           447: drwxr-xr-x   2 root  wheel      4096 Feb 26 21:53 usr 
        !           448: </code></pre>
        !           449: Make sure that NetBSD recognizes your USB drive.
        !           450: 
        !           451:     slug1# dmesg | grep sd 
        !           452:     sd0 at scsibus0 target 0 lun 0: <SanDisk, U3 Cruzer Micro, 3.21> disk removable 
        !           453:     sd0: 3919 MB, 7964 cyl, 16 head, 63 sec, 512 bytes/sect x 8027793 sectors 
        !           454: 
        !           455: Change to the directory with the installer and run it. You'll see the following messages on your telnet terminal.
        !           456: <pre><code>
        !           457: slug1# cd /mnt/inst
        !           458: slug1# ./sysinst 
        !           459: 
        !           460: Welcome to sysinst, the NetBSD-4.99.55 system installation tool.  This menu-driven tool is designed 
        !           461: to help you install NetBSD to a hard disk, or upgrade an existing NetBSD system, with a minimum of work. 
        !           462: [...snip (Select your language preference)...]
        !           463: 
        !           464: 
        !           465:          +-----------------------------------------------+ 
        !           466:          ¦ NetBSD-4.99.55 Install System                 ¦                                                                                                                                                                   
        !           467:          ¦                                               ¦ 
        !           468:          ¦                                               ¦ 
        !           469:          ¦>a: Install NetBSD to hard disk                ¦ 
        !           470:          ¦ b: Upgrade NetBSD on a hard disk              ¦ 
        !           471:          ¦ c: Re-install sets or install additional sets ¦ 
        !           472:          ¦ d: Reboot the computer                        ¦ 
        !           473:          ¦ e: Utility menu                               ¦ 
        !           474:          ¦ x: Exit Install System                        ¦ 
        !           475:          +-----------------------------------------------+ 
        !           476: 
        !           477: </code></pre>
        !           478: First, select the utility menu option. From here, set up your network so that the installation program can generate the necessary files in /etc. When done, return to the install system menu and select the "Install NetBSD to hard disk" option and follow the instructions. When you get to the third menu, select "Custom installation". Then mark the following items “Yes”:
        !           479: <pre><code>
        !           480: The following is the list of distribution sets that will be used. 
        !           481: 
        !           482:     Distribution set         Selected 
        !           483:     ------------------------ -------- 
        !           484:  a: Kernel (ADI_BRH)             No 
        !           485:  b: Kernel (INTERGRATOR)         No 
        !           486:  c: Kernel (IQ80310)             No 
        !           487:  d: Kernel (IQ80321)             No 
        !           488:  e: Kernel (TEAMASA_NPWR)        No 
        !           489:  f: Kernel (TS7200)              No 
        !           490:  g: Base                        Yes 
        !           491:  h: System (/etc)               Yes 
        !           492:  i: Compiler Tools              Yes 
        !           493:  j: Games                        No 
        !           494:  k: Online Manual Pages         Yes 
        !           495:  l: Miscellaneous               Yes 
        !           496:  m: Test programs               Yes 
        !           497:  n: Text Processing Tools       Yes 
        !           498:  o: X11 sets                    None 
        !           499: >x: Install selected sets 
        !           500: </code></pre>
        !           501: Continue with the normal installation. When asked for the location of the distribution files, select “Local Directory”.
        !           502: <pre><code>
        !           503: Your disk is now ready for installing the kernel and the distribution sets.  
        !           504: As noted in your INSTALL notes, you have several options.  For ftp or nfs, 
        !           505: you must be connected to a network with access to the proper machines. 
        !           506: 
        !           507: Sets selected 7, processed 0, Next set base. 
        !           508: 
        !           509:               +-------------------------+ 
        !           510:               ¦ Install from            ¦ 
        !           511:               ¦                         ¦ 
        !           512:               ¦ a: CD-ROM / DVD         ¦ 
        !           513:               ¦ b: FTP                  ¦ 
        !           514:               ¦ c: HTTP                 ¦ 
        !           515:               ¦ d: NFS                  ¦ 
        !           516:               ¦ e: Floppy               ¦ 
        !           517:               ¦ f: Unmounted fs         ¦ 
        !           518:               ¦>g: Local directory      ¦ 
        !           519:               ¦ h: Skip set             ¦ 
        !           520:               ¦ i: Skip set group       ¦ 
        !           521:               ¦ j: Abandon installation ¦ 
        !           522:               +-------------------------+ 
        !           523: 
        !           524: </code></pre>
        !           525: Next screen:
        !           526: 
        !           527:     Enter the already-mounted local directory where the distribution is located.
        !           528:     Remember, the directory should contain the .tgz files. 
        !           529:     
        !           530:     >a: Base directory            /mnt/inst/releasedir 
        !           531:      b: Set directory             /evbarm/binary/sets 
        !           532:      x: Continue 
        !           533: 
        !           534: 
        !           535: Make sure you enter a password for the root user, since we are going to use secure shell to login to the NSLU2. Once the installation is finished, NetBSD checks the file system to see if everything looks OK. Since we didn't install a kernel to the disk, NetBSD will think that the installation is incomplete. You can ignore the warning message. Exit the installation, which unmounts the USB disk, and remount the disk. Edit the two files below, then reboot the NSLU2.
        !           536: 
        !           537:     slug1# mkdir /mnt/d0
        !           538:     slug1# mount /dev/sd0a /mnt/d0
        !           539:     slug1# cd /mnt/d0/etc
        !           540:     slug1# vi rc.conf
        !           541:     slug1# vi ssh/sshd_config
        !           542:     slug1# reboot
        !           543: 
        !           544: Slug's rc.conf:
        !           545: <pre><code>
        !           546: #       $NetBSD: rc.conf,v 1.96 2000/10/14 17:01:29 wiz Exp $
        !           547: #
        !           548: # see rc.conf(5) for more information.
        !           549: #
        !           550: # Use program=YES to enable program, NO to disable it. program_flags are
        !           551: # passed to the program on the command line.
        !           552: #
        !           553:  
        !           554: # Load the defaults in from /etc/defaults/rc.conf (if it's readable).
        !           555: # These can be overridden below.
        !           556: #
        !           557: if [ -r /etc/defaults/rc.conf ]; then
        !           558:         . /etc/defaults/rc.conf
        !           559: fi
        !           560: 
        !           561: # If this is not set to YES, the system will drop into single-user mode.
        !           562: #
        !           563: rc_configured=YES
        !           564: 
        !           565: # Add local overrides below
        !           566: #
        !           567: hostname=slug1.
        !           568: defaultroute="192.168.1.1"
        !           569: sshd=YES
        !           570: </code></pre>
        !           571: Slug's ssh/sshd_config:
        !           572: <pre><code>
        !           573: #       $NetBSD: sshd_config,v 1.29 2008/01/28 13:57:02 christos Exp $
        !           574: #       $OpenBSD: sshd_config,v 1.75 2007/03/19 01:01:29 djm Exp $
        !           575: 
        !           576: # This is the sshd server system-wide configuration file.  See
        !           577: # sshd_config(5) for more information.
        !           578: 
        !           579: # The strategy used for options in the default sshd_config shipped with
        !           580: # OpenSSH is to specify options with their default value where
        !           581: # possible, but leave them commented.  Uncommented options change a
        !           582: # default value.
        !           583: 
        !           584: [...snip...]
        !           585: PermitRootLogin yes 
        !           586: [...snip...]
        !           587: </code></pre>
        !           588: After rebooting, use the method described above for interrrupting the boot process with telnet, assign the host ip address and use tftp to load the kernel netbsd-sd0.bin, which uses sd0a as the root drive. Remember, this is one of the three kernels we built earlier. You should be able to ssh to your Slug and login as root.
        !           589: <pre><code>
        !           590: $ ./telnet_slug 
        !           591: == Executing boot script in 1.640 seconds - enter ^C to abort 
        !           592: Telnet escape character is '~'.  
        !           593: Trying 192.168.0.1... 
        !           594: Connected to 192.168.0.1. 
        !           595: Escape character is '~'. 
        !           596: RedBoot> ip_address -h 192.168.0.2 
        !           597: IP: 192.168.0.1/255.255.255.0, Gateway: 192.168.0.1 
        !           598: Default server: 192.168.0.2, DNS server IP: 0.0.0.0 
        !           599: RedBoot> load -r -b 0x200000 netbsd-sd0.bin 
        !           600: Using default protocol (TFTP) 
        !           601: Raw file loaded 0x00200000-0x004a2b9f, assumed entry at 0x00200000 
        !           602: RedBoot> g
        !           603: ~
        !           604: telnet> q 
        !           605: Connection closed. 
        !           606: $ ssh root@slug1
        !           607: Password:
        !           608: 
        !           609: Last login: Thu Mar 20 21:51:38 2008 from 192.168.1.105
        !           610: 
        !           611: NetBSD 4.99.55 (NSLU2_ALL) #0: Sat Mar 8 11:33:58 EST 2008
        !           612: 
        !           613: 
        !           614: 
        !           615: Welcome to NetBSD!
        !           616: 
        !           617: 
        !           618: [...snip...]
        !           619: 
        !           620: Terminal type is xterm.                                                 
        !           621: 
        !           622: We recommend creating a non-root account and using su(1) for root access.
        !           623: 
        !           624: slug1#
        !           625: </code></pre>
        !           626: 
        !           627: #Troubleshooting
        !           628: ##Can't format USB drive with sysinstall
        !           629: 
        !           630: On occasion, I've had trouble with sysinst failing to install to the USB drive. The symptom(s) seen most often is the slug hanging up when formatting the disk or untarring the distribution tarballs. I've had some success deleting the disklabel for the USB drive and then restarting sysinst. To do this (reference: To clear the disklabels), exit the install system and enter at the root prompt:
        !           631: 
        !           632:     dd if=/dev/zero of=/dev/sd0c bs=8k count=1
        !           633: 
        !           634: Then, restart the installer and try again. Of course, make sure you use the device that corresponds to the USB drive you want to work on.
        !           635: 
        !           636: ##Build error with some versions of Linux
        !           637: 
        !           638: With certain version of Linux (notably Fedora 7), I get an error that looks like:
        !           639: 
        !           640:     checking for i686-pc-linux-gnu-gcc... cc
        !           641:     checking for C compiler default output file name... configure: error: C compiler cannot create executables
        !           642:     See `config.log' for more details.
        !           643:     nbgmake: *** [configure-gcc] Error 1
        !           644: 
        !           645:     *** Failed target:  .build_done
        !           646:     (more error output)
        !           647: 
        !           648: Try defining the following two variables, then follow the build instructions above:
        !           649: 
        !           650:     $ export HOST_CC=/usr/bin/gcc
        !           651:     $ export HOST_CXX=/usr/bin/g++
        !           652: 
        !           653: You can find additional suggestions in ~/net/src/BUILDING.
        !           654: 
        !           655: #Versions that are known to work
        !           656: 
        !           657: Since, at the time of this writing, you must use -current to get a version of NetBSD that will run on the Slug, you will occasionally find that the kernel doesn't boot quite right. Don't complain - that's what -current is for. Here, we'll try to keep track of the latest version of NetBSD that is known to build and boot correctly. You can get these versions by changing the CVS command line. To get an older version of NetBSD-current use:
        !           658: 
        !           659:     $ export CVS_RSH="ssh"
        !           660:     $ export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
        !           661:     $ cd ~/net
        !           662:     $ cvs checkout -D 20080420-UTC src
        !           663: 
        !           664: The script build.sh has changed since this article was first written. The following worked on August 23, 2008:
        !           665: 
        !           666:     export CVS_RSH="ssh"
        !           667:     export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
        !           668:     cvs checkout -D 20080821-UTC src
        !           669: 
        !           670: **Note:** A checkout date of 20081215-UTC built and ran correctly.
        !           671: **Note:** There have been some reported problems with the 20081215 build.
        !           672: 
        !           673: Get the NPE code from Intel, as above. Setup the kernel configuration files as above. Then, build as follows:
        !           674: 
        !           675: ./build.sh -O ../obj -T ../tools -m evbarm-eb tools
        !           676: ./build.sh -O ../obj -T ../tools -U -u -m evbarm-eb distribution
        !           677: ./build.sh -O ../obj -T ../tools -U -u -m evbarm-eb -V KERNEL_SETS=NSLU2_ALL release
        !           678: 
        !           679: The files you'll need are now in *~/net/obj/releasedir/evbarm/binary/sets*. 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb