From 081bf77f86881b9c2438902595193c2a311b02cd Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Sun, 6 Jan 2019 00:21:18 +0100 Subject: Added build-kernel script and almost total rewrite of build-submodules The build-kernel script was forgotten to commit, it is needed to build the kernel To make the build-submodules script more readable and extendible i've almost totally rewritten it using functions the build process is also started in its own subshell, so that we dont need to hold track of the current directory and make error handling/status info easier --- scripts/build-kernel | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 scripts/build-kernel (limited to 'scripts/build-kernel') diff --git a/scripts/build-kernel b/scripts/build-kernel new file mode 100755 index 00000000..80229d5d --- /dev/null +++ b/scripts/build-kernel @@ -0,0 +1,36 @@ +#!/bin/bash +if [ ! -f "Makefile" ]; then + echo "Makefile missing, This script needs to be executed inside the vyos-kernel package directory" + exit 1 +fi + +if grep -Fxq "KBUILD_OUTPUT" Makefile; then + echo "Wrong Makefile?, This script needs to be executed inside the vyos-kernel package directory" + exit 1 +fi + + +# 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) + +case "$ARCH" in + amd64) + 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" + fi + CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j4 ${TARGETS} + ;; + + armhf) + make armhf_vyos_defconfig + ;; +esac -- cgit v1.2.3 From 873cf3a68f318ba3a7469b0dbb5c9415787eef98 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 10:01:50 +0100 Subject: When building linux-kernel use number of host CPUs on parallel build --- scripts/build-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/build-kernel') diff --git a/scripts/build-kernel b/scripts/build-kernel index 80229d5d..4a23d9c7 100755 --- a/scripts/build-kernel +++ b/scripts/build-kernel @@ -27,7 +27,7 @@ case "$ARCH" in if [ ${PATCHLEVEL} -lt 14 ]; then TARGETS+=" kernel_manual kernel_doc" fi - CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j4 ${TARGETS} + CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j$(cat /proc/cpuinfo | grep processor | wc -l) ${TARGETS} ;; armhf) -- cgit v1.2.3 From 750f603f1ffc854bcfd190549ffb090246f6e28b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 21:40:03 +0100 Subject: build-kernel: no need to build source and debug package --- scripts/build-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/build-kernel') diff --git a/scripts/build-kernel b/scripts/build-kernel index 4a23d9c7..e58d2d5a 100755 --- a/scripts/build-kernel +++ b/scripts/build-kernel @@ -20,7 +20,7 @@ ARCH=$(dpkg --print-architecture) case "$ARCH" in amd64) make x86_64_vyos_defconfig - TARGETS="kernel_source kernel_debug kernel_headers kernel_image" + TARGETS="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). -- cgit v1.2.3