小伙伴突然问到 androID 下交叉编译链在哪个位置,一脸发懵,所以记录一下
平台 | AndroID版本 | 内核版本 |
---|---|---|
rk3399 | androID 7.1 | 4.4 |
kernel 和androID 的编译时分为两部分 所以我们需要分为两份查看kernelrk的编译命令基本是:
cd kernel/ make ARCH=arm64 rockchip_defconfig make ARCH=arm64 rk3399-Box-rev2.img -j
2.所以我们从kernel的Makefile入手即可
VERSION = 4 #kernel版本号PATCHLEVEL = 4SUbleveL = 103EXTRAVERSION =... ifeq ($(ARCH),arm64)ifneq ($(wildcard $(srctree)/../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-androID-4.9),)CROSS_COMPILE ?= $(srctree)/../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-androID-4.9/bin/aarch64-linux-androID-endifendififeq ($(ARCH),arm)ifneq ($(wildcard $(srctree)/../prebuilts/gcc/linux-x86/arm/arm-linux-androIDeabi-4.9),)CROSS_COMPILE ?= $(srctree)/../prebuilts/gcc/linux-x86/arm/arm-linux-androIDeabi-4.9/bin/arm-linux-androIDkernel-endifendif
即kerenel的交叉编译链在 prebuilts/gcc/linux-x86/aarch64/aarch64-linux-androID-4.9/bin/aarch64-linux-androID-
AndroID
1.androID 也是使用Makefile编译的,但里面改的太多,所以不从这儿入手。
在androID 编译模块时我们通常
source build/envsetup.sh lunch 22 mmm 模块
2.所以从build/envsetup.sh入手
...function setpaths(){ .... # and in with the new prebuiltdir=$(getprebuilt) gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS) # defined in core/config.mk targetgccversion=$(get_build_var TARGET_GCC_VERSION) targetgccversion2=$(get_build_var 2ND_TARGET_GCC_VERSION) export TARGET_GCC_VERSION=$targetgccversion # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it. export ANDROID_TOolCHAIN= export ANDROID_TOolCHAIN_2ND_ARCH= local ARCH=$(get_build_var TARGET_ARCH) case $ARCH in x86) toolchaindir=x86/x86_64-linux-androID-$targetgccversion/bin ;; x86_64) toolchaindir=x86/x86_64-linux-androID-$targetgccversion/bin ;; arm) toolchaindir=arm/arm-linux-androIDeabi-$targetgccversion/bin ;; arm64) toolchaindir=aarch64/aarch64-linux-androID-$targetgccversion/bin; toolchaindir2=arm/arm-linux-androIDeabi-$targetgccversion2/bin ;; mips|mips64) toolchaindir=mips/mips64el-linux-androID-$targetgccversion/bin ;; *) echo "Can't find toolchain for unkNown architecture: $ARCH" toolchaindir=xxxxxxxxx ;; esac if [ -d "$gccprebuiltdir/$toolchaindir" ]; then export ANDROID_TOolCHAIN=$gccprebuiltdir/$toolchaindir fi ...}...
所以AndroID的交叉编译链在$gccprebuiltdir/$toolchaindir 也就是 prebuilts/gcc/linux-x86/aarch64/aarch64-linux-androID-$targetgccversion/bin
其中的$gccprebuiltdir和$targetgccversion 的变量可以从上下文赋值得到
或者在命令行使用命令得到:
~/RK3399_7.1$ get_build_var TARGET_GCC_VERSION4.9~/RK3399_7.1$ get_build_var ANDROID_GCC_PREBUILTSprebuilts/gcc/linux-x86
由上面可以看到ANDROID_TOolCHAIN也就是androID toolchain的位置
使用命令行也可以直接得到
~/RK3399_7.1$get_build_var ANDROID_TOolCHAIN /***/RK3399_7.1/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-androID-4.9/bin~/RK3399_7.1$
查看AndroID编译环境变量 多使用 get_build_var get_abs_build_var
下面时命令实现
105 # Get the exact value of a build variable. 106 function get_build_var() 107 { 108 if [ "$BUILD_VAR_CACHE_READY" = "true" ] 109 then 110 eval echo \"${var_cache_}\" 111 return 112 fi 113 114 T=$(gettop) 115 if [ ! "$T" ]; then 116 echo "Couldn't locate the top of the tree. Try setting top." >&2 117 return 118 fi 119 (\cd $T; CALLED_FROM_SETUP=true BUILD_SYstem=build/core \ 120 command make --no-print-directory -f build/core/config.mk dumpvar-) 121 }
总结 以上是内存溢出为你收集整理的rk3399 源码下查找交叉编译工具链全部内容,希望文章能够帮你解决rk3399 源码下查找交叉编译工具链所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)