Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
obs-packaging: support kernel fragments
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julio Montes committed Jul 25, 2019
1 parent 229411a commit 9e8cd7d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions obs-packaging/linux-container/debian.rules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions obs-packaging/linux-container/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 9e8cd7d

Please sign in to comment.