Howto build an ISO image
Building a VyOS images is fairly easy and straightforward.
One important pitfall is that VyOS versions before and after the 1.2.0-beta use different build systems and build host platforms. You need to select the correct build system that matches the desired version.
- 1 1.2.0-beta and newer
- 2 1.1.8 and earlier
1.2.0-beta and newer
The image build scripts for 1.2.0 had been rewritten from scratch to clean up the legacy code and make it easier to add new features. The build procedures also got much simpler.
Build host preparation
For building VyOS 1.2.0, the build host should run Debian Jessie. Building on Wheezy or Stretch is theoretically possible but wasn't tested, you can try it at your own risk.
Unlike the build scripts of VyOS 1.1.x, the configure script will check for missing dependencies and tell you what to install, but if you want to prepare in advance, install the following apt repositories and packages:
echo "deb http://ftp.debian.org/debian jessie-backports main non-free" >> /etc/apt/sources.list apt-get update apt-get install git sudo make live-build pbuilder devscripts python3-pystache python3-git
Clone the build scripts repository:
git clone https://github.com/vyos/vyos-build.git
Building the ISO image
Switch to the vyos-build directory and run ./configure and "sudo make iso"
cd vyos-build ./configure sudo make iso
It is important that you run "make iso" with root privileges, this is required by the Debian live-build tool that the scripts are using that creates a fakeroot.
Configuring the build
There are a few options you can pass to ./configure
-h, --help show this help message and exit --architecture ARCHITECTURE Image target architecture (amd64 or i586 or armhf) --build-by BUILD_BY Builder identifier (e.g. firstname.lastname@example.org) --custom-packages CUSTOM_PACKAGES Custom packages to install from repositories --build-type BUILD_TYPE Build type, release or development --debian-security-mirror DEBIAN_SECURITY_MIRROR Debian security updated mirror --version VERSION Version number (release builds only) --debian-mirror DEBIAN_MIRROR Debian repository mirror for ISO build --vyos-mirror VYOS_MIRROR VyOS package mirror --pbuilder-debian-mirror PBUILDER_DEBIAN_MIRROR Debian repository mirror for pbuilder env bootstrap --debug Enable debug output --custom-apt-entry CUSTOM_APT_ENTRY Custom APT entry --custom-apt-key CUSTOM_APT_KEY Custom APT key file
Changing Debian package mirrors
If you host a local mirror or want to switch to a mirror closer to your location, you can use --debian-mirror and --debian-security-mirror options.
./configure --debian-mirror="http://ftp.example.com/debian" --debian-security-mirror="http://ftp.example.com/debian-security"
It's also possible to use different mirrors for build environment bootstrap and for packages that will be included in the VyOS image. You can do it by setting the --pbuilder-debian-mirror option.
Changing image information
You can set the "Build by:" field displayed in "run show version" with the --build-by= option, e.g.
By default, a development build is produced, with version string like 999.201709132137 If you want to make your own release build, you can use --build-type=release and --version options
./configure --build-by="email@example.com" --build-type=release --version="9.44.81"
Customising Debian packages
Any .deb files you drop into vyos-build/packages/ will be picked up by the Makefile and automatically installed.
1.1.8 and earlier
Build host preparation
You need to setup Debian Squeeze.
Build architecture is selected based on host architecture, so to build 32-bit image, use 32-bit debian squeeze host; for 64-bit use 64-bit squeeze host.
Currently (VyOS Helium) does NOT compile on anything else than debian squeeze (Debian 6)
Installing Debian & VyOS archive keys
In case it's not already installed:
apt-get install debian-archive-keyring
And then follow the steps in Public_key to install the VyOS archive key.
If you skip this step, you might get warnings about untrusted packages during build.
Installing SquashFS tools
First, you will need a more recent squashfs package than squeeze has. VyOS uses extended file attributes, and older (pre 4.2) versions do not handle attributes.
It is available from squeeze-backports repository.
- Add this "deb http://archive.debian.org/backports.org/ squeeze-backports main" to your sources.list (or add a new file with the ".list" extension to /etc/apt/sources.list.d/)
- Run apt-get update
- Run "sudo apt-get -t squeeze-backports install squashfs-tools"
Installing build dependencies
Building the ISO requires some packages not installed by default. To install them, run:
sudo apt-get install git autoconf automake dpkg-dev live-helper syslinux genisoimage
Getting the build-iso source
git clone https://github.com/vyos/build-iso.git cd build-iso
You may want to switch the branch from the default, which is set to the current stable branch.
If you want a different branch:
git branch $branch --track origin/$branch git checkout $branch
Building the image
After this continue with:
export PATH=/sbin:/usr/sbin:$PATH autoreconf -i ./configure sudo make iso
It should end with something like:
Warning: creating filesystem that does not conform to ISO-9660. Size of boot image is 4 sectors -> No emulation 4.61% done, estimate finish Tue Oct 22 09:28:18 2013 9.20% done, estimate finish Tue Oct 22 09:28:18 2013 13.80% done, estimate finish Tue Oct 22 09:28:18 2013 18.39% done, estimate finish Tue Oct 22 09:28:18 2013 22.99% done, estimate finish Tue Oct 22 09:28:18 2013 27.58% done, estimate finish Tue Oct 22 09:28:18 2013 32.19% done, estimate finish Tue Oct 22 09:28:18 2013 36.78% done, estimate finish Tue Oct 22 09:28:18 2013 41.38% done, estimate finish Tue Oct 22 09:28:18 2013 45.97% done, estimate finish Tue Oct 22 09:28:18 2013 50.57% done, estimate finish Tue Oct 22 09:28:19 2013 55.16% done, estimate finish Tue Oct 22 09:28:19 2013 59.76% done, estimate finish Tue Oct 22 09:28:19 2013 64.35% done, estimate finish Tue Oct 22 09:28:19 2013 68.96% done, estimate finish Tue Oct 22 09:28:19 2013 73.55% done, estimate finish Tue Oct 22 09:28:19 2013 78.15% done, estimate finish Tue Oct 22 09:28:19 2013 82.74% done, estimate finish Tue Oct 22 09:28:19 2013 87.34% done, estimate finish Tue Oct 22 09:28:19 2013 91.92% done, estimate finish Tue Oct 22 09:28:20 2013 96.53% done, estimate finish Tue Oct 22 09:28:20 2013 Total translation table size: 2048 Total rockridge attributes bytes: 9140 Total directory bytes: 22528 Path table size(bytes): 100 Max brk space used 12000 108786 extents written (212 MB) Reading package lists... Done Building dependency tree Reading state information... Done P: Deconfiguring file /etc/apt/apt.conf P: Deconfiguring file /usr/sbin/policy-rc.d P: Begin unmounting /sys... P: Deconfiguring file /usr/sbin/initctl P: Begin unmounting /selinux... P: Begin unmounting /proc... P: Begin unmounting /dev/pts... P: Begin unmounting filesystems... I: Done
If everything went fine
You will find the ISO in the livecd subdirectory:
#ls -l livecd/ total 218180 -rw-r--r-- 1 root root 223346688 Oct 22 09:28 binary.iso