# NanoBSD



## balanga (Nov 24, 2017)

Not sure if NanoBSD can be discussed here since certain derivativates are deemed off-topic.... but I'll ask anyway...

I've seen NanoBSD mentioned quite regularly but have no real idea about what it is. Can I create a NanoBSD build and install it on a separate partition and boot it up using Grub, just so that I can
find out something about it? And can I boot it up via PXE?


----------



## scottro (Nov 24, 2017)

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/nanobsd/index.html

The handbook has an article about it that may help.


----------



## balanga (Nov 24, 2017)

Thanks. I'm assuming that 'mass storage medium' can be a normal hard disk...


----------



## Phishfry (Nov 24, 2017)

I have built NanoBSD for microSD, SD Card, USB stick and Hard Drive.

You need to specify in your own custom.cfg what medium you are using. NANO_DRIVE= is the directive.

Here is a sample of what I use for my FreeBSD WAP on a Checkpoint U5
/usr/src/tools/tools/nanobsd/checkpoint/checkpoint.cfg

```
NANO_ARCH=i386
NANO_KERNEL=GENERIC
NANO_DRIVE=ada0
NANO_NAME=checkpoint
NANO_BOOTLOADER="/boot/boot0"
NANO_BOOT_MBR="/boot/boot0"
NANO_BOOT0CFG="-o packet -s 2 ${NANO_DRIVE}"
customize_cmd cust_pkgng
NANO_PACKAGE_LIST="pkg dnsmasq"

. common        # Pull in common definitions, keep last
```
I use a modified 'common' file in the same directory.


----------



## Phishfry (Nov 25, 2017)

I should mention that the handbook is dated on this topic. Your best approach is to investigate the /tools/tools/nanobsd/embedded/ directory.
This is work that uses the top level scripts but has a heirachy of its own.
On top of that it adds support for NanoBSD on supported Arm boards as you can see from the cfg files it that directory.

After reading the NanoBSD handbook article, checkout this file for embedded usage:
/usr/src/tools/tools/nanobsd/embedded/README
All the work is nicely documented so you must read the comments too.
Especially nanobsd.sh, default.sh and common

There is also a tweak needed for cust_pkgng function. Here is the PR report and fix:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219405


----------



## jpierri (Jul 19, 2018)

The handbook is really dated regarding NanoBSD, specially the example on section 2.4.3 - *Using nc(1)* - that should be adjusted to reflect the new behavior of _nc_ regarding the disconnection after reaching EOF, both on server and client side.

That example, updated to FreeBSD 11, should be:

```
myhost# nc -l -N 2222 < _.disk.image

# nc -d myhost 2222 | sh update
```

Note that we are calling _update_ instead of _updatep1_ or _updatep2_ because _update_ is capable of determining automatically which slice should be overwritten.


----------

