aosp 10 envsteup.sh 分析
本文是参考 http://www.ramlife.org/2021/09/08/407.html 在 android 10 源码上面对 envsetup.sh
进行初步分析。
envsetup.sh
envsetup.sh
链接位置在 build/envsetup.sh
,真实位置是 build/make/envsetup.sh
。
在脚本中,能够看到有很多函数,最下面直接调用的只有三个函数:
validate_current_shell
source_vendorsetup
addcompletions
validate_current_shell
validate_current_shell
中功能很简单,函数名称也能够看出来,检测当前的 shell
是哪种,通过 local current_sh="$(ps -o command -p $$)"
获取当前的 bash 程序,我使用的是 bash
,所以这个变量获取到的是 COMMAND -bash
, 所以执行 function check_type() { type -t "$1"; }
.
type
命令属于 bash
内建命令,-t选项显示参数指定类型信息。会打印字符串:alias, keyword, function, builtin, or file
# type -t gcc
file
#type -t cd
builtin
#type -t ll
alias
# type -t if
keyword
#type -t print
参考:
bash内建命令type简介
https://blog.csdn.net/hanzhen1135/article/details/48340097
source_vendorsetup
看函数名称,应该是执行厂商的配置。
allowed=
for f in $(find -L device vendor product -maxdepth 4 -name 'allowed-vendorsetup_sh-files' 2>/dev/null | sort); do
if [ -n "$allowed" ]; then
echo "More than one 'allowed_vendorsetup_sh-files' file found, not including any vendorsetup.sh files:"
echo " $allowed"
echo " $f"
return
fi
allowed="$f"
done
上面在 device
, vendor
, product
三个文件夹中,向下找 4层路径,找名字是 'allowed-vendorsetup_sh-files' 的文件, -L
表示是链接的时候,去源文件那边去找,而不是链接本身。我们实际运行的时候,allowed
为空。
参考:
Linux基础:文件查找find命令详细讲解
http://www.manongjc.com/article/19084.html
allowed_files=
[ -n "$allowed" ] && allowed_files=$(cat "$allowed")
for dir in device vendor product; do
for f in $(test -d $dir && \
find -L $dir -maxdepth 4 -name 'vendorsetup.sh' 2>/dev/null | sort); do
if [[ -z "$allowed" || "$allowed_files" =~ $f ]]; then
echo "including $f"; . "$f"
else
echo "ignoring $f, not in $allowed"
fi
done
done
上面这段代码是在 device
, vendor
, product
三个文件夹下面,找四层,找 'vendorsetup.sh',找到之后,先判断 allowed
是零,或者 allowed_files
符合 $f
这个正则的模型,然后就会 include
进去,在运行 . $f
意思是再 source $f
。
最终输出就是:
including vendor/qcom/opensource/core-utils/vendorsetup.sh
including vendor/qcom/proprietary/common/vendorsetup.sh
including vendor/qcom/proprietary/prebuilt_HY11/vendorsetup.sh
*****Could not create symlink*******
sdk/current/androidx-README.md::frameworks/support/README.md
vendor/qcom/opensource/core-utils/build.sh::build.sh
****************END******************
Created 85 symlinks out of 87 mapped links..
vendor/qcom/opensource/core-utils/vendorsetup.sh
这个脚本里面只有一句:
export QTI_BUILDTOOLS_DIR=$(dirname ${BASH_SOURCE[0]})
BASH_SOURCE[0] 等价于 BASH_SOURCE ,取得当前执行的 shell 文件所在的路径及文件名。dirname 去除文件名中的非目录部分,仅显示与目录有关的部分。
所以这句的意思是 QTI_BUILDTOOLS_DIR
这个值就是 vendorsetup.sh
当前目录的值了。
参考:
Shell中的BASH_SOURCE
https://blog.csdn.net/lizhiqiang1217/article/details/94737535
vendor/qcom/proprietary/common/vendorsetup.sh
这个脚本里面是:
export QCPATH="$(pwd)/vendor/qcom/proprietary"
export QCPATH_COMMONSYS="${QCPATH}/commonsys"
export SDCLANG_AE_CONFIG="${QCPATH}/common-noship/etc/sdclang.json"
export SDCLANG_CONFIG="${QCPATH}/common/config/sdclang.json"
export SDCLANG_CONFIG_AOSP="${QCPATH}/common/config/sdclang-pureAOSP.json"
if [ -f "${QCPATH}/qrsp/mpgen/mpgen.py" ]; then
export RTIC_MPGEN="python ${QCPATH}/qrsp/mpgen/mpgen.py"
fi
对这些变量进行赋值,并 export 出来。
vendor/qcom/proprietary/prebuilt_HY11/vendorsetup.sh
脚本内容:
links_dir="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
links_path="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))/links"
sys_links_path="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))/system_links"
ven_links_path="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))/vendor_links"
failed_links=""
count=0
if [[ -f "$links_path" || -f "$sys_links_path" || -f "$ven_links_path" ]];then
total_links=$(cat $links_dir/*links| wc -l)
for i in $(cat $links_dir/*links);do
src=$(echo $i | awk -F:: '{print $1}')
dest=$(echo $i | awk -F:: '{print $2}')
if [ -e "$dest" ];then
rm -rf $dest
fi
if [[ -e $src && ! -e $dest ]];then
mkdir -p $(dirname $dest)
ln -srf $src $dest
count=$(($count + 1))
else
failed_links="$failed_links $i"
fi
done
if [ ! -z "$failed_links" ];then
echo "*****Could not create symlink*******"
echo $failed_links | sed 's/[[:space:]]/\n/g'
echo "****************END******************"
fi
echo "Created $count symlinks out of $total_links mapped links.."
fi
readlink
用于得出链接的真实路径,-e
是递归的读取. 就是为了获得真正的 vendorsetup.h
所在的文件夹。
cat $links_dir/*links | wc -l
指的是统计 links_dir
文件夹下所有的 *links
,看里面有多少个换行符,也就是有多少行。
然后就是简单的把源文件通过软连接链接到目的路径。ln -srf
意思是如果目的地有软连接就强制删除,并且这个软连接是相对位置的软连接,而不是绝对位置的软连接。
把这个文件中链接部分增加了打印信息,结果如下:
total links: 87
build/make/CleanSpec.mk::build/CleanSpec.mk
---> src: build/make/CleanSpec.mk
<--- dest: build/CleanSpec.mk
======
build/make/buildspec.mk.default::build/buildspec.mk.default
---> src: build/make/buildspec.mk.default
<--- dest: build/buildspec.mk.default
======
build/make/core::build/core
---> src: build/make/core
<--- dest: build/core
======
build/make/envsetup.sh::build/envsetup.sh
---> src: build/make/envsetup.sh
<--- dest: build/envsetup.sh
======
build/make/target::build/target
---> src: build/make/target
<--- dest: build/target
======
build/make/tools::build/tools
---> src: build/make/tools
<--- dest: build/tools
======
build/soong/root.bp::Android.bp
---> src: build/soong/root.bp
<--- dest: Android.bp
======
build/soong/bootstrap.bash::bootstrap.bash
---> src: build/soong/bootstrap.bash
<--- dest: bootstrap.bash
======
sdk/current/androidx-README.md::frameworks/support/README.md
---> src: sdk/current/androidx-README.md
<--- dest: frameworks/support/README.md
======
vendor/codeaurora/commonsys/packages/apps/SoundRecorder/app_qtiSoundRecorder_system_product.mk::vendor/qcom/defs/product-defs/system/app_qtiSoundRecorder_product.mk
---> src: vendor/codeaurora/commonsys/packages/apps/SoundRecorder/app_qtiSoundRecorder_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/app_qtiSoundRecorder_product.mk
======
vendor/qcom/proprietary/qdssagent/qdssagent-ship-vendor-product.mk::vendor/qcom/defs/product-defs/legacy/qdssagent-ship-vendor-product.mk
---> src: vendor/qcom/proprietary/qdssagent/qdssagent-ship-vendor-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/qdssagent-ship-vendor-product.mk
======
device/qcom/common/generate_extra_images.mk::vendor/qcom/build/tasks/generate_extra_images.mk
---> src: device/qcom/common/generate_extra_images.mk
<--- dest: vendor/qcom/build/tasks/generate_extra_images.mk
======
device/qcom/common/stop_scan.mk::kernel/Android.mk
---> src: device/qcom/common/stop_scan.mk
<--- dest: kernel/Android.mk
======
device/qcom/common/stop_scan.mk::disregard/Android.mk
---> src: device/qcom/common/stop_scan.mk
<--- dest: disregard/Android.mk
======
vendor/codeaurora/commonsys/packages/apps/Mms/app_mms_system_product.mk::vendor/qcom/defs/product-defs/system/app_mms_product.mk
---> src: vendor/codeaurora/commonsys/packages/apps/Mms/app_mms_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/app_mms_product.mk
======
vendor/codeaurora/commonsys/packages/apps/SnapdragonMusic/app_snapMusic_system_product.mk::vendor/qcom/defs/product-defs/system/app_snapMusic_product.mk
---> src: vendor/codeaurora/commonsys/packages/apps/SnapdragonMusic/app_snapMusic_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/app_snapMusic_product.mk
======
vendor/qcom/proprietary/commonsys/qrdplus/sva/app_sva_system_product.mk::vendor/qcom/defs/product-defs/system/app_sva_product.mk
---> src: vendor/qcom/proprietary/commonsys/qrdplus/sva/app_sva_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/app_sva_product.mk
======
vendor/qcom/proprietary/commonsys/qrdplus/Extension/app_extension_system_product.mk::vendor/qcom/defs/product-defs/system/app_extension_product.mk
---> src: vendor/qcom/proprietary/commonsys/qrdplus/Extension/app_extension_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/app_extension_product.mk
======
hardware/qcom/gps/gps_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/gps-product-hal.mk
---> src: hardware/qcom/gps/gps_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/gps-product-hal.mk
======
hardware/qcom/gps/gps_vendor_board.mk::vendor/qcom/defs/board-defs/vendor/gps-board.mk
---> src: hardware/qcom/gps/gps_vendor_board.mk
<--- dest: vendor/qcom/defs/board-defs/vendor/gps-board.mk
======
vendor/qcom/opensource/location/gps_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/gps-product-opensource.mk
---> src: vendor/qcom/opensource/location/gps_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/gps-product-opensource.mk
======
vendor/qcom/opensource/data-ipa-cfg-mgr/ipacm_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/ipacm_vendor_product.mk
---> src: vendor/qcom/opensource/data-ipa-cfg-mgr/ipacm_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/ipacm_vendor_product.mk
======
vendor/qcom/proprietary/cne/shipcne_vendor_product.mk::vendor/qcom/defs/product-defs/legacy/shipcne_vendor_product.mk
---> src: vendor/qcom/proprietary/cne/shipcne_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/shipcne_vendor_product.mk
======
vendor/qcom/proprietary/cne/cne_vendor_product_noship.mk::vendor/qcom/defs/product-defs/legacy/cne_vendor_product_noship.mk
---> src: vendor/qcom/proprietary/cne/cne_vendor_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cne_vendor_product_noship.mk
======
vendor/qcom/proprietary/cne/cne_vendor_board_noship.mk::vendor/qcom/defs/board-defs/legacy/cne_vendor_board_noship.mk
---> src: vendor/qcom/proprietary/cne/cne_vendor_board_noship.mk
<--- dest: vendor/qcom/defs/board-defs/legacy/cne_vendor_board_noship.mk
======
vendor/qcom/proprietary/cne/cne_wqe_vendor_product_noship.mk::vendor/qcom/defs/product-defs/legacy/cne_wqe_vendor_product_noship.mk
---> src: vendor/qcom/proprietary/cne/cne_wqe_vendor_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cne_wqe_vendor_product_noship.mk
======
vendor/qcom/proprietary/cne/cne-test_vendor_product.mk::vendor/qcom/defs/product-defs/legacy/cne-test_vendor_product.mk
---> src: vendor/qcom/proprietary/cne/cne-test_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cne-test_vendor_product.mk
======
vendor/qcom/proprietary/data/data_prop_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/data_prop_vendor_product.mk
---> src: vendor/qcom/proprietary/data/data_prop_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/data_prop_vendor_product.mk
======
vendor/qcom/proprietary/qmi/qmi_data_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/qmi_data_vendor_product.mk
---> src: vendor/qcom/proprietary/qmi/qmi_data_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/qmi_data_vendor_product.mk
======
vendor/qcom/proprietary/qcril-data-hal/datamodule/module/qcril-data-product.mk::vendor/qcom/defs/product-defs/legacy/qcril-data-product.mk
---> src: vendor/qcom/proprietary/qcril-data-hal/datamodule/module/qcril-data-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/qcril-data-product.mk
======
vendor/qcom/proprietary/nqnfc-firmware/nfc_proprietary_product.mk::vendor/qcom/defs/product-defs/legacy/nfc-proprietary-product.mk
---> src: vendor/qcom/proprietary/nqnfc-firmware/nfc_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/nfc-proprietary-product.mk
======
vendor/nxp/opensource/commonsys/packages/apps/Nfc/nfc_system_product.mk::vendor/qcom/defs/product-defs/legacy/nfc-system-product.mk
---> src: vendor/nxp/opensource/commonsys/packages/apps/Nfc/nfc_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/nfc-system-product.mk
======
vendor/nxp/opensource/halimpl/nfc_vendor_product.mk::vendor/qcom/defs/product-defs/legacy/nfc-vendor-product.mk
---> src: vendor/nxp/opensource/halimpl/nfc_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/nfc-vendor-product.mk
======
vendor/qcom/proprietary/ims-ship/ims_vendor_product_noship.mk::vendor/qcom/defs/product-defs/legacy/ims_vendor_product_noship.mk
---> src: vendor/qcom/proprietary/ims-ship/ims_vendor_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/ims_vendor_product_noship.mk
======
vendor/qcom/proprietary/commonsys-intf/adsprpc_ship/adsprpc_system_product.mk::vendor/qcom/defs/product-defs/system/adsprpc_system_product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/adsprpc_ship/adsprpc_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/adsprpc_system_product.mk
======
vendor/qcom/proprietary/commonsys-intf/adsprpc_ship/adsprpc_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/adsprpc_vendor_product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/adsprpc_ship/adsprpc_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/adsprpc_vendor_product.mk
======
vendor/qcom/proprietary/dspservices_ship/contexthub_system_product.mk::vendor/qcom/defs/product-defs/system/contexthub_system_product.mk
---> src: vendor/qcom/proprietary/dspservices_ship/contexthub_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/contexthub_system_product.mk
======
vendor/qcom/proprietary/dspservices_ship/chre_system_product.mk::vendor/qcom/defs/product-defs/vendor/chre_system_product.mk
---> src: vendor/qcom/proprietary/dspservices_ship/chre_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/chre_system_product.mk
======
vendor/qcom/proprietary/dspservices_ship/remote_debug_agent_vendor_board.mk::vendor/qcom/defs/board-defs/vendor/remote_debug_agent_vendor_board.mk
---> src: vendor/qcom/proprietary/dspservices_ship/remote_debug_agent_vendor_board.mk
<--- dest: vendor/qcom/defs/board-defs/vendor/remote_debug_agent_vendor_board.mk
======
vendor/qcom/proprietary/cv/fastcv/cv_vendor_product.mk::vendor/qcom/defs/product-defs/legacy/cv_vendor_product.mk
---> src: vendor/qcom/proprietary/cv/fastcv/cv_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cv_vendor_product.mk
======
vendor/qcom/proprietary/cv/fastcv/cv_vendor_board.mk::vendor/qcom/defs/board-defs/legacy/cv_vendor_board.mk
---> src: vendor/qcom/proprietary/cv/fastcv/cv_vendor_board.mk
<--- dest: vendor/qcom/defs/board-defs/legacy/cv_vendor_board.mk
======
vendor/qcom/proprietary/cv/fastcv/cv_system_product.mk::vendor/qcom/defs/product-defs/legacy/cv_system_product.mk
---> src: vendor/qcom/proprietary/cv/fastcv/cv_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cv_system_product.mk
======
vendor/qcom/proprietary/securemsm/config/smcinvoke_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/smcinvoke_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/smcinvoke_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/smcinvoke_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/securemsm/config/qseecomd_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/qseecomd_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/qseecomd_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/qseecomd_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/securemsm/config/cpz_vendor_proprietary_board.mk::vendor/qcom/defs/board-defs/vendor/cpz_vendor_proprietary_board.mk
---> src: vendor/qcom/proprietary/securemsm/config/cpz_vendor_proprietary_board.mk
<--- dest: vendor/qcom/defs/board-defs/vendor/cpz_vendor_proprietary_board.mk
======
vendor/qcom/proprietary/securemsm/config/cpz_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/cpz_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/cpz_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/cpz_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/securemsm/config/keymaster_vendor_proprietary_board.mk::vendor/qcom/defs/board-defs/vendor/keymaster_vendor_proprietary_board.mk
---> src: vendor/qcom/proprietary/securemsm/config/keymaster_vendor_proprietary_board.mk
<--- dest: vendor/qcom/defs/board-defs/vendor/keymaster_vendor_proprietary_board.mk
======
vendor/qcom/proprietary/securemsm/config/keymaster_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/keymaster_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/keymaster_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/keymaster_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/securemsm/config/gp_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/gp_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/gp_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/gp_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/securemsm/config/tloc_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/tloc_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/tloc_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/tloc_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/securemsm/config/qseecom_hal_vendor_proprietary_product.mk::vendor/qcom/defs/product-defs/vendor/qseecom_hal_vendor_proprietary_product.mk
---> src: vendor/qcom/proprietary/securemsm/config/qseecom_hal_vendor_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/qseecom_hal_vendor_proprietary_product.mk
======
vendor/qcom/proprietary/commonsys/securemsm/securemsm_system_product.mk::vendor/qcom/defs/product-defs/system/securemsm_product.mk
---> src: vendor/qcom/proprietary/commonsys/securemsm/securemsm_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/securemsm_product.mk
======
vendor/qcom/proprietary/commonsys/securemsm/config/gp_system_proprietary_product.mk::vendor/qcom/defs/product-defs/system/gp_system_proprietary_product.mk
---> src: vendor/qcom/proprietary/commonsys/securemsm/config/gp_system_proprietary_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/gp_system_proprietary_product.mk
======
vendor/qcom/proprietary/commonsys/securemsm/config/qseecom_lib_system_product.mk::vendor/qcom/defs/product-defs/system/qseecom_lib_system_product.mk
---> src: vendor/qcom/proprietary/commonsys/securemsm/config/qseecom_lib_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/qseecom_lib_system_product.mk
======
vendor/qcom/proprietary/gps-release/gps_system_product.mk::vendor/qcom/defs/product-defs/system/gps-product.mk
---> src: vendor/qcom/proprietary/gps-release/gps_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/gps-product.mk
======
vendor/qcom/proprietary/gps-release/gps_system_board.mk::vendor/qcom/defs/board-defs/system/gps-board.mk
---> src: vendor/qcom/proprietary/gps-release/gps_system_board.mk
<--- dest: vendor/qcom/defs/board-defs/system/gps-board.mk
======
vendor/qcom/proprietary/gps-release/gps_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/gps-product.mk
---> src: vendor/qcom/proprietary/gps-release/gps_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/gps-product.mk
======
vendor/qcom/proprietary/commonsys-intf/bluetooth/bt-vendor-proprietary-board.mk::vendor/qcom/defs/board-defs/legacy/bt-vendor-proprietary-board.mk
---> src: vendor/qcom/proprietary/commonsys-intf/bluetooth/bt-vendor-proprietary-board.mk
<--- dest: vendor/qcom/defs/board-defs/legacy/bt-vendor-proprietary-board.mk
======
vendor/qcom/proprietary/commonsys-intf/bluetooth/bt-vendor-proprietary-product.mk::vendor/qcom/defs/product-defs/legacy/bt-vendor-proprietary-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/bluetooth/bt-vendor-proprietary-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/bt-vendor-proprietary-product.mk
======
vendor/qcom/proprietary/commonsys-intf/bluetooth/bt-system-proprietary-product.mk::vendor/qcom/defs/product-defs/legacy/bt-system-proprietary-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/bluetooth/bt-system-proprietary-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/bt-system-proprietary-product.mk
======
vendor/qcom/opensource/commonsys-intf/bluetooth/bt-commonsys-intf-legacy-board.mk::vendor/qcom/defs/board-defs/legacy/bt-commonsys-intf-legacy-board.mk
---> src: vendor/qcom/opensource/commonsys-intf/bluetooth/bt-commonsys-intf-legacy-board.mk
<--- dest: vendor/qcom/defs/board-defs/legacy/bt-commonsys-intf-legacy-board.mk
======
vendor/qcom/opensource/commonsys-intf/bluetooth/bt-system-opensource-product.mk::vendor/qcom/defs/product-defs/legacy/bt-system-opensource-product.mk
---> src: vendor/qcom/opensource/commonsys-intf/bluetooth/bt-system-opensource-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/bt-system-opensource-product.mk
======
vendor/qcom/proprietary/commonsys/voiceui/app_voiceui_system_product.mk::vendor/qcom/defs/product-defs/system/app_voiceui_product.mk
---> src: vendor/qcom/proprietary/commonsys/voiceui/app_voiceui_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/app_voiceui_product.mk
======
vendor/qcom/opensource/core-utils/build/QSSI_violators.mk::vendor/qcom/build/tasks/QSSI_violators.mk
---> src: vendor/qcom/opensource/core-utils/build/QSSI_violators.mk
<--- dest: vendor/qcom/build/tasks/QSSI_violators.mk
======
vendor/qcom/opensource/core-utils/build.sh::build.sh
---> src: vendor/qcom/opensource/core-utils/build.sh
<--- dest: build.sh
======
vendor/qcom/proprietary/qrdplus/PowerOffAlarm/app_poweroffalarm_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/app_poweroffalarm_product.mk
---> src: vendor/qcom/proprietary/qrdplus/PowerOffAlarm/app_poweroffalarm_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/app_poweroffalarm_product.mk
======
vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/telephony-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/telephony-product.mk
======
vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony-noship_system_product.mk::vendor/qcom/defs/product-defs/system/telephony-noship-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony-noship_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/telephony-noship-product.mk
======
vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony_system_product.mk::vendor/qcom/defs/product-defs/system/telephony-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/telephony-product.mk
======
vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony-intf_system_product.mk::vendor/qcom/defs/product-defs/system/telephony-intf-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony-intf_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/system/telephony-intf-product.mk
======
vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony-intf_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/telephony-intf-product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/telephony/build/telephony-intf_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/telephony-intf-product.mk
======
vendor/qcom/proprietary/commonsys/cne/cne_commonsys_system_product.mk::vendor/qcom/defs/product-defs/legacy/cne_commonsys_system_product.mk
---> src: vendor/qcom/proprietary/commonsys/cne/cne_commonsys_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cne_commonsys_system_product.mk
======
vendor/qcom/proprietary/commonsys/cne/cne_system_product_noship.mk::vendor/qcom/defs/product-defs/legacy/cne_system_product_noship.mk
---> src: vendor/qcom/proprietary/commonsys/cne/cne_system_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/cne_system_product_noship.mk
======
vendor/qcom/proprietary/commonsys/ims-ship/ims_commonsys_system_product.mk::vendor/qcom/defs/product-defs/legacy/ims_commonsys_system_product.mk
---> src: vendor/qcom/proprietary/commonsys/ims-ship/ims_commonsys_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/ims_commonsys_system_product.mk
======
vendor/qcom/proprietary/commonsys/ims-ship/ims-internal_system_product_noship.mk::vendor/qcom/defs/product-defs/legacy/ims-internal_system_product_noship.mk
---> src: vendor/qcom/proprietary/commonsys/ims-ship/ims-internal_system_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/ims-internal_system_product_noship.mk
======
vendor/qcom/proprietary/commonsys/ims-ship/ims_system_product_noship.mk::vendor/qcom/defs/product-defs/legacy/ims_system_product_noship.mk
---> src: vendor/qcom/proprietary/commonsys/ims-ship/ims_system_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/ims_system_product_noship.mk
======
vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_board.mk::vendor/qcom/defs/board-defs/legacy/data_commonsys-intf_board.mk
---> src: vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_board.mk
<--- dest: vendor/qcom/defs/board-defs/legacy/data_commonsys-intf_board.mk
======
vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_vendor_product.mk::vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_vendor_product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_vendor_product.mk
======
vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_system_product.mk::vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_system_product.mk
---> src: vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_system_product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_system_product.mk
======
vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_system_product_noship.mk::vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_system_product_noship.mk
---> src: vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_system_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_system_product_noship.mk
======
vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_vendor_product_noship.mk::vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_vendor_product_noship.mk
---> src: vendor/qcom/proprietary/commonsys-intf/data/data_commonsys-intf_vendor_product_noship.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/data_commonsys-intf_vendor_product_noship.mk
======
vendor/qcom/proprietary/mm-camera/mm-camera2/configs/camera_vendor_product.mk::vendor/qcom/defs/product-defs/vendor/camera_vendor_product.mk
---> src: vendor/qcom/proprietary/mm-camera/mm-camera2/configs/camera_vendor_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/camera_vendor_product.mk
======
vendor/qcom/proprietary/vpp/config/vpp-vendor-board.mk::vendor/qcom/defs/board-defs/legacy/vpp-board.mk
---> src: vendor/qcom/proprietary/vpp/config/vpp-vendor-board.mk
<--- dest: vendor/qcom/defs/board-defs/legacy/vpp-board.mk
======
vendor/qcom/proprietary/vpp/config/vpp-vendor-product.mk::vendor/qcom/defs/product-defs/legacy/vpp-product.mk
---> src: vendor/qcom/proprietary/vpp/config/vpp-vendor-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/vpp-product.mk
======
vendor/qcom/proprietary/configstore/configstore-product.mk::vendor/qcom/defs/product-defs/legacy/configstore-product.mk
---> src: vendor/qcom/proprietary/configstore/configstore-product.mk
<--- dest: vendor/qcom/defs/product-defs/legacy/configstore-product.mk
======
vendor/qcom/proprietary/coretech-config-vendor/thermal-engine/thermal-engine_product.mk::vendor/qcom/defs/product-defs/vendor/thermal-engine_product.mk
---> src: vendor/qcom/proprietary/coretech-config-vendor/thermal-engine/thermal-engine_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/thermal-engine_product.mk
======
vendor/qcom/proprietary/coretech-config-vendor/thermal-hal/thermal-hal_product.mk::vendor/qcom/defs/product-defs/vendor/thermal-hal_product.mk
---> src: vendor/qcom/proprietary/coretech-config-vendor/thermal-hal/thermal-hal_product.mk
<--- dest: vendor/qcom/defs/product-defs/vendor/thermal-hal_product.mk
======
参考:
linux shell readlink 获取当前脚本文件绝对路径
https://www.it610.com/article/1304474769474752512.htm
linux shell 指令 诸如-d, -f, -e之类的判断表达式简介
https://www.cnblogs.com/zrmw/p/9625727.html
shell 命令之 wc -l
https://www.cnblogs.com/drjava/p/10533649.html
ln 链接文件
https://www.codesocang.com/jquerymobile/linux/2/11.html
addcompletions
local completion_files=(
system/core/adb/adb.bash
system/core/fastboot/fastboot.bash
tools/asuite/asuite.sh
)
# Completion can be disabled selectively to allow users to use non-standard completion.
# e.g.
# ENVSETUP_NO_COMPLETION=adb # -> disable adb completion
# ENVSETUP_NO_COMPLETION=adb:bit # -> disable adb and bit completion
for f in ${completion_files[*]}; do
if [ -f "$f" ] && should_add_completion "$f"; then
. $f
fi
done
判断是否有这个文件,或者是否文件属于 ENVSETUP_NO_COMPLETION
中需要进行补全的,然后执行 adb.bash
, fastboot.bash
, asuite.sh
这些脚本文件。
在tools/asuite/asuite.sh
这个脚本文件中,包含 tradefederation/core/atest/atest_completion.sh
,这个文件也会被执行一下。
增加打印,可以看到输出结果:
complete f: system/core/adb/adb.bash
should add completion: system/core/adb/adb.bash
0
complete f: system/core/fastboot/fastboot.bash
should add completion: system/core/fastboot/fastboot.bash
0
complete f: tools/asuite/asuite.sh
should add completion: tools/asuite/asuite.sh
0
should add completion: /home/ptz/sc200r/SC200R_Android10.0_R04_r023/tools/tradefederation/core/atest/atest_completion.sh
0
should add completion: bit
0
complete -F _lunch lunch
complete -F _complete_android_module_names gomod
complete -F _complete_android_module_names m
上面是针对 lunch
这个命令 使用 _lunch
这个函数进行补全, gomod
, m
也是这样。
参考:
shell 中 basename 的简单使用
https://blog.51cto.com/sdsca/1903822
使用bash内置命令complete来实现参数补全
https://www.cnblogs.com/lyg-blog/p/14760145.html
使用Bash中Complete自动补全命令
https://blog.csdn.net/chen_fly2011/article/details/56830892