obs-packaging: support kernel fragments

use `merge_config.sh` script to generate the final `.config` file if the
`${arch}_kata_kvm_*` file doesn't exist.

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2019-07-25 18:10:59 +00:00
parent 229411a5ae
commit 9e8cd7d6df
3 changed files with 18 additions and 3 deletions

View File

@ -17,7 +17,15 @@ override_dh_auto_build:
tar xzf /usr/src/packages/SOURCES/$(KERNEL_CONFIGS).tar.gz
rm -f .config
find $(KERNEL_CONFIGS) -name "$(KERNEL_ARCH)_kata_kvm_*" -exec cp {} .config \;
if [ ! -f .config ]; then
# Use fragments to generate the .config
frag_dir="kata-kernel-configs/fragments"
err_msg="not in final"
r="$(KCONFIG_CONFIG=.config ARCH=${kernelArch} scripts/kconfig/merge_config.sh -r -n ${frag_dir}/common/* ${frag_dir}/${kernelArch}/* | grep "${err_msg}")" || true
[ -z "${r}" ] || (@echo "ERROR: ${r}"; exit 1)
fi
[ -f .config ] || (@echo "ERROR: cannot find the kernel config file for the $(KERNEL_ARCH) architecture"; exit 1)
# https://github.com/kata-containers/packaging/issues/394 enable reproducible builds:
export KBUILD_BUILD_USER=katabuilduser
export KBUILD_BUILD_HOST=katabuildhost

View File

@ -80,7 +80,14 @@ BuildKernel() {
# Runtime .config selection based on kernelArch
rm -f .config
find kata-kernel-configs -name "${kernelArch}_kata_kvm_*" -exec cp {} .config \;
[ -f .config ] || (echo "ERROR: cannot find the kernel config file for the ${kernelArch} architecture"; exit 1)
if [ ! -f .config ]; then
# Use fragments to generate the .config
frag_dir="kata-kernel-configs/fragments"
err_msg="not in final"
r="$(KCONFIG_CONFIG=.config ARCH=${kernelArch} scripts/kconfig/merge_config.sh -r -n ${frag_dir}/common/* ${frag_dir}/${kernelArch}/* | grep "${err_msg}")" || true
[ -z "${r}" ] || (echo "ERROR: ${r}"; exit 1)
fi
[ -f .config ] || (echo "ERROR: cannot find the kernel config file for the ${kernelArch} architecture"; exit 1)
%if 0%{?rhel_version} || 0%{?suse_version}
# RHEL in OBS has updated gcc.

View File

@ -50,10 +50,10 @@ RELEASE=$(get_obs_pkg_release "${PROJECT_REPO}")
kernel_sha256=$(curl -L -s -f ${KR_SHA} | awk '/linux-'${VERSION}'.tar.xz/ {print $1}')
# Copy the kernel config files for all architecture
# Copy the kernel config files and fragments for all architecture
mkdir -p configs
readonly configs_dir="kernel/configs"
find "${SCRIPT_DIR}/../../${configs_dir}" -name "*_kata_kvm_${KR_LTS}.x" -exec tar --transform="s,${configs_dir},${KR_CONFIGS}," -czf ${KR_CONFIGS}.tar.gz {} +
find "${SCRIPT_DIR}/../../${configs_dir}" \( -name "*_kata_kvm_${KR_LTS}.x" -o -name fragments \) -exec tar --transform="s,${configs_dir},${KR_CONFIGS}," -czf ${KR_CONFIGS}.tar.gz {} +
replace_list=(
"VERSION=${VERSION}"