imx6Q 4.1.15 Kgtp support

1) Kgtp介绍
    Kgtp项目主页是:http://code.google.com/p/kgtp/
    如其项目主页所描述,Kgtp是一个实时且轻量级的Linux跟踪内核调试工具。也许说是一个内核跟踪调试接口更合适,通过它来连通内核和GDB,使得GDB可以对内核进行跟踪调试。GDB既可以是在本机,也可以在另外一台机器上,甚至还可以进行离线调试,而这些感觉应该都是GDB本身提供的Targets、Trace Files等功能,而Kgtp主要还是进行内核调试信息的收集与交互、导出等,当然,Kgtp可能也会提供一些其它辅助GDB的功能。

2) 内核源代编译,添加Kprobes、Uprobes支持
make menuconfig ARCH=arm
enable CONFIG_KPROBES=y and CONFIG_UPROBES=y
make (build kernel src code)

  3) GTP LKM编译
  vim kgtp topdir Makefile
  KERNELVERSION := 4.1.15
  KERNELDIR := /home/jiujin/linux/
  CROSS_COMPILE :=/home/jiujin/workbench/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux- gnueabihf-                                                                                                              
  ARCH := arm
  vim gtp.c
  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,22))
  #define __get_cpu_var get_cpu_var
  #endif


[jiujin@kgtp]$ make
make ARCH=arm CROSS_COMPILE=/home/jiujin/workbench/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -C /work/aosp/kernel_imx/ M=/home/jiujin/workbench/kgtptools/kgtp modules
make[1]: Entering directory '/work/aosp/kernel_imx'
  CC [M]  /home/jiujin/workbench/kgtptools/kgtp/gtp.o
/home/jiujin/workbench/kgtptools/kgtp/gtp.c: In function ‘gtp_task_pt_regs_get_val’:
/home/jiujin/workbench/kgtptools/kgtp/gtp.c:2008:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  *val = (int64_t)task_pt_regs(get_current());
         ^
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/jiujin/workbench/kgtptools/kgtp/gtp.mod.o
  LD [M]  /home/jiujin/workbench/kgtptools/kgtp/gtp.ko
make[1]: Leaving directory '/work/aosp/kernel_imx'
/home/jiujin/workbench/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -O2 -static -o getmod getmod.c
/home/jiujin/workbench/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -O2 -static -o getframe getframe.c
/home/jiujin/workbench/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -O2 -static -o putgtprsp putgtprsp.c




posted on 2018-01-11 16:45  hongjiujing  阅读(170)  评论(0编辑  收藏  举报

导航