Skip to content

Commit 624e5e3

Browse files
committed
kmod: pass CFLAGS_MODULE to module build
The kmod/patch/Makefile defines KBUILD_CFLAGS_MODULE, but it seems that kbuild doesn't honor it as environment variable. This is noticed when attempting to use the kpatch-build --non-replace option: the flag is added to KBUILD_CFLAGS_MODULE, yet the kernel module build ignores it. At the same time, the kernel docs suggest passing CFLAGS_MODULE [1], not KBUILD_CFLAGS_MODULE, from the commandline. Setup KPATCH_MAKE to pass these options through that variable. [1] https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt Fixes: c14e6e9 ("kpatch-build: Add PPC64le livepatch support") Fixes: 17dcebf ("kpatch-build: enable klp with replace option by default") Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
1 parent 58c816e commit 624e5e3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

kmod/patch/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
2-
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD)
2+
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD) CFLAGS_MODULE='$(CFLAGS_MODULE)'
33
LDFLAGS += $(KPATCH_LDFLAGS)
44

55
# ppc64le kernel modules are expected to compile with the
66
# -mcmodel=large flag. This enables 64-bit relocations
77
# instead of a 32-bit offset from the TOC pointer.
88
PROCESSOR = $(shell uname -m)
99
ifeq ($(PROCESSOR), ppc64le)
10-
KBUILD_CFLAGS_MODULE += -mcmodel=large
10+
CFLAGS_MODULE += -mcmodel=large
1111
endif
1212

1313
obj-m += $(KPATCH_NAME).o

kpatch-build/kpatch-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ if grep -q "CONFIG_LIVEPATCH=y" "$CONFIGFILE" && (kernel_is_rhel || kernel_versi
839839
if [[ "$KLP_REPLACE" -eq 1 ]] ; then
840840
support_klp_replace || die "The kernel doesn't support klp replace"
841841
else
842-
export KBUILD_CFLAGS_MODULE="$KBUILD_CFLAGS_MODULE -DKLP_REPLACE_ENABLE=false"
842+
export CFLAGS_MODULE="$CFLAGS_MODULE -DKLP_REPLACE_ENABLE=false"
843843
fi
844844
else
845845
# No support for livepatch in the kernel. Kpatch core module is needed.

0 commit comments

Comments
 (0)