Archive:

Activate CoreSight on DragonBoard 410c


I am poor and all Juno Boards in our lab are under use of fuzzing (leave fuzzing away). So I have to buy a cheap board with CoreSight support, with lab funding.

Relevant Resources

Linaro Toolchain

Linaro Replacing Kernel

Linaro fastboot Installation

Kernel Download

  • Clone kernel repository from Linaro (If you’re in China, use American proxy)
git clone http://git.linaro.org/landing-teams/working/qualcomm/kernel.git
  • Configure Kernel

Find all CoreSight related configuration and turn them on.

cd kernel
# Important, choose official distribution
git checkout origin/release/qcomlt-5.15
# Important, otherwise available .config is different
export ARCH=arm64
export CROSS_COMPILE=aarch64-none-linux-gnu-
# Configure
make defconfig
make menuconfig

Basically, all related configurations is in Kernel hacking -> arm64 Debugging -> CoreSight Tracing Support

  • Compile Kernel
make -j$(nproc) Image.gz dtbs
make -j$(nproc) modules
  • Make Image
cat arch/$ARCH/boot/Image.gz arch/$ARCH/boot/dts/qcom/apq8016-sbc.dtb > Image.gz+dtb
echo "not a ramdisk" > ramdisk.img
# Change the `root=/dev/mmcblkXpX` to our rootfs, default is `mmcblk0p14`
# If not sure, find them in Linux booting log
abootimg --create boot-db410c.img -k Image.gz+dtb -r ramdisk.img \
           -c pagesize=2048 -c kerneladdr=0x80008000 -c ramdiskaddr=0x81000000 \
           -c cmdline="root=/dev/mmcblk0p10 rw rootwait console=tty0 console=ttyMSM0,115200n8"
  • Flash Kernel Image
fastboot flash boot boot-db410c.img
  • Install Modules

Because we updated the kernel, it is likely that our modules need updating too.

# In kernel directory
mkdir db410c-modules
make modules_install INSTALL_MOD_PATH=./db410c-modules

Move the content in the folder into /lib/modules.

  • Details
    1. Insert SD Card will effect the name of rootfs and cause boot failure, remove it before booting.
    2. During my test, booting may fail, try boot again.
  • Results We can see ETM components in /sys/bus/coresight/devices
root@linaro-developer:~# ls /sys/bus/coresight/devices/
cti_cpu0  cti_cpu2  cti_sys0  etm0  etm2  funnel0  replicator0  tmc_etf0  tpiu0
cti_cpu1  cti_cpu3  cti_sys1  etm1  etm3  funnel1  stm0         tmc_etr0