You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
1.7 KiB

#!/bin/bash
choices=(rv1126b rv1103b rk3576 rv1106 rk3588 rk356x rv1109 rk3562)
function usage() {
echo "Usage: source envsetup.sh"
}
function print_soc_menu() {
echo
echo "Select a soc to build rkaiq for: "
echo
local i=1
local choice
for choice in ${choices[@]}
do
echo " $i. $choice"
i=$(($i+1))
done
}
function set_isp_hw() {
unset ISP_HW_VERSION
export ISP_HW_VERSION=-DISP_HW_V${1}
unset RKAIQ_TARGET_SOC
export RKAIQ_TARGET_SOC=${2}
env | grep -q ISP_HW_VERSION && echo -e "\nSuccess !\nISP_HW_VERSION=${ISP_HW_VERSION}\nRKAIQ_TARGET_SOC=${RKAIQ_TARGET_SOC}\n" || echo "Failed !"
}
function lunch() {
local answer
if [ "$1" ]; then
answer=$1
else
print_soc_menu
echo -n "Which would you like? [rv1106] "
read answer
fi
local selection
if [ -z "$answer" ]
then
selection="rv1106"
elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
then
if [ $answer -le ${#choices[@]} ]
then
# array in zsh starts from 1 instead of 0.
if [ -n "$ZSH_VERSION" ]
then
selection=${choices[$(($answer))]}
else
selection=${choices[$(($answer-1))]}
fi
fi
else
selection=$answer
fi
case $selection in
rv1126b)
set_isp_hw 35 $selection
;;
rv1103b)
set_isp_hw 33 $selection
;;
rk3576)
set_isp_hw 39 $selection
;;
rk3562)
set_isp_hw 32_LITE $selection
;;
rv1106)
set_isp_hw 32 $selection
;;
rk3588)
set_isp_hw 30 $selection
;;
rk356x)
set_isp_hw 21 $selection
;;
rv1109)
set_isp_hw 20 $selection
;;
*)
echo "Not supported SoC yet!"
usage
;;
esac
}
lunch $1