Difference between revisions of "Rebuild VyOS kernel Step"

From VyOS Wiki
Jump to: navigation, search
(VyOS 1.2.x)
Line 114: Line 114:
[[Category: Development]]
[[Category: Development]]
[[Category: Don't migrate]]

Latest revision as of 11:26, 26 June 2019

Rebuild VyOS kernel Step

VyOS 1.1.x

First clone build-iso.

git clone git://github.com/vyos/build-iso.git
cd build-iso

Update submodule. $branch is branch name (eg. helium)

Available flavors.

  • amd64-vyos
  • amd64-vyos-virt
  • 586-vyos
  • 586-vyos-virt

git submodule update --init pkgs/linux-image
cd pkgs/linux-image
git checkout $branch

Execute build-flavour.sh to generate control file. and ignore last error.

./debian/bin/build-flavour.sh $flavor

make[1]: *** [debian/control-real] Error 1
make[1]: Leaving directory `/home/arch/build-iso/pkgs/linux-image'
make: *** [debian/control] Error 2

Make sure you have required tools installed

apt-get install devscripts kernel-package bc

Finally, execute make

cd ../../ # Top directory in build-iso.
make linux-image

VyOS 1.2.x

Please use the steps below when working with VyOS 1.2.x.

Clone the repository

shell> git clone https://github.com/vyos/vyos-build.git

Initialize submodule

shell> cd vyos-build
shell> git submodule update --init packages/vyos-kernel

Checkout current branch

shell> cd packages/vyos-kernel
shell> git checkout current

Load VyOS Kernel configuration

shell> make x86_64_vyos_defconfig

Compile the Kernel

shell> LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=4.4.95-1+vyos1+current1 kernel_source kernel_debug kernel_headers kernel_manual kernel_doc kernel_image

Embedded Shell Script

This is actually the command which runs on the Jenkins Server to build the Kernel:

cd vyos-kernel
RELEASE=`echo $GIT_BRANCH | sed 's/origin\//* /g' |sed -n 's/^\* \(.*\)$/\1/p'`

if [ "${RELEASE}" = "helium" ]; then
    rm -f ../*.deb
    make -f debian/rules clean
    make -f debian/rules source-all
    dpkg-buildpackage -b -us -uc
    # newer Kernel versions come with a "# SPDX-License-Identifier: GPL-2.0" identifier
    # as the first line in the file - use compatible approach with grep rather then sed
    VERSION=$(grep "^VERSION" Makefile | grep -Eo '[0-9]{1,4}')
    PATCHLEVEL=$(grep "^PATCHLEVEL" Makefile | grep -Eo '[0-9]{1,4}')
    SUBLEVEL=$(grep "^SUBLEVEL" Makefile | grep -Eo '[0-9]{1,4}')
    ARCH=$(dpkg --print-architecture)
    rm -f ../*.deb

    case "$ARCH" in
            make x86_64_vyos_defconfig
            TARGETS="kernel_source kernel_debug kernel_headers kernel_image"
            # the following targets are not supported for Linux Kernels > 4.14 as
            # they have been removed from the Makefile (commits 18afab8c1d3c2 &
            # 22cba31bae9dc).
            if [ ${PATCHLEVEL} -lt 14 ]; then
                TARGETS+=" kernel_manual kernel_doc"
            CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j4 ${TARGETS}

            make armhf_vyos_defconfig