Build OPNsense images (Quickstart)
masterTo perform a standard build and generate a DVD image, use the following command:
# make dvdOnce successful, you can find the location of the generated images by running:
# make print-IMAGESDIR# make dvdrepository·master·Indexed 43 days ago
https://github.com/opnsense/toolsInfrastructure for creating OPNsense sets, packages, and system images (DVD, Memstick, VM). Orchestrates the compilation of FreeBSD base, kernel, ports, and OPNsense-specific plugins and core components. Supports cross-building for other architectures and provides modular build stages via make.
To perform a standard build and generate a DVD image, use the following command:
# make dvdOnce successful, you can find the location of the generated images by running:
# make print-IMAGESDIR# make dvdTo build OPNsense images, you need a FreeBSD 14.3-RELEASE (amd64) machine with at least 40GB of disk space and 8GB of RAM. All tasks require root privileges.
/usr)# pkg install git
# cd /usr
# git clone https://github.com/opnsense/tools
# cd tools
# make updateROOTDIR)If you want to install the tools in a directory other than /usr, use the ROOTDIR environment variable:
# mkdir -p /tmp/opnsense
# cd /tmp/opnsense
# git clone https://github.com/opnsense/tools
# cd tools
# env ROOTDIR=/tmp/opnsense make update# mkdir -p /tmp/opnsense
# cd /tmp/opnsense
# git clone https://github.com/opnsense/tools
# cd tools
# env ROOTDIR=/tmp/opnsense make updateCross-building is experimental and requires user-mode emulation packages and additional boot files. To cross-build for a specific device (e.g., BANANAPI or RPI2):
# make base kernel DEVICE=BANANAPI# make xtools DEVICE=BANANAPI# make packages DEVICE=BANANAPI# make arm-<size> DEVICE=BANANAPI# make base kernel DEVICE=BANANAPIInstead of passing many arguments to make, you can use configuration files located in your CONFIGDIR.
CONFIGDIR/build.conf: The primary configuration file required for the build.CONFIGDIR/build.conf.local: A local override file that is parsed first. Use this for flexible overrides in specific environments.VM images are not included in binary releases due to varying disk formats and sizes. The default is vmdk with 20G and 1G swap.
To customize the VM image, use the following syntax:
# make vm-<format>[,<size>[,<swap>[,<extras>]]Available formats:
qcow: Qemu, KVM (legacy)qcow2: Qemu, KVM (non-backwards-compatible)raw: Unformattedvhd: VirtualPC, Hyper-V, Xen (dynamic)vhdf: Azure, VirtualPC, Hyper-V (fixed)vmdk: VMWare, VirtualBox (dynamic)Arguments:
<size>: Disk size.<swap>: Swap size or off to disable.<extras>: An extras.conf hook name.# make vm-qcow2,30G,offTo avoid rebuilding everything, you can target specific packages:
# make ports-<packagename>[,...]
# make plugins-<packagename>[,...]
# make core-<packagename>[,...]Note: Reissuing ports builds will clear progress for plugins and core.
You can also override the list of packages using:
make ports PORTSLIST="security/openssl"make plugins PLUGINSLIST="devel/debug"# make ports-curl PORTSENV="DEPEND=no PRUNE=no"The OPNsense build is modular. You can build individual stages (base, kernel, ports, plugins, and core) separately. All steps are invoked via make.
To specify options on the command line, use the OPTION="value" syntax:
# make step OPTION="value"SETTINGS: The name of the requested local configuration.CONFIGDIR: Path to a directory containing configuration files to override SETTINGS (use absolute paths).ABI: Custom ABI (defaults to SETTINGS).ADDITIONS: List of packages/plugins to add to images.ARCH: Target architecture (if not native).COMSPEED: Serial speed (e.g., 115200, default).DEBUG: Build a debug kernel with extra object information.DEVICE: Device-specific modifications (e.g., A10, default).KERNEL: Kernel config to use (e.g., SMP, default).MIRRORS: List of mirrors to prefetch sets from.NAME: Image name (defaults to OPNsense).PRIVKEY / PUBKEY: Keys for signing sets.SUFFIX: Suffix for the top package name.TIMESTAMP: Fixed timestamp for reproducible pkgbase sets.TYPE: Base name of the top package to be installed.UEFI: Use amd64 hybrid images (e.g., vga vm).VERSION: Version tag.ZFS: Build VM images with ZFS (pool name zroot).# make step OPTION="value"Use these commands to ensure build integrity:
make test: Runs regression tests to check the integrity of core.git modifications and generates output for the style checker.make audit: Checks binary packages from ports against the upstream vulnerability database.The build process is divided into stages that can be run independently. Re-running a stage will continue from previous progress without cleaning.
| Target | Description |
|---|---|
make base | Build userland binaries, bootloader, and administrative files |
make kernel | Build the kernel and loadable kernel modules |
make ports | Build all third-party ports |
make plugins | Build additional plugins |
make core | Wrap up core as a package |
make dvd | Create a DVD live image |
make serial | Create a serial memstick live image |
make vga | Create a VGA memstick live image |
make nano | Create a flash card full disk image |
make vm | Create a virtual machine full disk image |
make release | Build release sets (unpredictable image set) |
make distribution | Build target with sanity checks, image clearing, and core alignment |
make print-SETSDIR: Print the directory where kernel, base, packages, and release sets are stored.make print-IMAGESDIR: Print the directory where final images are stored.You can update the OPNsense repositories using the make update command. You can update all repositories or specify individual ones.
Syntax:
# make update[-<repo1>[,...]] [VERSION=git.tag]Available repository options:
corepluginsportsportsrefsrctoolsUse the VERSION flag to update to a specific git tag instead of HEAD.
# make update core,plugins VERSION=26.7.4Use the make clean-<option> command to remove specific build artifacts and free up space.
Available clean options:
arm, base, dvd, kernel, nano, serial, vga, vm: Removes specific image types.packages, ports: Removes package sets.plugins: Removes plugins from package sets.core: Removes core from package sets.distfiles: Removes distfiles.images: Removes all images.obj: Removes all object directories.sets: Removes all sets.src: Resets kernel/base build directory.stage: Resets main staging area.logs: Removes all logs.# make clean-images