Howto build an ISO image

From VyOS Wiki
Jump to: navigation, search

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.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 packages:

apt-get install git sudo make live-build pbuilder devscripts python3-pystache

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

Changing Debian package mirrors

The default mirrors are http://ftp.nl.debian.org/debian/ for the base system and http://security.debian.org/

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.

./configure --build-by="jrandomhacker@example.net"

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="user@example.com" --build-type=release --version="9.44.81"


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.

  1. 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/)
  2. Run apt-get update
  3. 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