Skip to content
This repository
branch: master

Merge pull request #34 from jrmakosky/master

Updates to work with OpenBSD 5.4
latest commit 209e1b5093
Jakob Schlyter jschlyter authored
Octocat-spinner-32 contrib remove id tags as they do not make sense in git August 09, 2011
Octocat-spinner-32 disktabs add support for 64mb disks May 28, 2012
Octocat-spinner-32 initial-conf Merge pull request #26 from KillerDiller/pull-20130914a October 06, 2013
Octocat-spinner-32 misc import from mindrot August 09, 2011
Octocat-spinner-32 tools Initial support for OpenBSD 5.0, not tested November 01, 2011
Octocat-spinner-32 .gitignore Added gitignore for obj, sandbox and diststuff August 20, 2013
Octocat-spinner-32 COMMELL-LE564 add support for 64mb disks May 28, 2012
Octocat-spinner-32 ChangeLog note maint state December 18, 2013
Octocat-spinner-32 GENERIC-RD Update GENERIC-RD to include some missing 5.3 drivers, most important… September 14, 2013
Octocat-spinner-32 LICENSE import from mindrot August 09, 2011
Octocat-spinner-32 Makefile Add 'screen' termcap entry; also required for tmux. September 14, 2013
Octocat-spinner-32 NTFS add support for 64mb disks May 28, 2012
Octocat-spinner-32 PCENGINES add support for 64mb disks May 28, 2012
Octocat-spinner-32 README.md Documentation for osrelease subdirectories in /flash and /flash/pkg. September 14, 2013
Octocat-spinner-32 SOEKRIS4501 Fixed #13 Kernel for Soekris net4501 hangs during boot August 27, 2013
Octocat-spinner-32 SOEKRIS4521 Changed UFCACHEPERCENT from 1 to 5 to avoid kernel panic August 21, 2013
Octocat-spinner-32 SOEKRIS4801 resolve issue #19 July 20, 2013
Octocat-spinner-32 SOEKRIS5501 Removed unused network card August 20, 2013
Octocat-spinner-32 WRAP12 add support for 64mb disks May 28, 2012
Octocat-spinner-32 build-bindist.sh Building with custom or random DUID instead of static value. October 04, 2011
Octocat-spinner-32 build-diskimage.sh Added disk formats 1GB, 2GB and 4GB August 20, 2013
Octocat-spinner-32 build-kernel-injail.sh Initial support for OpenBSD 5.0, not tested November 01, 2011
Octocat-spinner-32 build-kernel.sh Changed to 48mb kernel August 21, 2013
Octocat-spinner-32 build-livecd-injail.sh Removed referenses to list.largekernel since it has been merged into … September 25, 2011
Octocat-spinner-32 build-livecd.sh Removed referenses to list.largekernel since it has been merged into … September 25, 2011
Octocat-spinner-32 build-release-injail.sh Style... November 04, 2013
Octocat-spinner-32 build-release.sh Changes necessary to build against OpenBSD 5.4. November 04, 2013
Octocat-spinner-32 build-usbimage.sh Initial support for OpenBSD 5.0, not tested November 01, 2011
Octocat-spinner-32 build-usbinstallimage.sh Added sha256 checksum to verify downloaded iso November 04, 2011
Octocat-spinner-32 build-usbkernel-injail.sh Initial support for OpenBSD 5.0, not tested November 01, 2011
Octocat-spinner-32 build-usbkernel.sh Building with custom or random DUID instead of static value. October 04, 2011
Octocat-spinner-32 go-to-jail.sh Removed debug/test var August 11, 2011
Octocat-spinner-32 list Add more standard executables to the ramdisk: dirname, tmux, iked, ik… September 14, 2013
Octocat-spinner-32 list.recovery first set of changes for OpenBSD 5.2 January 02, 2013
Octocat-spinner-32 mk-mini.conf Changes necessary to build against OpenBSD 5.4. November 04, 2013
Octocat-spinner-32 mtree.conf import from mindrot August 09, 2011
README.md

Please read this entire file before asking for help or reporting bugs

Foreword

Flashboot is a system built by Damien Miller and others as an adaptation of OpenBSD that's more suited for small flash-based hardware. For most applications you don't have to compile it on you own, you just put the binary release on a flashcard and you're set (somewhat simplified).

Flashboot is not OpenBSD and it's not a official port. We are using the word OpenBSD because we don't change any source code other then the scripts that are buildning the ram disk kernel and some basic defaults configurations. The kernel and the userland is untouched but stripped to the minimum to make Flashboots fotprint as smal as possible.

Don't turn to OpenBSD mailing list for support since this project is unofficial. Please submit bug reports via the GitHub Issue Tracker.

Introduction

This is a small infrastructure to build minimal OpenBSD installations suitable for booting of flash and USB devices. This is derived from the scripts and tools used to build the OpenBSD installation media.

The system builds a ram disk kernel (bsd.gz) with a reasonably complete set of daemons and utilities. This file should be installed into the root directory of the boot device. Note that this infrastructure only builds the kernel image, it is beyond its scope to install it onto the flash device, or to prepare the flash device for booting the kernel. If you are playing with this stuff, you should know how to do this anyway.

When the flashboot kernel boots, it will attempt to mount the flash device as /flash and extract any tarball files matching /flash/.tgz into the root directory. This mechanism is intended to include the system configuration that the host will use, though it may be used to deploy updated or new binaries too. The configuration parameters accepted include most of the standard OpenBSD /etc/ files, including /etc/hostname. and a useful subset of /etc/rc.conf. See the initial-conf/rc script for details. As well as extracting /flash/*.tgz, the init script will copy any files under the /flash/conf/ directory to the root too - I find this a little more convenient for small config files that frequently change (e.g. pf.conf).

In the absence of a tarball or directory-based config, the system is configured with a basic initial configuration. The first Ethernet interface is brought up as 192.168.0.1 and the console is available (login: "root" password: "password"). The intention is to make it easy to load a real config from a freshly imaged flash card.

The assumed platform is a Soekris NET4501 (www.soekris.com), but is very easily changed by selecting a different kernel config and adjusting or renaming the initial-conf/hostname.sis0 file.

Installation

To install flashboot onto your media, you will need to format it and make it bootable first. Read the fine boot(8) and installboot(8) man pages for instructions on how to prepare the media.

Once the media is setup as bootable, you can just copy the kernel image to /bsd on the mounted device. You should also create a /conf directory to store your custom configuration - files under here are copied into the ramdisk at system boot time. After startup the boot device is mounted as /flash in the root of the ramdisk, so you can make changes at runtime there.

To influence the boot loader, you can create a /etc/boot.conf file on the root of the bootable media (not /conf/etc/boot.conf). You can use the standard boot.conf(5) options, such as changing console device and speed here.

Building

(if the following sounds too hard, please use the binary distribution of flashboot, available from the website)

A built release of OpenBSD is required for this infrastructure to work. To save space, you will probably want to turn off compile-time options such as Kerberos support. The current version of flashboot requires that you have built the entire system as dynamically linked, i.e. set STATIC= in mk.conf. Previous flashboot versions used crunchgen, but fully-dynamic saves 1.5Mb.

Here are the basic steps you need to take.

  1. Read and understand "man release"
  2. Build a release (using build-release.sh)
  3. Build a kernel (using build-kernel.sh)
  4. Install obj/bsd.gz to the root of the boot device as bsd
  5. Ensure that installboot has been run on the boot media

First, make sure all building scripts has the execute bit set for you and all other (chmod ugo+x build-*).

Next, edit release.sh and change SHORTREL and LONGREL to match the version you want to build. You should also change URLBASE to match a mirror near you.

build-release will download, patch and build userland automatically

This build can take a very long time. Make sure you run this in the flashboot-directory and with sudo since the script needs to be able to mount devices.

# sudo ./build-release.sh

When the building is done you should have a fully dynamic release in sandbox. Now it's time to make your kernel. The build-kernel.sh takes a kernel-config as a parameter. Currently COMMELL-LE564, GENERIC-RD, NTFS, SOEKRIS4501, SOEKRIS4521, SOEKRIS4801, SOEKRIS5501 and WRAP12 configs are provided. You can easily make your own by copying one of the existing.

# sudo ./build-kernel.sh WRAP12

The kernel is then stored under the obj/ directory. The use of a gzipped kernel is preferred. The bootloader automatically extracts it during boot. It saves space on the flash and transfer time during upgrade.

Customisation

The system supports customisation in three different ways.

  1. Any *.tgz file that you add to the root of the flash-card (/flash) or the release-dependent subdirectory (e.g. /flash/5.3 for a 5.3 kernel) is automatically extracted to the ramdisk during boot. This is useful for small extensions or configuration that you can distribute in a single tgz-package. Files can also be added to the /flash/conf directory, they are then automatically copied (not extracted) to the respective location in the ramdisk during boot, e.g. /flash/conf/etc/myname will end up as /etc/myname when the system has booted.

  2. There is also an option in rc.conf to create a second ramdisk in /usr/local. By default this is not done at all to save memory on the device. If activated this will also extract any *.tgz files located in /flash/pkg and the release-dependent subdirectory (e.g. /flash/pkg/5.3 for a 5.3 kernel) to /usr/local. This provides an excellent way to add packages directly from the OpenBSD ftp-server without needing to expand the original ramdisk. The rc-script will even remove some unnecessary files from the packages such as man-pages and files needed only for compiling.

  3. Recompile a kernel that suits your needs and that includes or excludes the binaries and libs that you need for your application. Change the list to include extra files. If you have decided to go down this road you might just as well modify the default configuration located under the initial-conf directory.

The easiest way to add configuration is to add files and folders to initial-conf and add list.custom in Flashboot root folder where instructions to the build script for each file is provided. Look at the included list file to get correct syntax.

The first two alternatives can be done without having to recompile the distribution and should be sufficient for most needs.

Kernel sizes are a problem when piggybacking a ramdisk blob. Kernel+ram disks larger than 16MB needs to increase the NKPTP in the kernel config. This is already done for all the kernels and you shouldn't have to do anything as long as you stay under 32MB. The second problem is that kernels larger than about 14MB will use up all the ISA DMA memory, for this reason ISA DMA is disabled. This leads to the final problem: if isadma is disabled, then things that attempt to use it (e.g. floppy disk access) will panic the kernel. In the end the best solution is to try to keep your kernels small.

This infrastructure does a couple of things to save space, but is not at all ferocious as I stopped tweaking once I reached my target (bsd.gz < 5Mb). To save space, only a couple of term{cap,info} entries are transferred (see TERMTYPES in the Makefile).

Creating Bootable CD

To create an iso image suitable for booting and running flashboot on a x86 PC, first read the build instructions above. Step 1 and 2 must be successful and in step 3 use the build-livecd.sh script with the GENERIC-RD kernel config.

# sudo ./build-livecd.sh GENERIC-RD

The build-live_cd.sh script will create the directory live_cd before creating the image. Everything in this directory will be included on the cd. The files cdbr, cdboot etc/boot.conf is required for booting. To customize the cd with additional data, create the directory live_cd under the sandbox directory in advance and populate with data and modify rc.{init|more} as needed.

The build-livecd.sh will use the default flashboot config files and make modifications prior to ramdisk creation. Any customisation to ramdisk setup should be done by editing build-livecd.sh.

If everything worked then you should find a new iso image in obj/live_cd{version}.iso. Without any customisation the iso is roughly 21MB in size. Finally... burn the iso with your favourite cd burning program.

Support and bug reporting

Please submit bug reports via the GitHub Issue Tracker.

Something went wrong with that request. Please try again.