mirror of
https://github.com/dynup/kpatch
synced 2024-12-12 00:14:35 +00:00
5b62d5f169
A simple kernel module for testing basic kernel module patching. Just run doit.sh from test/testmod. Signed-off-by: Seth Jennings <sjenning@redhat.com>
24 lines
666 B
Makefile
24 lines
666 B
Makefile
BUILD ?= /lib/modules/$(shell uname -r)/build
|
|
|
|
testmod.ko: testmod_drv.c
|
|
patch < patch
|
|
KCFLAGS="-ffunction-sections -fdata-sections" $(MAKE) -C $(BUILD) M=$(PWD) testmod.ko
|
|
strip --keep-file-symbols -d testmod_drv.o
|
|
cp testmod_drv.o testmod_drv.o.patched
|
|
patch -R < patch
|
|
KCFLAGS="-ffunction-sections -fdata-sections" $(MAKE) -C $(BUILD) M=$(PWD) testmod.ko
|
|
strip --keep-file-symbols -d testmod_drv.o
|
|
cp testmod_drv.o testmod_drv.o.orig
|
|
$(MAKE) -C $(BUILD) M=$(PWD) clean
|
|
$(MAKE) -C $(BUILD) M=$(PWD) testmod.ko
|
|
|
|
all: testmod.ko
|
|
|
|
clean:
|
|
$(MAKE) -C $(BUILD) M=$(PWD) clean
|
|
rm *.orig *.patched
|
|
|
|
# kbuild rules
|
|
obj-m := testmod.o
|
|
testmod-y := testmod_drv.o
|