NanoBSD is an awesome set of scripts contained in the FreeBSD source tree that enables you to easily prepare and install a custom FreeBSD system for an embedded device. It is also highly optimized for Compact Flash media, providing a Read-Only file system and memory disks for the heavily written mount points, namely /etc and /var, to protect against wear-leveling.
I have provided a number of config files for a NanoBSD system that provides various services to get you started on an overlay of custom files that are geared towards making an AP (access point) out of an ALIX2C2 board from http://pcengines.ch (purchased at NetGate [US]), although these files require minor tweaks if you are using another ALIX board or even completely different hardware (mainly just network device names!).
NanoBSD is a great project that offers the full FreeBSD operating system for embedded devices instead of the ultra trimmed down TinyBSD.
This is not a let-down on TinyBSD. It has it's uses and can even get down to the 8MB range for total disk space. It has it's uses, but can be hard to work with after the image has been flashed onto the device.
This tutorial assumes you have a working FreeBSD system and the ability to console into your embedded board with the RS232 serial interface (or what ever your board uses for that matter!).
The following setup allows for your NanoBSD box to act as a few useful things:
- Wireless Access Point
- Gateway/Firewall
- Name Server
- Switch (if more then RJ45)
- DHCP server
FreeBSD Source Tree
Since NanoBSD is contain in the FreeBSD source tree, you will need to make sure you have the source tree on your system. The easiest way is to check if there are files in /usr/src.
If you do have a bunch of files in that directory, you are golden. If you need to get a source tree, or even want to update your existing tree, use csup with a simple config. It comes on FreeBSD by default. man csup for more information.
- # vi /etc/csup.conf
- *default host=cvsup2.freebsd.org
- *default base=/var/db
- *default prefix=/usr
- # 8.0-STABLE
- *default release=cvs tag=RELENG_8
- *default delete use-rel-suffix
- *default compress
- src-all
- # csup -g -L2 /etc/csup.conf
NanoBSD Configuration Layout
The NanoBSD configuration system is pretty straight forward. I will briefly go over a few of the default files and directories.
- # cd /usr/src/tools/tools/nanobsd
- # ls
- Files
- FlashDevice.sub
- nanobsd.sh
- --- snip --- snip ---
Everything inside this directory will be dumped over / (the root directory) on the new file system after you copy the NanoBSD image to the media. This is great if you want to prepopulate the /etc or /usr/local/etc directories with prewritten config files or make an extensive overlay. You ideally want to do it now, rather then do it on the actual device.
FlashDevice.sub
This file contains a list of popular flash card media and their respective geometries.
Hopefully, you will have one of the cards listed in this file, but if not there are alternative methods that will inform you of your geometry. Though you can get pretty good information with diskinfo -v /dev/da0, this information is MISLEADING if you are using a USB flash card reader. The umass driver will use a fictitious geometry for the heads and sectors. We will deal with this.
Take a peek and you will get the idea.
- $ less FlashDevice.sub
- --- snip --- snip ---
You would specify your brand and size in your config file by appending FlashDevice sandisk 1g to your config file.
If you have an ALIX/WRAP board and know how to console in, plug the flash card into the ALIX or WRAP board and notice the info immediately after POST. I would assume you could do this with any device if it spits out similar info.
- PC Engines ALIX.3 v0.99
- 640 KB Base Memory
- 261120 KB Extended Memory
- 01F0 Master 848A SanDisk SDCFB-1024
- Phys C/H/S 1986/16/63 Log C/H/S 993/32/63
HEADS: 16
SECTORS: 63
MEDIASIZE: 16 * 63 * 1986 = 2001888
Also, a sure way to get around the geometry issue is to get a IDE flash card reader. This allows the flash card to be viewed as a regular IDE harddrive. The one draw back to the IDE flash card reader is that it is not hot-swappable. You must have the flash card in the IDE reader (amazon link) when you boot the computer up.
The use of an IDE flash card reader will cause the drive's device name to be /dev/adXX instead of /dev/daXX.
You can also try looking up the manufacturers data sheet on the device and hopefully it will tell you.
nanobsd.sh
This is the main script that compiles NanoBSD and holds the default configuration options for when the NanoBSD image is compiled and created. These options can be overridden with a custom NanoBSD configuration file, allowing you to hack away at unneeded functionality or customize the build functions to your liking.
Check this file out in your editor to get a feel for what you can hack at to better suit the image for your particular requirements.
- # cd /usr/src/tools/tools/nanobsd
- # sh nanobsd.sh -h
- Usage: ./nanobsd.sh [-bikqvw] [-c config_file]
- -b suppress builds (both kernel and world)
- -i suppress disk image build
- -k suppress buildkernel
- -n add -DNO_CLEAN to buildworld, buildkernel, etc
- -q make output more quite
- -v make output more verbose
- -w suppress buildworld
- -c specify config file
Prepare a Kernel
I have trimmed down a GENERIC kernel (/usr/src/sys/i386/conf/GENERIC) to include only the basics. I do, though, include some SCSI stuff because it is a dependency for the USB modules. If you do not plan to use USB, you may comment out those as well.
If you do not have an ALIX board, just comment out the options GEODE line. That is the only thing that really make it "for" an ALIX board.
Note that if you plan on trimming down your own GENERIC kernel, you will often run into compile time errors when you are running your NanoBSD script. Just read the log that it stops on and try to debug as necessary. You might have to add some of what you cut back to the kernel to track down an option or device that is preventing a successfull build. It will be real fun, I promise!
Just to note, you can get some ideas from the kernels in ~/nbsd/src/tools/tools/tinybsd/conf directory (TINYBSD). They might offer some optimizations and ideas for a specific system you had in mind.
If I left something commented out, I figured you might need it. Look at /usr/src/sys/i386/conf/GENERIC for descriptions of these devices and options. If you do not have an ALIX board, you will probably want almost the same config but you will probably need a different ethernet or wireless driver.
- # cd /usr/src/sys/i386/conf
- # vi ALIX_USB
- cpu I586_CPU
- ident ALIX_USB
- options CPU_GEODE
- options SCHED_4BSD
- options INET
- #options INET6
- options FFS
- options SOFTUPDATES
- options UFS_DIRHASH
- options MD_ROOT
- #options NFSCLIENT
- #options NFSSERVER
- #options NFSLOCKD
- #options NFS_ROOT
- options MSDOSFS
- options CD9660
- options PROCFS
- options PSEUDOFS
- options GEOM_PART_GPT
- options GEOM_LABEL
- options COMPAT_43TTY
- options COMPAT_FREEBSD4
- options COMPAT_FREEBSD5
- options COMPAT_FREEBSD6
- options COMPAT_FREEBSD7
- options SYSVSHM
- options SYSVMSG
- options SYSVSEM
- options P1003_1B_SEMAPHORES
- options _KPOSIX_PRIORITY_SCHEDULING
- options PRINTF_BUFR_SIZE=128
- options KBD_INSTALL_CDEV
- options HWPMC_HOOKS
- options INCLUDE_CONFIG_FILE
- device pci
- device ata
- device atadisk
- # SCSI
- device scbus
- device da
- device sa
- device cd
- device pass
- device ses
- # Serial
- device uart
- # PCI Ethernet
- device miibus
- device sis # SOEKRIS boards (sub GEODE for ELAN)
- device vr # ALIX boards
- # Wireless
- device wlan
- options IEEE80211_SUPPORT_MESH
- device wlan_wep
- device wlan_ccmp
- device wlan_tkip
- device wlan_amrr
- device ath
- device ath_hal
- options AH_SUPPORT_AR5416
- device ath_rate_sample
- # Pseudo Devices
- device loop
- device random
- device ether
- device vlan
- device tun
- device pty
- device mdv
- device gif
- device faith
- device firmware
- device bpf
- # USB
- device uhci
- device ohci
- device ehci
- device usb
- device umass
- # Custom
- device pf
- device pflog
- #device pfsync
- #device carp
- #options ALTQ
- #options ALTQ_CBQ
- #options ALTQ_RED
- #options ALTQ_RIO
- #options ALTQ_HFSC
- #options ALTQ_CDNR
- #options ALTQ_PRIQ
- #options ALTQ_NOPCC
- device if_bridge
- options DEVICE_POLLING
Creating a Custom NanoBSD Configuration File
To customize your NanoBSD installation, override default options outlined in the /usr/src/tools/tools/nanobsd.sh script by creating a config file that consists of variables that you would like to change.
The following is my a typical config for my home routers and will get you started in the right direction. This install leaves a small foot print and gives me a great foundation to work from. If you would like to look at more options, take a peak at /usr/src/tools/tools/nanobsd.sh again and take note of what you want to override.
- # cd /usr/src/tools/tools/nanobsd/
- # vi accesspoint.nanobsd.conf
- # directory under obj to put these files in
- NANO_NAME=ACCESSPOINT_1024mb
- # how many parallel makes during compilation
- # rule of thumb: number of cores x2
- NANO_PMAKE="make -j 4"
- # kernel in /usr/src/sys/i386/conf to use
- NANO_KERNEL=ALIX_USB
- # specify arch if you are on amd64
- NANO_ARCH="i386"
- # how many images to install on disk
- NANO_IMAGES=1
- # Controls the options passed to boot0cfg
- # !! important for ALIX boards !!
- NANO_BOOT0CFG="-o nopacket -s 1 -m 3"
- # /cfg size
- NANO_CONFSIZE=40960
- # /etc size
- NANO_RAM_ETCSIZE=20480
- # /tmp size
- NANO_RAM_TMPVARSIZE=327680
- # make.conf knobs for both buildworld & installworld
- CONF_WORLD='
- #WITHOUT_BIND=YES
- WITHOUT_MODULES=YES
- WITHOUT_KERBEROS=YES
- WITHOUT_GAMES=YES
- WITHOUT_RESCUE=YES
- WITHOUT_LOCALES=YES
- WITHOUT_SYSCONS=YES
- WITHOUT_INFO=YES
- '
- # make.conf knobs for buildworld only
- CONF_BUILD='
- WITHOUT_KLDLOAD=YES
- WITHOUT_PAM=YES
- '
- # make.conf knobs for installworld only
- CONF_INSTALL='
- WITHOUT_ACPI=YES
- WITHOUT_BLUETOOTH=YES
- WITHOUT_CVS=YES
- WITHOUT_FORTRAN=YES
- WITHOUT_HTML=YES
- WITHOUT_LPR=YES
- WITHOUT_MAN=YES
- WITHOUT_SENDMAIL=YES
- WITHOUT_SHAREDOCS=YES
- WITHOUT_EXAMPLES=YES
- WITHOUT_CALENDAR=YES
- WITHOUT_MISC=YES
- WITHOUT_SHARE=YES
- '
- # media definition from FlashDevice.sub
- #FlashDevice sandisk 512mb
- FlashDevice sandisk 1g
- #install files from Files
- customize_cmd cust_install_files
- # allow root to login via SSH
- customize_cmd cust_allow_ssh_root
Prepare an Overlay of Config Files
Instead of creating a vanilla NanoBSD image, copying it to the disk device, and then going through the hassle of configuring each config file on each live disk, we can create a filesystem hierarchy under /usr/src/tools/tools/nanobsd/Files that gets overlayed on the root filesystem on the NanoBSD image. Consequently, when the NanoBSD image file is created, we are all configured and ready to go!
Note that these files become "defaults" for the read-only filesystem of NanoBSD. For example, if you populate /usr/src/tools/tools/nanobsd/Files/etc or /usr/src/tools/tools/nanobsd/Files/usr/local/etc with custom config files, they will be a permanent part of the read-only filesystem. If you wish to later override these files, you will have a NanoBSD specific directory to place newer custom files (/cfg and /cfg/local which we will get into later) so that when the NanoBSD system is later boot, the newer custom files will be "overlayed" over the default files. Basically, the newer custom files take priority.
If you are confused, hang in there! I am discussing some things we have not gotten to. The above paragraph will make more sense in a few minutes.
/boot/loader.conf
- # mkdir /usr/src/tools/tools/nanobsd/Files/boot
- # vi /usr/src/tools/tools/nanobsd/Files/boot/loader.conf
- comconsole_speed="9600"
- console="comconsole"
- autoboot_delay="1"
/etc/csh.cshrc
These are aliases I use for fancy ls listing and a few variables to make me feel at home.
- # vi /usr/src/tools/tools/nanobsd/Files/etc/csh.cshrc
- alias l ls -GaF
- alias ls ls -GF
- alias ll ls -GaFl
- alias vim vi
- setenv EDITOR vi
- if ($?prompt) then
- set prompt = "`/bin/hostname -s`# "
- set filec
- set history = 100
- set savehist = 100
- endif
/root/sync_cfg
Script I wrote that mirrors /etc and /usr/local/etc to /cfg and /cfg/local, respectively.
- # vi ~/sync_cfg
- #!/bin/sh
- # files that you want copied from /etc
- ETC="rc.conf pf.conf resolv.conf hosts.conf"
- # see if there is anything in the /cfg directory
- N=`mount | grep /cfg | wc -l | awk '{print $1}'`
- # mount /cfg if it isn't already
- if [ $N -eq 0 ]; then
- echo "### Mounting /cfg"
- mount /cfg
- else
- echo "### /cfg already mounted"
- fi
- # used for /usr/local/etc/*
- mkdir -p /cfg/local
- echo "### Copying /usr/local/etc/* to /cfg/local..."
- cp -a /usr/local/etc/* /cfg/local
- echo "### Copying /etc files to /cfg..."
- for F in $ETC; do
- FILE=/etc/$F
- if [ -e $FILE ]; then
- cp -af $FILE /cfg
- fi
- done
- # unmount if this program mounted /cfg
- if [ $N -eq 0 ]; then
- echo "### Unmounting /cfg"
- sleep 3
- umount /cfg
- fi
- echo "### Done!"
/etc/exports
You really only need this if you plan to use a remote ports tree.
The IP is the box with the NFS share of the ports tree
- $ vi /usr/src/tools/tools/nanobsd/Files/etc/exports
- /usr/ports -maproot=root 10.10.11.1
/etc/hostapd.conf
This file is used to configure authentication mechanisms for IEEE 802.11 (wireless) networks. In the follow case, I did a simple WPA setup..
From the man page: "The hostapd utility is an authenticator for IEEE 802.11 networks. It provides full support for WPA/IEEE 802.11i and can also act as an IEEE 802.1X Authenticator with a suitable backend Authentication Server (typically FreeRADIUS)."
Look at man hostapd and in /usr/share/examples/hostapd/hostapd.conf for further information.
MAKE SURE you do not have any extra spaces after any line in the config file. It will make hostapd fail to start and drive you crazy! ;)
- # vi /usr/src/tools/tools/nanobsd/Files/etc/hostapd.conf
- # CHANGE WIRELESS INTERFACE (alias)
- interface=wlan0
- driver=bsd
- ctrl_interface=/var/run/hostapd
- ctrl_interface_group=wheel
- dump_file=/tmp/hostapd.dump
- auth_algs=1
- # disable logging
- logger_syslog=-1
- logger_syslog_level=0
- logger_stdout=-1
- logger_stdout_level=0
- debug=2
- # CHANGE TO YOUR SSID
- ssid=CHANGE_SSID_HERE
- wpa=2
- # CHANGE TO WPA PASSWORD
- wpa_passphrase=CHANGE_PASSWORD_HERE
- wpa_key_mgmt=WPA-PSK
- wpa_pairwise=CCMP TKIP
/etc/motd
You can make some cool ASCII art or something, but I usually just clobber it so I don't have to see the MOTD every time I log in.
- # touch /usr/src/tools/tools/nanobsd/Files/etc/motd
/etc/pf.conf
This is super basic config to get you going, bt feel free to prepopluate yours with a more extensive rule set. :)
OpenBSD hosts a great resource if you want to look more into the power of pf (packet filter firewall)
- # vi /usr/src/tools/tools/nanobsd/Files/etc/pf.conf
- wan_if="vr0" # CHANGE WIRED INTERFACE
- wifi_if="wlan0" # CHANGE WIRELESS INTERFACE
- #lan_if="vr1" # UNCOMMENT AND CHANGE IF LAN INTERFACE
- ##### options
- ########################################
- set skip on lo
- ##### scrub
- ########################################
- scrub in all
- ##### nat
- ########################################
- nat on $wan_if from !($wan_if) to any -> ($wan_if:0)
- ##### translation
- ########################################
- # bit torrent example (also ALLOW these ports in filtering)
- #rdr on $wan_if proto {tcp,udp} from any to any port 6881:6999 -> 10.10.11.230
- ########################################
- ##### filtering
- ########################################
- antispoof quick for { lo $wan_if }
- ### WAN interface (block all incoming, later allow specific access)
- block in on $wan_if
- pass out on $wan_if
- ### WIFI interface
- pass in on $wifi_if
- pass out on $wifi_if
- ### LAN interface
- #pass in on $lan_if
- #pass out on $lan_if
- # example to allow access to SSHd and a Web Server on #WAN_IF
- pass in on $wan_if proto tcp from any to any port 22
- pass in on $wan_if proto tcp from any to any port 80
/etc/rc.conf
It can come in handy knowing the IP address of the box when it boots up. Since SSHd is enabled here, we should be able to plug into the LAN port, put your IP in the same range, and SSH in the embedded board... bypassing the hassles of a serial connection!
- $ vi /usr/src/tools/tools/nanobsd/Files/etc/rc.conf
- ### NETWORK
- ########################################
- gateway_enable="YES"
- ifconfig_vr0="DHCP"
- #ifconfig_vr1="inet 10.10.11.1 netmask 255.255.255.0"
- wlans_ath0="wlan0"
- create_args_wlan0="wlanmode hostap mode 11b channel 7"
- ifconfig_wlan0="inet 10.10.12.1 netmask 255.255.255.0"
- ### APPS
- ########################################
- dhcpd_enable="YES"
- dhcpd_ifaces="wlan0"
- #dhcpd_ifaces="wlan0 vr1"
- dhcpd_withuser="_dhcp"
- dhcpd_withgroup="_dhcp"
- ### SYSTEM
- ########################################
- hostapd_enable="YES"
- named_enable="YES"
- named_chrootdir="/var/named"ooo;
- nfs_client_enable="YES"
- nfs_client_flags="-n 4"
- ntpd_enable="YES"
- pf_enable="YES"
- pflog_enable="YES"
- sendmail_enable="NO"
- sendmail_submit_enable="NO"
- sendmail_outbound_enable="NO"
- sendmail_msp_queue_enable="NO"
- sshd_enable="YES"
- # NFS server (incase we need it)
- #rpcbind_enable="YES"
- #nfs_server_enable="YES"
- #mountd_enable="YES"
- #mountd_flags="-r"
/etc/exports
- # vi /usr/src/tools/tools/nanobsd/Files/etc/exports
- /usr/ports -maproot=root 10.10.11.229
/etc/ttys
Change the baud rate if you must. Be sure to reflect the change in /usr/src/tools/tools/nanobsd/Files/boot/loader.conf.
If you are on a FreeBSD release before 8.x, use ttyd0 as the device name!
- # vi /usr/src/tools/tools/nanobsd/Files/etc/ttys
- ttyu0 "/usr/libexec/getty std.9600" vt220 on secure
/usr/local/etc/dhcpd.conf
The follow config is a typical DHCP config. To expand this config to more then 1 network interface, uncomment where it specifies multiple interfaces and uncomment the extra subnet block.
Read the DHCP man page or search Google for some more example configs.
- # cd /usr/src/tools/tools/nanobsd/Files
- # mkdir -p usr/local/etc
- # vi usr/local/etc/dhcpd.conf
- authoritative;
- ###
- ### Global Settings
- ###
- ddns-update-style none;
- default-lease-time 600;
- max-lease-time 7200;
- #option domain-name "digitalfoo.local";
- ###
- ### Wireless Interface (wlan0)
- ###
- subnet 10.10.12.0 netmask 255.255.255.0 {
- range 10.10.12.100 10.10.12.254;
- option broadcast-address 10.10.12.255;
- option routers 10.10.12.1;
- option domain-name-servers 10.10.12.1;
- }
- ###
- ### Wired Interface 1 (vr1... if available)
- ###
- subnet 10.10.11.0 netmask 255.255.255.0 {
- range 10.10.11.100 10.10.11.254;
- option broadcast-address 10.10.11.255;
- option routers 10.10.11.1;
- option domain-name-servers 10.10.11.1;
- }
- ###
- ### Static Hosts
- ###
- # example of host that needs a static address
- host main_desktop {
- hardware ethernet 00:19:db:69:e5:ee;
- fixed-address 10.10.11.100;
- }
/var/named/etc/namedb/*
- # cd /usr/src/tools/tools/nanobsd/Files
- # mkdir -p var/named/etc/namedb
- # cd var/named/etc/namedb
- # rndc-confgen -a -c rndc.key
- # cp /etc/namedb/named.conf ./
- # vi named.conf
- ### addresses for DNS server to listen on
- acl "interfaces" {
- 127.0.0.1;
- 10.10.11.1;
- #10.10.12.1;
- };
- ... ... snip ... ... snip ... ...
- options {
- ... ... snip ... ... snip ... ...
- directory "/etc/namedb";
- ... ... snip ... ... snip ... ...
- listen-on { interfaces; };
- ... ... snip ... ... snip ... ...
- };
- ... ... snip ... ... snip ... ...
- include "rndc.key";
Compile NanoBSD
Now that we have the config files written, we can run the nanobsd.sh script. If you created a config file, do not forget to tell the script to use it!
- # cd /usr/src/tools/tools/nanobsd
- # sh nanobsd.sh -v -c accesspoint.nanobsd.conf
- # NanoBSD image ACCESSPOINT_1024MB build starting
- ## Clean and create object directory (/usr/obj/nanobsd.ACCESSPOINT_1024MB/)
- ## Construct build make.conf (/usr/obj/nanobsd.ACCESSPOINT_1024MB//make.conf)
- ## run buildworld
- ### log: /usr/objbw
- ## build kernel (ALIX_USB_v3)
- ### log: /usr/objbk
- ## Clean and create world directory (/usr/objw)
- ## Construct install make.conf (/usr/obj/nanobsd.ACCESSPOINT_1024MB//make.conf)
- ## installworld
- ### log: /usr/objiw
- ## install /etc
- ### log: /usr/objetc
- ## configure nanobsd /etc
- ## install kernel
- ### log: /usr/objik
- ## run customize scripts
- ## customize "cust_install_files"
- ### log: /usr/objcust.cust_install_files
- #### cust_install_files is a shell function
- ## customize "cust_allow_ssh_root"
- ### log: /usr/objcust.cust_allow_ssh_root
- #### cust_allow_ssh_root is a shell function
- ## configure nanobsd setup
- ### log: /usr/objdl
- ## run late customize scripts
- ## build diskimage
- ### log: /usr/objdi
- # Created NanoBSD disk image: /usr/objdisk.full
- # NanoBSD image ACCESSPOINT_1024MB completed
Now go have a few beers and relax because this could take a while. The script will cycle through it's build phases and start populating /usr/obj/nanobsd.<$NANO_NAME> with log files of what it has done and various images it has created. When it is all finished, you should get a directory listing similar to the following:
| # ls /usr/obj/nanobsd.{$NANO_NAME} | ||
| _.bk | _.dl | _.iw |
| _.bw | _.du | _.mnt |
| _.cust_cust_install_files | _.env | _.mtree |
| _.di | _.etc | _.w |
| _.disk.full | _.fdisk | make.conf |
| _.disk.image | _.ik | usr |
The log files in here are priceless when you have an image that won't compile. For example, the log for the install world phase is in _.iw. The file we need to write to our media is _.disk.full. This is the actual disk image plus the extra padding nessesary to fulfill the specified size of the filesystem.
Do not write _.disk.image by accident. This is only the naked compiled system, without the needed padding.
Copy NanoBSD Image to Flash
All the files are compiled, now we have to put our system on media.
If you used a USB flash card reader, /dev/daX will be your device name. If you used an IDE interface for your card reader, /dev/adX will be your device name.Just change X to the device number.
- # cd /usr/obj/nanobsd.{$NANO_NAME}
- # dd if=_.disk.full of=/dev/da0 bs=64k
Conclusion
We should have a well rounded system at our hands! Now plug your flash card into your embedded board and (attempt to) boot it up.
NOW CHANGE THE ROOT PASSWORD
- # sh ~/change_password
- Changing local password for root
- New Password: <password_here>
- Retype New Password: <password_here>
How to Use /cfg for Persistent Config Files
One thing that is awesome about NanoBSD is the fact that it is mostly a read-only system, with the read/write heavy hitters (/var and /tmp) remaining as memory disks.
This is great until you need to make changes or additions to /etc/* or /usr/local/etc/* that will still be there when you reboot (persistent). To accomplish this, you will have to use the /cfg mount point to store a structured overlay for /etc and /usr/local/etc. For example, a persistent change would be made simply by mounting /cfg , writing the changes to the respective directory (read on) under /cfg, and unmount it when you are done.
| Directory | Equivilent |
|---|---|
| /etc | /cfg |
| /usr/local | /cfg/local |
Make sure you mount the /cfg file system BEFORE copying stuff there. ;)
The /etc Directory
Think of /cfg == /etc on a regular FreeBSD system. Any file you place here will be overlayed/mirrored to /etc when the NanoBSD system is next booted. If you need the change now as well, copy the file to the normal location and don't forget to mirror the change in the respective directory in /cfg!
- # # mount -u -o rw /
- # vi /etc/resolv.conf
- nameserver 4.2.2.1
- # mount -u -o ro /
- # mount /cfg
- # cp /etc/resolv.conf /cfg
- # umount -f /cfg
The /usr/local/etc Directory
/usr/local/etc is actually symlinked to /etc/local.
Similarly, the /usr/local/etc/* files are supposed to be mirrored to /cfg/local. Remember this when you install a port or configure a service.
- # mount /cfg
- # cp -R /usr/local/etc/* /cfg/local/
- # umount -f /cfg
Installing Ports
I have moved this section to their individual posts. I strongly recommend you read the installing ports via chroot guide, but if you would like to remotely install ports take a moment to view the installing ports from a remote FreeBSD ports tree guide.
NanoBSD Notes
Clobber (erase filesystem) on Flash Card
Make sure you use the right device name here!
- # dd if=/dev/zero of=/dev/da0 bs=1k count=1
Mounting/Unmounting Filesystem
- # mount -u -o rw /
- # mount -u -o ro /
Save SSH Keys
Now the keys are generated every time the system boots.
- # sh save_sshkeys
Download NanoBSD File Set
The following archives contain the config files pertaining to this guide.
- Tags
- AI (1)
- ALIX (1)
- digitalfoo.net (2)
- embedded (6)
- FreeBSD (30)
- Java (1)
- Linux (26)
- misc (7)
- my projects (1)
- MySQL (2)
- NanoBSD (3)
- opensource (7)
- perl (1)
- PHP (3)
- programming (11)
- Python (1)
- security (4)
- Archives
- 2011
- February (1)
- March (1)
- June (1)
- July (1)
- August (1)
- 2010
- June (5)
- July (2)
- December (4)
- April (6)
- March (2)
- May (1)
- August (2)
- October (1)
- November (1)
- 2009
- August (7)
- July (8)
- April (4)
- May (4)
- December (2)
- June (1)
- September (1)
- November (4)
- October (1)
- Web Tools
- Index
- dig-shovel Live
- SQL Injection Encoder
- Links
-

