documentation:technical_docs:nanobsd
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Last revision | |||
— | documentation:technical_docs:nanobsd [2011/12/27 14:37] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== NanoBSD ====== | ||
+ | {{description> | ||
+ | ====== Externals links about NanoBSD ====== | ||
+ | Here are a list of docs and tutorials about NanoBSD: | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | ====== Understanding NanoBSD ====== | ||
+ | |||
+ | ===== What is NanoBSD ? ===== | ||
+ | |||
+ | It's a shell script (/ | ||
+ | |||
+ | ===== Images generated by NanoBSD ===== | ||
+ | |||
+ | After using NanoBSD, you will found a full disk image (_.disk.full) that contains 2 partitions (p1 and p2) (both copy of _.disk.image file). | ||
+ | The file _.disk.image is the light FreeBSD filesystem (in [[http:// | ||
+ | Using 2 partitions permit to use a simple and safe upgrading process: The new _.disk.image file is copied over the non-active partition, and the bootloader is modified for boot on the non-active partition at the next boot. There are the scripts updatep1 and updatep2 for this task. | ||
+ | |||
+ | ===== Using NanoBSD ===== | ||
+ | |||
+ | NanoBSD manage flash device and prevent fsck by mounting the filesystem read-only. | ||
+ | For saving configuration file, you need to copy /etc into /conf: There is the script save_cfg for this task. | ||
+ | |||
+ | ====== Studying NanoBSD ====== | ||
+ | |||
+ | ===== Command options ===== | ||
+ | |||
+ | Here are the command line options of NanoBSD: | ||
+ | < | ||
+ | Usage: $0 [-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, | ||
+ | -q make output more quite | ||
+ | -v make output more verbose | ||
+ | -w suppress buildworld | ||
+ | -c specify config file | ||
+ | -h Display usage information. | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Steps ===== | ||
+ | |||
+ | Here are the functions steps: | ||
+ | |||
+ | - clean_build | ||
+ | - make_conf_build | ||
+ | - build_world | ||
+ | - build_kernel | ||
+ | - clean_world | ||
+ | - make_conf_install | ||
+ | - install_world | ||
+ | - install_etc | ||
+ | - setup_nanobsd_etc | ||
+ | - install_kernel | ||
+ | - run_customize | ||
+ | - setup_nanobsd | ||
+ | - prune_usr | ||
+ | - run_late_customize | ||
+ | - create_${NANO_ARCH}_diskimage | ||
+ | - last_orders | ||
+ | ===== Variables Table ===== | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | ^ Name ^ Value (in BSDRP) | ||
+ | | CONF_BUILD | | Options to put in make.conf during buildworld only | | ||
+ | | CONF_WORLD | A big list of [[http:// | ||
+ | | CONF_INSTALL | A big list of [[http:// | ||
+ | | MAKEOBJDIRPREFIX | ||
+ | | NANO_ARCH | i386/amd | Target architecture| | ||
+ | | NANO_BOOT0CFG | -o packet -s 1 -m 3 | Boot0cfg configuration mode | | ||
+ | | NANO_CONFSIZE | 2048 | Size of configuration file system in 512 bytes sectors | | ||
+ | | NANO_CUSTOMIZE | | Customize commands | | ||
+ | | NANO_DATASIZE | 2048 | Size of data file system in 512 bytes sectors | | ||
+ | | NANO_DISKIMGDIR | / | ||
+ | | NANO_DRIVE | ad0 (TO ADD in BSDRP make!) | The drive name of the media at runtime | | ||
+ | | NANO_GLABEL_SYS | BSDRP | glabel name for system partition | | ||
+ | | NANO_GLABEL_CFG | cfg | glabel name for configuration partition | | ||
+ | | NANO_GLABEL_DATA | data | glabel name for data partition | | ||
+ | | NANO_IMAGES | 2 | Number of code images on media (1 or 2) | | ||
+ | | NANO_IMGNAME | BSDRP.img | The default name for any image we create | | ||
+ | | NANO_INIT_IMG2 | 0 | What to do with the second image partition: 0 (empty), 1 (copy twice the image) | | ||
+ | | NANO_KERNEL | BSDRP-I386 / BSDRP-AMD64 | Name of the kernel config file | | ||
+ | | NANO_LATE_CUSTOMIZE | | Late customize commands | | ||
+ | | NANO_MAKE_CONF_INSTALL | / | ||
+ | | NANO_MAKE_CONF_BUILD | / | ||
+ | | NANO_MD_BACKING | file | Backing type of md(4) device (file or swap) | | ||
+ | | NANO_MEDIASIZE | 1200000 | Target media size in 512 bytes sectors | | ||
+ | | NANO_NAME | BSDRP | Name of the obj dir | | ||
+ | | NANO_NEWFS | -b 4096 -f 512 -i 8192 -O1 -m 2 -U | Newfs paramters to use | | ||
+ | | NANO_OBJ | / | ||
+ | | NANO_PACKAGE_DIR | / | ||
+ | | NANO_PMAKE | make -j 3 | Parallel Make | | ||
+ | | NANO_RAM_ETCSIZE | 10204 | Size of the /etc ramdisk in 512 bytes sectors | | ||
+ | | NANO_RAM_TMPVARSIZE | 20480 | Size of the /tmp+/var ramdisk in 512 bytes sectors | | ||
+ | | NANO_SRC | /usr/src | Source tree directory | | ||
+ | | NANO_TOOLS | tools/ | ||
+ | | NANO_WORLDDIR | / | ||
+ | |||
+ | |||
+ | ===== Functions Table ===== | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | ^ Name ^ Description ^ | ||
+ | | build_kernel | ||
+ | | build_world | ||
+ | | clean_build | ||
+ | | clean_world | ||
+ | | cust_install_files | Copy all files under Files to nanobsd target | | ||
+ | | FlashDevice | ||
+ | | install_world | ||
+ | | install_etc | Install /etc (make distribution| | ||
+ | | install_kernel | Install kernel (make installkernel) | | ||
+ | | make_conf_build | Construct build make.conf using $CONF_WORLD and $CONF_BUILD | ||
+ | | make_conf_install | Construct install make.conf using $CONF_WORLD and $CONF_BUILD | ||
+ | | prune_usr | Remove all empty directories in target /usr | | ||
+ | | run_customize | run customize scripts (commands in $NANO_CUSTOMIZE) | | ||
+ | | run_late_customize | run late customize scripts (commands in $NANO_LATE_CUSTOMIZE and cust_ functions) | | ||
+ | | setup_nanobsd | configure nanobsd setup: Move / | ||
+ | | setup_nanobsd_etc | configure target nanobsd /etc: enable diskless, enable r/o of /, create fstab | | ||
+ | | UsbDevice | USB device geometries | | ||
+ | | create_${NANO_ARCH}_diskimage | Build disk image (partition, format, bootloader, etc.)| | ||
+ | | last_orders | Empty function to be customized by user (ex: copy diskimage to other place)| | ||
+ | |||
+ | ===== NanoBSD logs files ===== | ||
+ | |||
+ | ^ Name ^ Description ^ | ||
+ | | _.bk | Build Kernel log | | ||
+ | | _.bw | Build World log | | ||
+ | | _.di | Disk image creation log | | ||
+ | | _.dl | nanobsd setup creation log (/etc, /conf, etc..) | ||
+ | | _.du | nanobsd disk usage (du) output | ||
+ | | _.env | All environnement used during nanobsd runs | | ||
+ | | _.etc | Install etc log | | ||
+ | | _.fdisk | File used for fdisk the nanoBSD image | | ||
+ | | _.ik | Install kernel log files | | ||
+ | | _.iw | Install world log files | | ||
+ | | _.mtree | Light mtree file of the nanoBSD image | | ||
+ | |||
+ | |||
+ | |||
+ | ====== BSDRP patches for NanoBSD ====== | ||
+ | |||
+ | All this patchs were wrote for NanoBSD included in FreeBSD 8.1-Release. | ||
+ | |||
+ | ===== AMD64 support ===== | ||
+ | |||
+ | This very small patch permit to generate NanoBSD amd64 image. | ||
+ | |||
+ | This patch [[http:// | ||
+ | |||
+ | ===== Label support: No more hardcoded ad0/da0 for root filesystem ===== | ||
+ | |||
+ | The image of NanoBSD hardcode the device type use for mounting the root filesystem: | ||
+ | * ad0 for the first ATA device | ||
+ | * da0 for the first SCSI device (used for USB key) | ||
+ | This mean, that a " | ||
+ | |||
+ | The pfSense team meet the same problem, and Scott Ullrich give me this big advice: Use label in your fstab for avoiding this problem! | ||
+ | |||
+ | Then, here is the patch, and the new update script (merged updatep1 and updatep2 nanoBSD script): | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | This patch [[http:// | ||
+ | |||
+ | ===== Port compiling patches ===== | ||
+ | |||
+ | This patches is an improvement of the method used by [[http:// | ||
+ | |||
+ | It replaces the installation of package by compiling ports during NanoBSD image build: This permit to add ports during build process of NanoBSD images. | ||
+ | |||
+ | This patch support cross-compilation i386 ports from an amd64 release. | ||
+ | |||
+ | You can found this patches as the function add_port () in the [[http:// | ||
+ | |||
+ | ===== Improving mtree generation ===== | ||
+ | |||
+ | NanoBSD generate a mtree reference file, but for system security audit the default nanoBSD mtree file didn't contain enough parameters | ||
+ | |||
+ | This patch add sha256digest to mtree function of nanoBSD: | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ===== sparc64 support (work in progress) ===== | ||
+ | |||
+ | This patch is to be used with the nanobsd glabel patch: | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | Upgrading nanoBSD image is not supported: There is no FreeBSD bootloader available on sparc64 (the Sun OBP permit to select the partition from where to boot). | ||
+ | </ | ||
+ | |||
+ | Actual State: Commenting net/bird and net/ | ||
+ | |||
+ | ===== arm support (work in progress) ===== | ||
+ | |||
+ | <note warning> | ||
+ | |||
+ | But it should work from an arm FreeBSD (not tested, I didn't have arm computer)</ | ||
+ | |||
+ | This patch permit to generate NanoBSD arm image: It's came from the nanobsd/ | ||
+ | |||
+ | [[http:// |
documentation/technical_docs/nanobsd.txt · Last modified: 2021/01/18 16:03 by olivier