2014-02-13 03:53:05 +00:00
|
|
|
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
|
2014-01-28 17:23:24 +00:00
|
|
|
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD)
|
2017-01-23 20:43:43 +00:00
|
|
|
LDFLAGS += $(KPATCH_LDFLAGS)
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2017-07-25 16:38:48 +00:00
|
|
|
# ppc64le kernel modules are expected to compile with the
|
|
|
|
# -mcmodel=large flag. This enables 64-bit relocations
|
|
|
|
# instead of a 32-bit offset from the TOC pointer.
|
2017-08-18 12:48:43 +00:00
|
|
|
PROCESSOR = $(shell uname -m)
|
2017-07-26 05:46:53 +00:00
|
|
|
ifeq ($(PROCESSOR), ppc64le)
|
|
|
|
KBUILD_CFLAGS_MODULE += -mcmodel=large
|
|
|
|
endif
|
|
|
|
|
2017-09-20 20:30:00 +00:00
|
|
|
obj-m += $(KPATCH_NAME).o
|
2018-11-14 14:09:34 +00:00
|
|
|
ldflags-y += -T $(src)/kpatch.lds
|
2020-12-04 11:29:55 +00:00
|
|
|
targets += kpatch.lds
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2018-12-07 15:46:08 +00:00
|
|
|
$(KPATCH_NAME)-objs += patch-hook.o output.o
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2017-09-20 20:30:00 +00:00
|
|
|
all: $(KPATCH_NAME).ko
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2017-09-20 20:30:00 +00:00
|
|
|
$(KPATCH_NAME).ko:
|
2018-12-07 15:46:08 +00:00
|
|
|
$(KPATCH_MAKE)
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2020-12-04 11:29:55 +00:00
|
|
|
$(obj)/$(KPATCH_NAME).o: $(src)/kpatch.lds
|
|
|
|
|
2015-01-22 17:05:52 +00:00
|
|
|
patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c
|
2015-01-22 00:28:31 +00:00
|
|
|
$(KPATCH_MAKE) patch-hook.o
|
2014-02-11 16:25:48 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \
|
|
|
|
Module.symvers
|