Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a custom toolchain for customized use (project-chip#8077)
* add a linux_arm toolchain for customized use This tool chain is targeted to Linux running on ARM SoC, because there is a demand of running some of the example tools like "chip-tool" on embeded linux device instead of on Linux laptop. If the target_os is linux and the target_cpu is "arm" or "arm64", this toolchain will be used. It is similar to the "CROSS_COMPILE" when build kernel, a build arg named "linux_arm_cross_compile" need to be specified also, it should be a path to the cross compile tools. Take the embedded linux SDK into consideration, other build args to specify in the command line includes: * target_os * target_cpu * arm_arch * target_cflags * target_ldflags * etc. And the pkg-config tool need below two enviroment to be well set to correctly find the include path: * PKG_CONFIG_SYSROOT_DIR * PKG_CONFIG_LIBDIR A demo command to generate ninja files are listed below, the content in angle brackets need to be updated with developer's local env. PKG_CONFIG_SYSROOT_DIR=<embedded_linux_sdk_sysroot> \ PKG_CONFIG_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}/usr/lib/pkgconfig:${PKG_CONFIG_SYSROOT_DIR}/usr/share/pkgconfig \ gn gen out out/aarch64 --args='target_os="linux" target_cpu="arm64" arm_arch="armv8-a" target_cflags=[ "--sysroot=<embedded_linux_sdk_sysroot>" ] target_ldflags=[ "--sysroot=<embedded_linux_sdk_sysroot>" ] linux_arm_cross_compile="<path_to_cross_compile_tools>"' Change-Id: Id4b7b4932e16fcc42d77af7020ebb6a7133e237b Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com> * Restyled by gn * rename the linux_arm toolchain as custom toolchain The original linux_arm toolchain is not arm specific, it's just a customizable toolchain. rename it as custom. Do not use this toolchain based on the target_cpu and target_os, use build argument "custom_toolchain" to specify this toolchain. For example, to build with tools in NXP i.MX 8M yocto release SDK, the command to generate ninja files can be: PKG_CONFIG_SYSROOT_DIR=<sdk_root_dir> \ PKG_CONFIG_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}/usr/lib/pkgconfig:${PKG_CONFIG_SYSROOT_DIR}/usr/share/pkgconfig \ gn gen out/aarch64 --args='target_os="linux" target_cpu="arm64" arm_arch="armv8-a" import("//build_overrides/build.gni") target_cflags=[ "--sysroot=<sdk_root_dir>" ] target_ldflags=[ "--sysroot=<sdk_root_dir>" ] custom_toolchain="${build_root}/toolchain/custom" target_cc="<gcc_in_sdk>" target_cxx="<g++_in_sdk>" target_ar="<ar_in_sdk>"' Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com> Co-authored-by: Restyled.io <commits@restyled.io>
- Loading branch information