【rk356x】Linux Cmake如何进行交叉编译

compiler.arm.cmake

SET(GCC_PATH /work/xxx/buildroot/output/rockchip/host/bin)
SET(toolpathprefix ${GCC_PATH}/aarch64-buildroot-linux-gnu-)
set(libusb_path /work/xxx/libusb/install/lib/pkgconfig/libusb-1.0.pc)

SET(CMAKE_C_COMPILER ${toolpathprefix}gcc)
SET(CMAKE_CXX_COMPILER ${toolpathprefix}g++)
SET(CMAKE_STRIP  ${toolpathprefix}strip)
SET(CMAKE_AR ${toolpathprefix}ar)
SET(CMAKE_LD ${toolpathprefix}ld)


set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

message("path ${CMAKE_SYSROOT}")


增加script/mkarm.sh文件

#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/..

workPath="../install"

mkdir build
cd build
export CMAKE_ROOT=/usr/bin/cmake
/usr/bin/cmake ../ -DCMAKE_INSTALL_PREFIX=${workPath} -DWITH_GTK=OFF -DCMAKE_TOOLCHAIN_FILE=../compiler.arm.cmake
num=$(cat /proc/cpuinfo  | grep process | wc -l)
make -j${num} 
make install
cd -

3、直接执行脚本编译

你可能感兴趣的:(RK3568平台驱动和内核讲解,linux)