Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .packit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ _:
fmf_url: https://gitlab.com/redhat/centos-stream/tests/kernel/test-plans.git
fmf_ref: main

common-rhel-64k-test-config: &common-rhel-64k-test-config
job: tests
branch: master
identifier: "integration-rhel-64k"
use_internal_tf: true
targets:
rhel+epel-10-aarch64:
distros: [RHEL-10.3-Nightly]
skip_build: true
manual_trigger: false
tmt_plan: kpatch-integration-rhel/kernel-64k$
fmf_url: https://gitlab.com/redhat/centos-stream/tests/kernel/test-plans.git
fmf_ref: main

jobs:
- <<: *common-upstream-kernel-test-config
trigger: pull_request
Expand All @@ -70,3 +84,12 @@ jobs:
trigger: commit
labels:
- integration-commit

- <<: *common-rhel-64k-test-config
trigger: pull_request
labels:
- integration-pr
- <<: *common-rhel-64k-test-config
trigger: commit
labels:
- integration-commit
30 changes: 29 additions & 1 deletion kpatch-build/kpatch-build
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ usage() {
echo " -r, --sourcerpm Specify kernel source RPM" >&2
echo " -s, --sourcedir Specify kernel source directory" >&2
echo " -c, --config Specify kernel config file" >&2
echo " -V, --variant Specify kernel variant" >&2
echo " -v, --vmlinux Specify original vmlinux" >&2
echo " -j, --jobs Specify the number of make jobs" >&2
echo " -t, --target Specify custom kernel build targets" >&2
Expand All @@ -803,7 +804,7 @@ if ! command -v gawk &> /dev/null; then
die "gawk not installed"
fi

options="$(getopt -o ha:r:s:c:v:j:t:n:o:dR -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,version" -- "$@")" || die "getopt failed"
options="$(getopt -o ha:r:s:c:V:v:j:t:n:o:dR -l "help,archversion:,sourcerpm:,sourcedir:,config:,variant:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,version" -- "$@")" || die "getopt failed"

eval set -- "$options"

Expand Down Expand Up @@ -832,6 +833,10 @@ while [[ $# -gt 0 ]]; do
CONFIGFILE="$(readlink -f "$2")"
shift
;;
-V|--variant)
VARIANT="$2"
shift
;;
-v|--vmlinux)
[[ ! -f "$2" ]] && die "vmlinux file '$2' not found"
VMLINUX="$(readlink -f "$2")"
Expand Down Expand Up @@ -927,6 +932,14 @@ if [[ -n "$SRCRPM" ]]; then
ARCHVERSION="${ARCHVERSION#kernel-}"
ARCHVERSION="${ARCHVERSION#alt-}"
ARCHVERSION="${ARCHVERSION#linux-}"

if [[ -n "$VARIANT" ]]; then
ARCHVERSION="${ARCHVERSION}+${VARIANT//-/_}"
fi
fi

if [[ -n "$VARIANT" && -z "$SRCRPM" && -z "$USERSRCDIR" ]]; then
die "--variant requires --sourcerpm or --sourcedir"
fi

if [[ -n "$OOT_MODULE" ]] && [[ -z "$OOT_MODULE_SRCDIR" ]]; then
Expand Down Expand Up @@ -957,6 +970,11 @@ if [[ -n "$USERSRCDIR" ]]; then
fi
ARCHVERSION="$VMLINUX_VER"
fi

if [[ -n "$VARIANT" ]]; then
ARCHVERSION="${ARCHVERSION%+*}"
ARCHVERSION="${ARCHVERSION}+${VARIANT//-/_}"
fi
fi

if [[ -n "$OOT_MODULE" ]]; then
Expand Down Expand Up @@ -999,6 +1017,10 @@ if [[ "$ARCHVERSION" =~ - ]]; then
KREL="${KREL%.*}"
fi

if [[ -z "$VARIANT" ]] && [[ "$ARCHVERSION" =~ \+(.*)$ ]]; then
VARIANT="${BASH_REMATCH[1]//_/-}"
fi

[[ "$ARCHVERSION" =~ .el7a. ]] && ALT="-alt"

[[ -z "$TARGETS" ]] && TARGETS="vmlinux modules"
Expand Down Expand Up @@ -1113,6 +1135,12 @@ else
[[ -z "$CONFIGFILE" ]] && CONFIGFILE="/boot/config-${ARCHVERSION}"
elif [[ "$DISTRO" = photon ]]; then
[[ -z "$CONFIGFILE" ]] && CONFIGFILE="$KERNEL_SRCDIR"/.config
elif [[ -n "$VARIANT" ]]; then
if [[ -z "$CONFIGFILE" ]]; then
cfg="$KERNEL_SRCDIR/configs/kernel$ALT-$KVER-$ARCH-$VARIANT.config"
[[ -e "$cfg" ]] || die "kernel variant '$VARIANT' not found (expected $(basename "$cfg"))"
CONFIGFILE="$cfg"
fi
else
[[ -z "$CONFIGFILE" ]] && CONFIGFILE="$KERNEL_SRCDIR/configs/kernel$ALT-$KVER-$ARCH.config"
fi
Expand Down
3 changes: 3 additions & 0 deletions man/kpatch-build.1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ effect.
-c|--config
Specify kernel config file

-V|--variant
Specify kernel variant

-v|--vmlinux
Specify original vmlinux

Expand Down
14 changes: 10 additions & 4 deletions test/integration/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,36 @@ kpatch_rhel_dependencies()
local arch
local rhel_major
local yum_utils_version
local variant
kernel_version=$(uname -r)
arch=$(uname -m)
rhel_major=${VERSION_ID%%.*}

# Detect kernel (e.g., +64k , +rt_64k)
if [[ "$kernel_version" =~ \+(.*)$ ]]; then
variant="${BASH_REMATCH[1]//_/-}"
fi

# kpatch-build dependencies
sudo yum install -y \
elfutils \
elfutils-devel \
gcc \
gcc-c++ \
git \
"kernel-devel-${kernel_version%.*}" \
"kernel${variant:+-$variant}-devel-${kernel_version%.*}" \
rpm-build \
wget \
yum-utils
sudo debuginfo-install -y "kernel-${kernel_version%.*}"
sudo debuginfo-install -y "kernel${variant:+-$variant}-${kernel_version%.*}"
[[ "$arch" == "ppc64le" ]] && sudo yum install -y gcc-plugin-devel

# kernel dependencies
yum_utils_version=$(rpm -q --queryformat="%{version}" yum-utils)
if [[ "${yum_utils_version}" = "$(echo -e "${yum_utils_version}\\n4.0.12" | sort -rV | head -n1)" ]]; then
sudo yum-builddep -y --skip-unavailable "kernel-${kernel_version%.*}"
sudo yum-builddep -y --skip-unavailable "kernel${variant:+-$variant}-${kernel_version%.*}"
else
sudo yum-builddep -y "kernel-${kernel_version%.*}"
sudo yum-builddep -y "kernel${variant:+-$variant}-${kernel_version%.*}"
fi
[[ "$arch" == "x86_64" ]] && sudo yum install -y pesign

Expand Down
Loading