mirror of
https://github.com/dynup/kpatch
synced 2024-12-23 21:52:07 +00:00
b1cdc83d57
Introduce a second phase in the kpatch-build process that creates kpatch modules or livepatch modules that use the new klp rela sections depending on the kernel version being worked on. This change uses the two new programs to either create a patch module that uses dynrelas (create-kpatch-module) or a patch module that uses klp rela and arch sections + klp symbols marked with the correct Elf flags (create-klp-module). For klp patch modules, the --unique flag for ld is needed to prevent .parainstructions and .altinstructions sections from different objects from being merged, as arch_klp_init_object_loaded() applies these sections per-object.
21 lines
537 B
Makefile
21 lines
537 B
Makefile
KPATCH_NAME ?= patch
|
|
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
|
|
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD)
|
|
LDFLAGS += $(KPATCH_LDFLAGS)
|
|
|
|
obj-m += kpatch-$(KPATCH_NAME).o
|
|
|
|
kpatch-$(KPATCH_NAME)-objs += patch-hook.o kpatch.lds output.o
|
|
|
|
all: kpatch-$(KPATCH_NAME).ko
|
|
|
|
kpatch-$(KPATCH_NAME).ko:
|
|
$(KPATCH_MAKE) kpatch-$(KPATCH_NAME).ko
|
|
|
|
patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c
|
|
$(KPATCH_MAKE) patch-hook.o
|
|
|
|
clean:
|
|
$(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \
|
|
Module.symvers
|