wiki:NanoBSD

Version 60 (modified by huub, 15 years ago) ( diff )

--

Welcome to 'building the WirelessLeiden NanoBSD image'

FreeBSD default method for installing FreeBSD on embedded devices, like Soekris, Alix and others. The manual described below is (loosely) based on the Concept plan of Tim Baas, but also consists of many hints by official 'Introduction to NanoBSD' manual and other stuff found on the net ;-)

Have to remember links

Procedure

Please note that you can find the supporting files in the subdirectory nanobsd

A. Setup a FreeBSD host

Get yourself a fresh freebsd host with ports and subversion installed as follows:

A.1. Run the basic CD installer of 7.2.

The procedure below has been tested with 7.2-RELEASE (standard developer install - no ports - will fit our needs). Installing FreeBSD is outside the scope of this document, take a look into the FreeBSD handbook Chapter 2 Installing FreeBSD if you do not know the details.

Please do mind that all commands below need to be executed as root, due to the many mounts and unmounts done in various phases.

Internet connection is required.

A.2. get latest sources

$ csup  -h cvsup.nl.freebsd.org /usr/share/examples/cvsup/standard-supfile

A.3 fetch ports

$ portsnap fetch extract

A.4. install subversion (set ftp to passive mode to ensure the firewall is not causing issues if one exists. NOTE: Install all packages via ports to prevent issues later on!

$ setenv FTP_PASSIVE_MODE YES
$ cd /usr/ports/devel/subversion; make install clean BATCH=yes

A.5. OPTIONAL, every developer has his own preferences, these are mine ;-)

$ (cd /usr/ports/editors/vim-lite; make install clean BATCH=yes)
$ (cd /usr/ports/security/sudo; make install clean BATCH=yes)
$ (cd /usr/ports/sysutils/screen; make install clean BATCH=yes)

B. Build environment

B.1 Download the environment from the Wireless Leiden svn repository

$ setenv R /root/nanobsd
$ svn checkout http://svn.wirelessleiden.nl/svn/projects/iris/nanobsd $R
$ cd $R

Note: if svn is not found: svn is in /usr/local/bin, alternatively log out and in, or use rehash in a csh shell to make it available.

B.2. Compile all required packages using

$ /root/nanobsd/tools/package-build.sh

B.3. Set your favorite root password to be used in the image

$ setenv CFG_ROOT_PASSWORD `dd if=/dev/random bs=10k count=10 | & tr -cd '[a-zA-Z0-9]' | cut -c -15`; echo $CFG_ROOT_PASSWORD

If you like a simple password, substitute the `dd if=/dev/random bs=10k count=10 | & tr -cd '[a-zA-Z0-9]' | cut -c -15` with your password.

B.4. Build nanobsd (make sure to prepare some coffee;-) )

$ sh /usr/src/tools/tools/nanobsd/nanobsd.sh -c /root/nanobsd/cfg/nanobsd.wleiden 

Note 1: Take a coffee of go for a hike, this normally takes 2 - 8 hours depending on the machine configuration

Note 2: even this little script got flags, check the output of sh /usr/src/tools/tools/nanobsd/nanobsd.sh -h

-b suppress builds (both kernel and world)
-k suppress buildkernel
-w suppress buildworld
-c specify config file
...

C. Fetch node configuration onto image

$ /root/nanobsd/tools/config-image.sh 

The script is connecting to the Wireless Leiden 'genesis' database. Pick your situation!

  1. New image: Put full image on flash disk (minimum 1 GB)
    $ dd bs=64k if=/usr/obj/nanobsd.wleiden/_.disk.full of=/dev/da0
    
    (assuming /dev/da0 is your compact flash entry; this takes about 15 minutes)
  2. Existing image: Put partial image on slice (slice 2)
    $ dd bs=64k if=/usr/obj/nanobsd.wleiden/_.disk.image of=/dev/da0s2
    
  3. Existing image remote update (slice 2)
    $ gzip -c /usr/obj/nanobsd.wleiden/_.disk.image | ssh root@192.168.4.100 'gzip | sh /tools/updatep2'
    

D. All done!

Place the image in the new machine and boot it up, you should be good to go!

Note. For next nodes you can skip the build if you are not going to use the same image again and go directly for step 4, or take a look at development if you have to rebuild the image after (small changes).

Development

For small changes there is a shortcut in the build (to save you some coffee ;-)). Pick the situation applicable

  1. First lets pump it's source to the latest version
    $ svn up /root/nanobsd
    
    1. Only changes in kernel options - kernel.wleiden altered - ETA 0:45
      $ sh /usr/src/tools/tools/nanobsd/nanobsd.sh -w -c /root/nanobsd/cfg/nanobsd.wleiden
      
    2. Only changes in world options - CONF_{BUILD,COMMON,INSTALL} in nanobsd.wleiden altered - ETA 2:00 - 6:00
      $ sh /usr/src/tools/tools/nanobsd/nanobsd.sh -k -c /root/nanobsd/cfg/nanobsd.wleiden
      
    3. _NO_ changes in build options - any other file altered - ETA 0:10
      $ sh /usr/src/tools/tools/nanobsd/nanobsd.sh -b -c /root/nanobsd/cfg/nanobsd.wleiden
      

Light based packages suggestions

  • dnsmasq instead of isc-dhcp30-server and bind
  • thttpd instead of apache

Further research

  • stumber /usr/src/tools/tools/net80211/stumber

Background

Testing Images

TestingViaNFS

Hints

  • You could always decide to install your FreeBSD base instance into a virtual environment
  • cvsup.nl.freebsd.org is the local dutch cvsup mirror, replace nl with your proper country code
  • It seems tempting to follow /usr/share/examples/cvsup/stable-supfile instead of /usr/share/examples/cvsup/standard-supfile please DO NOT unless your like big trouble as stable-supfile is the stable DEVELOPMENT branch e.g. upcoming stable.
  • Default username/password = root/welkom01
  • Always use cu or putty for serial communication minicom, screen, putty all issues of some kind.

Comments, questions or remarks?

Feel free to edit this page or send an email to our techniek mailinglist

  • Handy .cshrc hints
    alias quicknano sh /usr/src/tools/tools/nanobsd/nanobsd.sh -b -c /root/nanobsd/cfg/nanobsd.wleiden
    alias slownano  sh /usr/src/tools/tools/nanobsd/nanobsd.sh -c /root/nanobsd/cfg/nanobsd.wleiden
    alias slownewkernelnano sh /usr/src/tools/tools/nanobsd/nanobsd.sh -w -c /root/nanobsd/cfg/nanobsd.wleiden
    alias slownewworldnano sh /usr/src/tools/tools/nanobsd/nanobsd.sh -k -c /root/nanobsd/cfg/nanobsd.wleiden
    alias prepare-nfs  /root/nanobsd/tools/prepare-nfs.sh -f -n
    
Note: See TracWiki for help on using the wiki.