Build Linux Perf for MIPS
The perf tool has been tested with ingenic T40.
Make toolchain
configs/ingenic_t40_defconfig
# Target options
BR2_mipsel=y
BR2_mips_xburst=y
# BR2_MIPS_SOFT_FLOAT is not set
BR2_MIPS_FP32_MODE_64=y
# Build options
BR2_SHARED_STATIC_LIBS=y
# Security Hardening
BR2_PIC_PIE=y
BR2_SSP_STRONG=y
BR2_RELRO_FULL=y
BR2_FORTIFY_SOURCE_1=y
#
# Toolchain
#
BR2_TOOLCHAIN=y
BR2_TOOLCHAIN_USES_GLIBC=y
# Toolchain Buildroot Options
BR2_TOOLCHAIN_BUILDROOT_VENDOR="buildroot"
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_KERNEL_HEADERS_5_15=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
# Glibc Options
BR2_PACKAGE_GLIBC_KERNEL_COMPAT=y
# GCC Options
BR2_GCC_VERSION_10_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
#
# Host GDB Options
#
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_HOST_GDB_TUI=y
BR2_PACKAGE_HOST_GDB_PYTHON3=y
# Toolchain Buildroot Options
BR2_INIT_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_BINUTILS=y
BR2_PACKAGE_ELFUTILS=y
BR2_PACKAGE_LIBUNWIND=y
BR2_PACKAGE_POPT=y
make ingenic_t40_defconfig && make sdk
Build perf
cd linux-6.1.68/tools/perf
export MIPSEL_SYSROOT=/usr/local/mips/mipsel-buildroot-linux-gnu/mipsel-buildroot-linux-gnu/sysroot
make ARCH=mips CROSS_COMPILE=mipsel-linux- CFLAGS="--sysroot=${MIPSEL_SYSROOT}"
[...]
Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... libbfd: [ on ]
... libbfd-buildid: [ on ]
... libcap: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ OFF ]
file perf
perf: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, with debug_info, not stripped