Upstream Packages
Many base system packages are pulled straight from Debian’s main and
contrib repositories, but there are exceptions. If you only want to build
a fresh ISO image, you can skip
this section. This information may be useful for a deeper dive into VyOS.
System packages that are not directly pulled from Debian are built through a
separate build system, build.py in the vyos-build repository.
Overview
Previously, VyOS used Jenkins for building upstream packages. With the move away
from Jenkins, the build system was replaced with a Python-based solution using
build.py and package.toml configuration files.
Each package directory contains:
A
package.tomlconfiguration file that defines how the package is built.A symlink to the common
build.pyscript in the build system.
Building Packages
To build a package, navigate to the package directory and execute the build script:
cd package-build/<package-name>
./build.py
The script will:
Check out the source code from the configured repository.
Apply any patches defined in the configuration.
Execute pre-build hooks (if configured).
Build the package using the specified build command.
Generate both binary (
.deb) packages and source tarballs.
Package Configuration (package.toml)
Each package directory contains a package.toml file that defines the build
parameters. The key configuration fields are:
- name
The package name (e.g.,
frr)- commit_id
The specific commit, tag, or branch to check out from the source repository (e.g.,
stable/10.5)- scm_url
The Git URL of the upstream source repository (e.g.,
https://github.com/FRRouting/frr.git)
- build_cmd
The command to execute for building the package. This replaces what was previously defined in the Jenkins
Jenkinsfile.Default if not specified:
dpkg-buildpackage -uc -us -tc -F --source-option=--tar-ignore=.git --source-option=--tar-ignore=.githubExample with custom build command:
build_cmd = "sudo dpkg -i ../*.deb; dpkg-buildpackage -us -uc -tc -b -Ppkg.frr.rtrlib,pkg.frr.lua"
- pre_build_hook (Optional)
A shell command or script that executes after the repository is checked out and before the build process begins. This allows you to perform preparatory tasks such as:
Creating directories
Copying files
Running custom setup scripts
Installing dependencies
Single command example:
pre_build_hook = "echo 'Preparing build environment'"
Multi-line commands example:
pre_build_hook = """ mkdir -p ../hello/vyos mkdir -p ../vyos cp example.txt ../vyos """
Combined commands and scripts:
pre_build_hook = "ls -l; ./script.sh"
- apply_patches (Optional)
Boolean flag to control whether patches should be applied. Defaults to
True.apply_patches = false
- prepare_package (Optional)
Boolean flag to enable package preparation. When set to
True, theinstall_dataconfiguration is used.- install_data (Optional)
Data used for package preparation when
prepare_packageis enabled.
Example package.toml file
Here’s an example configuration for the FRRouting (FRR) package:
name = "frr"
commit_id = "stable/10.5"
scm_url = "https://github.com/FRRouting/frr.git"
build_cmd = "sudo dpkg -i ../*.deb; dpkg-buildpackage -us -uc -tc -b -Ppkg.frr.rtrlib,pkg.frr.lua"
Build Output
After running ./build.py, the following artifacts are generated in the
package directory:
.debfiles - Binary Debian packages ready for installation.tar.gzfiles - Source tarballs of the checked-out repositoriesAdditional build artifacts as produced by the Debian build system
The build script also creates build dependency packages (*build-deps*.deb), which are automatically cleaned up after the build completes.