侧边栏壁纸
博主头像
吾非媛

将自己工作中遇到的问题记录下来 希望可以帮助到需要的人

  • 累计撰写 23 篇文章
  • 累计创建 14 个标签
  • 累计收到 0 条评论

开始编译

吾非媛
2021-03-20 / 0 评论 / 0 点赞 / 272 阅读 / 3,246 字
温馨提示:
本文最后更新于 2021-03-20,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

到底做了什么?

编译前会进行一些环境配置
具体是文件是:

build/envsetup.sh

envsetup文件

add_lunch_combo方法

该方法主要作用是添加lunch选择项的新条目

unset LUNCH_MENU_CHOICES
function add_lunch_combo()
{
    local new_combo=$1
    local c
    for c in ${LUNCH_MENU_CHOICES[@]} ; do
        if [ "$new_combo" = "$c" ] ; then
            return
        fi
    done
    LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
}
add_lunch_combo aosp_arm-eng
add_lunch_combo aosp_arm64-eng
add_lunch_combo aosp_mips-eng
add_lunch_combo aosp_mips64-eng
add_lunch_combo aosp_x86-eng
add_lunch_combo aosp_x86_64-eng

来到文件最后,我们可以看到如下代码:

找到device,vendor,product目录下的vendorsetup

# Execute the contents of any vendorsetup.sh files we can find.
for f in `test -d device && find -L device -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \
         `test -d vendor && find -L vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \
         `test -d product && find -L product -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort`
do
    echo "including $f"
    . $f
done
unset f

addcompletions

运行结果如下:

device/asus/fugu/vendorsetup.sh
device/generic/mini-emulator-arm64/vendorsetup.sh
device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
device/generic/mini-emulator-mips64/vendorsetup.sh
device/generic/mini-emulator-mips/vendorsetup.sh
device/generic/mini-emulator-x86_64/vendorsetup.sh
device/generic/mini-emulator-x86/vendorsetup.sh
device/google/dragon/vendorsetup.sh
device/google/marlin/vendorsetup.sh
device/htc/flounder/vendorsetup.sh
device/huawei/angler/vendorsetup.sh
device/lge/bullhead/vendorsetup.sh
device/linaro/hikey/vendorsetup.sh
device/moto/shamu/vendorsetup.sh
device/rockchip/rk3399/vendorsetup.sh

然后循环执行每个文件

device/asus/fugu/vendorsetup.sh

这个文件内容比较简单,只是添加了2个lunch项目

add_lunch_combo full_fugu-userdebug
add_lunch_combo aosp_fugu-userdebug

我们回到
envsetup.sh文件

device/generic/mini-emulator-arm64/vendorsetup.sh

add_lunch_combo mini_emulator_arm64-userdebug

device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh

add_lunch_combo m_e_arm-userdebug

device/rockchip/rk3399/vendorsetup.sh

add_lunch_combo rk3399_32-userdebug
add_lunch_combo rk3399_box-userdebug
add_lunch_combo rk3399_box-user
add_lunch_combo rk3399_64-userdebug
add_lunch_combo rk3399_64-user
add_lunch_combo rk3399_mid-userdebug
add_lunch_combo rk3399_mid-user
add_lunch_combo rk3399_laptop-userdebug
add_lunch_combo rk3399_laptop-user
add_lunch_combo nanopc_t4-userdebug
add_lunch_combo nanopc_t4-user

addcompletions

寻找sdk/bash_completion目录下的*.bash文件

{
    local T dir f

    # Keep us from trying to run in something that isn't bash.
    if [ -z "${BASH_VERSION}" ]; then
        return
    fi

    # Keep us from trying to run in bash that's too old.
    if [ ${BASH_VERSINFO[0]} -lt 3 ]; then
        return
    fi

    dir="sdk/bash_completion"
    if [ -d ${dir} ]; then
        for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do
            echo "including $f"
            . $f
        done
    fi
}

sdk/bash_completion/adb.bash

sdk/bash_completion/adb.bash

该文件目的是当我输入adb相关命令时候可以进行补全。

0
博主关闭了当前页面的评论