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/ks_manager) \
28 -I$(realpath $(top_srcdir)/src/modules/kprobe) \
29 -I$(realpath $(top_srcdir)/src/modules/kprobe/arch) \
30 -I$(realpath $(top_srcdir)/src/modules/uprobe) \
31 -I$(realpath $(top_srcdir)/src/modules/us_manager)
32 extra_cflags = "$(inlude_opt) -DEC_ARCH_$(ARCH) -D__DEBUG $(memchecker) $(debug_opt) $(android_opt) $(slp_opt) $(android_app_opt) $(board_opt)"
34 #bin_SCRIPTS = patchko.sh insmod.sh
37 cp $(top_srcdir)/src/modules/kprobe/Module.symvers $(driver_module_dir)
38 $(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
40 echo "generate data for version patching <$(OBJDUMP)><$(READELF)>"
41 $(top_srcdir)/src/modules/driver/patchko.sh -g $(driver_module_dir)/$(module_name).ko $(OBJDUMP) $(READELF)
44 $(MAKE) CROSS_COMPILE=$(cross_compiler) ARCH=$(target_arch) $(AM_MAKEFLAGS) -C $(target_kernel_src) M=$(driver_module_dir) clean
48 install -m 644 $(driver_module_dir)/$(module_name).ko $(prefix)
49 install -m 644 $(driver_module_dir)/$(module_name).ko.addr $(prefix)
50 mkdir -p $(prefix)/bin/
51 install -m 755 $(driver_module_dir)/patchko.sh $(prefix)/bin/
52 install -m 755 $(driver_module_dir)/insmod.sh $(prefix)/bin/
54 sed "s|__DEV_NAME__|`basename $(dev_path)`|" $(driver_module_dir)/$(module_name).sh | \
55 sed "s|__DEV_DIR__|`dirname $(dev_path)`|" > \
56 $(prefix)/$(module_name).sh ; chmod +x $(prefix)/$(module_name).sh ; \
57 chmod +x $(driver_module_dir)/patchko.sh ; \
58 chmod +x $(driver_module_dir)/insmod.sh ;