2 memchecker = -DMEMORY_CHECKER
13 dev_path = @TARGET_DEVICE_PATH@
15 board_opt = -DBOARD_@BOARD@
17 target_kernel_src = @KERNEL@
19 driver_module_dir = $(realpath $(srcdir))
20 module_name = swap_driver
21 cross_compiler = $(subst gcc,,$(CC))
23 inlude_opt = -I$(realpath $(top_srcdir)/src/modules/ksyms) \
24 -I$(realpath $(top_srcdir)/src/modules/driver) \
25 -I$(realpath $(top_srcdir)/src/common) \
26 -I$(realpath $(top_srcdir)/src/profile) \
27 -I$(realpath $(top_srcdir)/src/modules/kprobe) \
28 -I$(realpath $(top_srcdir)/src/modules/kprobe/arch) \
29 -I$(realpath $(top_srcdir)/src/modules/uprobe)
30 extra_cflags = "$(inlude_opt) -DEC_ARCH_$(ARCH) -D__DEBUG $(memchecker) $(debug_opt) $(android_opt) $(slp_opt) $(android_app_opt) $(board_opt)"
32 #bin_SCRIPTS = patchko.sh insmod.sh
35 cp $(top_srcdir)/src/modules/kprobe/Module.symvers $(driver_module_dir)
36 $(MAKE) CROSS_COMPILE=$(cross_compiler) ARCH=$(target_arch) extra_cflags=$(extra_cflags) $(AM_MAKEFLAGS) -C $(target_kernel_src) $(sparse_output) M=$(driver_module_dir) modules
38 echo "generate data for version patching <$(OBJDUMP)><$(READELF)>"
39 $(top_srcdir)/src/modules/driver/patchko.sh -g $(driver_module_dir)/$(module_name).ko $(OBJDUMP) $(READELF)
42 $(MAKE) CROSS_COMPILE=$(cross_compiler) ARCH=$(target_arch) $(AM_MAKEFLAGS) -C $(target_kernel_src) M=$(driver_module_dir) clean
46 install -m 644 $(driver_module_dir)/$(module_name).ko $(prefix)
47 install -m 644 $(driver_module_dir)/$(module_name).ko.addr $(prefix)
48 install -m 755 $(driver_module_dir)/patchko.sh $(prefix)/bin
49 install -m 755 $(driver_module_dir)/insmod.sh $(prefix)/bin
51 sed "s|__DEV_NAME__|`basename $(dev_path)`|" $(driver_module_dir)/$(module_name).sh | \
52 sed "s|__DEV_DIR__|`dirname $(dev_path)`|" > \
53 $(prefix)/$(module_name).sh ; chmod +x $(prefix)/$(module_name).sh ; \
54 chmod +x $(driver_module_dir)/patchko.sh ; \
55 chmod +x $(driver_module_dir)/insmod.sh ;