mirror of
https://github.com/dynup/kpatch
synced 2024-12-14 17:34:34 +00:00
4dee89269c
This adds support for shadow variables, which allow you to add new "shadow" fields to existing data structures. To allow patches to call the shadow functions in the core module, I had to add a funky hack to use --warn-unresolved-symbols when linking, which allows the patched vmlinux to link with the missing symbols. I also added greps to the log file to ensure that only unresolved symbols to kpatch_shadow_* are allowed. We can remove this hack once the core module gets moved into the kernel tree. Fixes #314.
24 lines
571 B
Makefile
24 lines
571 B
Makefile
# make rules
|
|
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
|
|
THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
|
|
ifeq ($(wildcard $(KPATCH_BUILD)),)
|
|
$(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(shell uname -r) RPM or linux-image-$(shell uname -r)-dbg DEB.)
|
|
endif
|
|
|
|
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR)
|
|
|
|
kpatch.ko: core.c
|
|
$(KPATCH_MAKE) kpatch.ko
|
|
|
|
all: kpatch.ko
|
|
|
|
clean:
|
|
$(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \
|
|
Module.symvers
|
|
|
|
|
|
# kbuild rules
|
|
obj-m := kpatch.o
|
|
kpatch-y := core.o shadow.o
|