安卓10以后rk的一套源码兼容很多板型,多种cpu型号都兼容了,这一点相比之前省心了很多,所以就诞生了需要一套代码兼容多种板子的需求,定制修改中需要经常修改系统属性,通过以下脚本一次实现:
#!/bin/bashfunction gettop
{local TOPFILE=build/make/core/envsetup.mkif [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then# The following circumlocution ensures we remove symlinks from TOP.(cd $TOP; PWD= /bin/pwd)elseif [ -f $TOPFILE ] ; then# The following circumlocution (repeated below as well) ensures# that we record the true directory name and not one that is# faked up with symlink names.PWD= /bin/pwdelselocal HERE=$PWDlocal T=while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do\cd ..T=`PWD= /bin/pwd -P`done\cd $HEREif [ -f "$T/$TOPFILE" ]; thenecho $Tfififi
}function get_build_var()
{if [ "$BUILD_VAR_CACHE_READY" = "true" ]theneval "echo \"\${var_cache_$1}\""returnfilocal T=$(gettop)if [ ! "$T" ]; thenecho "Couldn't locate the top of the tree. Try setting TOP." >&2returnfi(\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1)
}product=$(get_build_var PRODUCT_MODEL)echo "product=" $product find device/ -name $product.mk |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.navibar = 0'find device/ -name $product.mk |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.statusbar = 0'find device/ -name $product.mk |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.statebarslide = 0'find device/ -name $product.mk |xargs sed -i '$a PRODUCT_PROPERTY_OVERRIDES += persist.sys.usb.config=mtp'