mirror of https://github.com/dynup/kpatch
kpatch-build: add support for CONFIG_LIVEPATCH on RHEL
Fix the version checks for when we enable CONFIG_LIVEPATCH on RHEL. It will be based on the latest upstream code. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
parent
d44a4b9df5
commit
2e85ec5672
|
@ -35,17 +35,20 @@
|
|||
#define UTS_UBUNTU_RELEASE_ABI 0
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || \
|
||||
defined(RHEL_RELEASE_CODE)
|
||||
#define HAVE_ELF_RELOCS
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || \
|
||||
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) && \
|
||||
UTS_UBUNTU_RELEASE_ABI >= 7)
|
||||
UTS_UBUNTU_RELEASE_ABI >= 7) || \
|
||||
defined(RHEL_RELEASE_CODE)
|
||||
#define HAVE_SYMPOS
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || \
|
||||
defined(RHEL_RELEASE_CODE)
|
||||
#define HAVE_IMMEDIATE
|
||||
#endif
|
||||
|
||||
|
|
|
@ -136,6 +136,10 @@ version_gte() {
|
|||
[ "$1" = "$(echo -e "$1\n$2" | sort -rV | head -n1)" ]
|
||||
}
|
||||
|
||||
is_rhel() {
|
||||
[[ $1 =~ \.el[78]\. ]]
|
||||
}
|
||||
|
||||
find_dirs() {
|
||||
if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then
|
||||
# git repo
|
||||
|
@ -599,10 +603,10 @@ KPATCH_MODULE=true
|
|||
grep -q "CONFIG_DEBUG_INFO=y" "$CONFIGFILE" || die "kernel doesn't have 'CONFIG_DEBUG_INFO' enabled"
|
||||
if grep -q "CONFIG_LIVEPATCH=y" "$CONFIGFILE"; then
|
||||
# The kernel supports livepatch.
|
||||
if version_gte "${ARCHVERSION//-*/}" 4.7.0; then
|
||||
if version_gte "${ARCHVERSION//-*/}" 4.7.0 || is_rhel "$ARCHVERSION"; then
|
||||
# Use new .klp.rela. sections
|
||||
KPATCH_MODULE=false
|
||||
if version_gte "${ARCHVERSION//-*/}" 4.9.0; then
|
||||
if version_gte "${ARCHVERSION//-*/}" 4.9.0 || is_rhel "$ARCHVERSION"; then
|
||||
KPATCH_LDFLAGS="--unique=.parainstructions --unique=.altinstructions"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue