Difference between revisions of "Build procedures"

From VyOS Wiki
Jump to: navigation, search
(Move Mellanox build procedure to the obsolete section)
 
Line 28: Line 28:
 
The "make scripts" part is where the genksyms utility is built, and this is required for building modules.
 
The "make scripts" part is where the genksyms utility is built, and this is required for building modules.
  
=== Notes ===
 
 
# The install.pl script must be run with root permissions. That's the way it is in the upstream.
 
# Build errors are not displayed in the console even with "-vvv"
 
# If a build error occurs, the script will tell you the location of the log file, that you must inspect to find the error
 
  
 
= Userspace packages =
 
= Userspace packages =
Line 110: Line 105:
 
sudo ./install.pl -k 4.14.65-amd64-vyos --build-only --without-dkms --kernel-only --kernel-sources ~/vyos-kernel-source -vvv
 
sudo ./install.pl -k 4.14.65-amd64-vyos --build-only --without-dkms --kernel-only --kernel-sources ~/vyos-kernel-source -vvv
 
</pre>
 
</pre>
 +
 +
=== Notes ===
 +
 +
# The install.pl script must be run with root permissions. That's the way it is in the upstream.
 +
# Build errors are not displayed in the console even with "-vvv"
 +
# If a build error occurs, the script will tell you the location of the log file, that you must inspect to find the error
 +
  
 
[[Category: Development]]
 
[[Category: Development]]

Latest revision as of 16:11, 4 January 2019

Some packages require special build procedures.

Drivers and kernel modules

Preparing the kernel source

VyOS does not use DKMS due to its image upgrade mechanism and drive space concerns. All drivers included in the image must come pre-compiled.

For building all drivers and other packages that depend on specific kernel version, you will need the kernel source and some preparation.

Generally, you will need the complete source code of the target kernel. Headers alone will not suffice, you need the complete source.

One option is to use the "Download ZIP" option in a specific branch of https://github.com/vyos/vyos-kernel. Another option is to find matching linux-source-${version} package in http://dev.packages.vyos.net/repositories/current/vyos/pool/main/l/.

The kernel source version must match the target kernel exactly. Suppose the target kernel is 4.14.65.

Unpack the kernel source, for example to ~/vyos-kernel-source Inside the kernel source dir, run:

# Copy the VyOS kernel build config
cp arch/x86/configs/x86_64_vyos_defconfig .config

make oldconfig && make prepare && make scripts

The "make scripts" part is where the genksyms utility is built, and this is required for building modules.


Userspace packages

FRR

FRR (Free Range Routing) is the routing stack that provides common RIB and routing protocols (OSPF, BGP etc.) implementations in VyOS.

FRR source is found at github.com/FRRouting/frr.

Installing build dependencies

Some packages are needed right away to execute the ./configure successfully:

Packages that are available from Debian repos in both Jessie and Buster:

sudo apt-get install libpython3-dev libjson-c-dev libreadline-dev libc-ares-dev

FRR also needs libyang and librtr. On Buster, you can install both from the repos. On Jessie, you can take libyang from https://software.opensuse.org//download.html?project=home%3Aliberouter&package=libyang The source code of librtr can be found at https://github.com/xdel/rtrlib, it includes debian packaging and builds nicely on Jessie.

Building the package

On Jessie, the following procedure can be executed verbatim:

./bootstrap.sh
./configure --with-pkg-extra-version="-vyos"
make dist

mv debianpkg debian
make -f debian/rules backports

mkdir frrpkg
cd frrpkg
tar xf ../frr_*.orig.tar.gz
cd frr*
. /etc/os-release
tar xf ../../frr_*${ID}${VERSION_ID}*.debian.tar.xz

debuild --no-lintian --set-envvar=WANT_SNMP=1 --set-envvar=WANT_RPKI=1 --set-envvar=WANT_CUMULUS_MODE=0 -b -uc -us

On Buster, the "tar xf" step does not work as is due to version missing from os-release file of a testing distro. You will need to specify the tarball (debian9+) manually.

At the debuild step you may be prompted to install additional build dependencies.

OBSOLETE

These procedures are not needed now, but they are kept for the reference in case we will need them again.

Mellanox OFED

Getting the source

  1. Visit http://www.mellanox.com/page/products_dyn?product_family=26
  2. Click on the "Download" tab
  3. Select the current version. Set the OS to Debian, version and architecture don't matter.
  4. Find the SOURCES package link, the tarball is named MLNX_OFED_SRC-debian-${version}
  5. Download the tarball. The link is direct and safe for wget

Building the package

Prepare the source code of the target kernel as described in the #Preparing the kernel source section. Trying to build it with raw source or headers will cause a build failure.

Building the Mellanox drivers

Unpack the MLNX_OFED_SRC-debian tarball.

Assuming the target kernel is 4.14.65, and the source is in ~/vyos-kernel-source. Inside the directory, run:

sudo ./install.pl -k 4.14.65-amd64-vyos --build-only --without-dkms --kernel-only --kernel-sources ~/vyos-kernel-source -vvv

Notes

  1. The install.pl script must be run with root permissions. That's the way it is in the upstream.
  2. Build errors are not displayed in the console even with "-vvv"
  3. If a build error occurs, the script will tell you the location of the log file, that you must inspect to find the error