mirror of
https://github.com/feyisay07/meta-bsp-imx8mm.git
synced 2026-09-24 14:20:07 +01:00
meta: Reengineer setup scrip
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
MACHINE=${MACHINE:-ucm-imx8m-mini}
|
||||
DISTRO=${DISTRO:-fsl-imx-xwayland}
|
||||
EULA=1
|
||||
T="../sources/meta-bsp-imx8mm/templates"
|
||||
|
||||
BD=$(cat <<< $@ | awk '$0=$NF')
|
||||
|
||||
# To append a file interactively include in the file the following line:
|
||||
#;prompt Description of the feature introduced [enabled by default yes/no]
|
||||
# To disable a file usage add the following line:
|
||||
#;DISABLE
|
||||
# Files w/o these lines are to be appended unconditionally
|
||||
|
||||
function interactive_config()
|
||||
{
|
||||
grep "^#;DISABLE" $1 && return 1
|
||||
$(sed -ne 's/^#;prompt[[:blank:]]*\(.*\)[[:blank:]]*\[.*$/\1/p' $1)
|
||||
local prompt=$(sed -ne 's/^#;prompt[[:blank:]]*\(.*\)[[:blank:]]*\[.*$/\1/p' $1)
|
||||
[[ -z "${prompt}" ]] && return 0 # unconditionally add this file to config
|
||||
|
||||
local opt_def=$(sed -ne 's/^#;prompt.*\[\(.*\)\]/\1/p' $1)
|
||||
opt_def=${opt_def:-no}
|
||||
|
||||
PS3="$prompt [${opt_def}]?"
|
||||
|
||||
local answer
|
||||
select answer in yes no default; do
|
||||
answer=${answer:-$opt_def}
|
||||
[[ "{answer}" == "default" ]] && answer=${opt_def}
|
||||
[[ $answer == yes ]] && return 0 || return 1
|
||||
done
|
||||
}
|
||||
|
||||
function add_config_from_file()
|
||||
{
|
||||
if interactive_config $1; then
|
||||
sed -e '/#;/d' $1
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -d ${BD} ]];then
|
||||
|
||||
echo "Back to the build environment ${BD}"
|
||||
. setup-environment ${BD}
|
||||
|
||||
else
|
||||
|
||||
. imx-setup-release.sh $@
|
||||
|
||||
for _d in ${T}/*; do
|
||||
_file=$(basename ${_d})
|
||||
for _f in ${_d}/*;do
|
||||
add_config_from_file ${_f} >> conf/${_file}
|
||||
done;
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -A SUPPORTED_MACHINE=([mcm-imx8m-mini]=1 [ucm-imx8m-mini]=1)
|
||||
declare -A EXTRA_MACHINE_INSTALL=([ucm-imx8m-mini]='cl-migrate-env')
|
||||
|
||||
get_meta() {
|
||||
if [[ -d ${dir} ]];then
|
||||
git -C ${dir} remote update
|
||||
git -C ${dir} pull
|
||||
else
|
||||
git clone ${url} ${branch} ${dir}
|
||||
fi
|
||||
}
|
||||
|
||||
get_meta_compulab() {
|
||||
dir="../sources/meta-compulab"
|
||||
branch="-b devel"
|
||||
url="https://github.com/compulab-yokneam/meta-compulab"
|
||||
get_meta ${url} ${branch} ${dir}
|
||||
}
|
||||
|
||||
get_meta_compulab_bsp() {
|
||||
dir="../sources/meta-compulab-bsp"
|
||||
branch="-b master"
|
||||
url="https://github.com/compulab-yokneam/meta-compulab-bsp"
|
||||
get_meta ${url} ${branch} ${dir}
|
||||
}
|
||||
|
||||
mod_bblayer() {
|
||||
# Get CompuLab Main meta layer
|
||||
get_meta_compulab
|
||||
get_meta_compulab_bsp
|
||||
# A mandatory bsp layer: kernel, u-boot, imx-boot
|
||||
cat << eof | tee -a ${BBLAYERS_CONF} > /dev/null
|
||||
BBLAYERS += " \\
|
||||
\${BSPDIR}/sources/meta-compulab \\
|
||||
\${BSPDIR}/sources/meta-compulab-bsp/meta-desktop \\
|
||||
\${BSPDIR}/sources/meta-compulab-bsp/meta-multimedia \\
|
||||
\${BSPDIR}/sources/meta-compulab-bsp/meta-graphics \\
|
||||
\${BSPDIR}/sources/meta-compulab-bsp/meta-bsp \\
|
||||
\${BSPDIR}/sources/meta-compulab-bsp/meta-devtool \\
|
||||
\${BSPDIR}/sources/meta-bsp-imx8mm \\
|
||||
"
|
||||
eof
|
||||
}
|
||||
|
||||
mod_local() {
|
||||
# Modify local.conf
|
||||
CORE_IMAGE_EXTRA_INSTALL+=" dhcp-client memtester cl-uboot cl-deploy cl-launcher cl-stest cl-camera u-boot-fw-utils imx-gpu-viv-demos"
|
||||
CORE_IMAGE_EXTRA_INSTALL+=" htop iotop tmux iperf3 wvdial"
|
||||
CORE_IMAGE_EXTRA_INSTALL+=" ${EXTRA_MACHINE_INSTALL[${MACHINE}]}"
|
||||
IMAGE_FEATURES+=" package-management ssh-server-openssh "
|
||||
cat << eof | tee -a ${LOCAL_CONF} > /dev/null
|
||||
IMAGE_INSTALL_append += "kernel-devicetree"
|
||||
CORE_IMAGE_EXTRA_INSTALL += "${CORE_IMAGE_EXTRA_INSTALL}"
|
||||
IMAGE_FEATURES += "${IMAGE_FEATURES}"
|
||||
LICENSE_FLAGS_WHITELIST = "commercial"
|
||||
PREFERRED_RPROVIDER_u-boot-fw-utils = "u-boot-imx-fw-utils"
|
||||
HOSTTOOLS += " git-lfs"
|
||||
eof
|
||||
}
|
||||
|
||||
CWD=$(pwd)
|
||||
PROGNAME=${BASH_SOURCE[0]}
|
||||
[ $(basename -- $BASH_SOURCE) == $(basename -- $0) ] && EXIT="exit" || EXIT="return"
|
||||
|
||||
if [[ $(id -u) -eq 0 ]]; then
|
||||
echo "ERROR: do not use the BSP as root. Exiting..."
|
||||
${EXIT}
|
||||
fi
|
||||
|
||||
BBLAYERS_CONF=conf/bblayers.conf
|
||||
BB_CL_CONF_DONE=conf/bb_cl_conf.done
|
||||
LOCAL_CONF=conf/local.conf
|
||||
|
||||
if ([ ! -f ${BBLAYERS_CONF} ] || [ ! -f ${LOCAL_CONF} ]);then
|
||||
cat << eom
|
||||
Warning: Files ${BBLAYERS_CONF} and ${LOCAL_CONF} not found.
|
||||
Make sure that the scritp issued at a correct location.
|
||||
eom
|
||||
${EXIT} 2
|
||||
fi
|
||||
|
||||
[[ -n ${FORCE} ]] && rm -rf ${BB_CL_CONF_DONE}
|
||||
|
||||
if [ -f ${BB_CL_CONF_DONE} ];then
|
||||
cat << eom
|
||||
Note: Already issued.
|
||||
Nothing to be done.
|
||||
eom
|
||||
${EXIT} 0
|
||||
fi
|
||||
|
||||
eval $(awk '(/MACHINE|DISTRO/)&&(gsub(/'"'"'/,"")&&($0=$1"="$NF))' ORS=";" ${LOCAL_CONF})
|
||||
|
||||
if [[ ${SUPPORTED_MACHINE[${MACHINE}]} -ne 1 ]];then
|
||||
cat << eom
|
||||
${MACHINE} is not in supported machine list.
|
||||
Error exit.
|
||||
eom
|
||||
${EXIT} 0
|
||||
fi
|
||||
|
||||
cat << eom
|
||||
Prepare: ${MACHINE}:${DISTRO} ...
|
||||
eom
|
||||
|
||||
mod_bblayer
|
||||
mod_local
|
||||
|
||||
cat << eom
|
||||
Note: Files ${BBLAYERS_CONF} and ${LOCAL_CONF} updated successfully.
|
||||
eom
|
||||
|
||||
cat << eom > ${BB_CL_CONF_DONE}
|
||||
$(date)
|
||||
eom
|
||||
|
||||
unset IMAGE_FEATURES CORE_IMAGE_EXTRA_INSTALL
|
||||
${EXIT} 0
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
MACHINE=${MACHINE:-mcm-imx8m-mini}
|
||||
DISTRO=${DISTRO:-fsl-imx-xwayland}
|
||||
EULA=1
|
||||
|
||||
. imx-setup-release.sh $@
|
||||
|
||||
declare -a ENVIRONMENT=('../sources/meta-bsp-imx8mm/tools/setup-compulab-env
|
||||
../sources/meta-bsp-imx8mm/tools/setup-user-env')
|
||||
|
||||
for env in ${ENVIRONMENT[@]};do
|
||||
[ -f ${env} ] && FORCE=Yes source ${env}
|
||||
done
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/bash -xv
|
||||
|
||||
user_local_conf=$(mktemp --dry-run --tmpdir=/tmp userXXX)
|
||||
local_conf="conf/local.conf"
|
||||
|
||||
chrome=( yes no )
|
||||
cfg_chrome() {
|
||||
if [[ $1 == "yes" ]];then
|
||||
cat << EOP >> ${user_local_conf}
|
||||
# Add Chromium
|
||||
IMAGE_INSTALL_append = \\
|
||||
"\${@bb.utils.contains('DISTRO_FEATURES', 'wayland', ' chromium-ozone-wayland', \\
|
||||
bb.utils.contains('DISTRO_FEATURES', 'x11', ' chromium-x11', \\
|
||||
'', d), d)}"
|
||||
EOP
|
||||
fi
|
||||
}
|
||||
|
||||
optee=( yes no )
|
||||
cfg_optee() {
|
||||
if [[ $1 == "yes" ]];then
|
||||
cat << EOP >> ${user_local_conf}
|
||||
MACHINE_FEATURES_append += " optee "
|
||||
EOP
|
||||
fi
|
||||
}
|
||||
|
||||
rootfs=( ro rw )
|
||||
cfg_rootfs() {
|
||||
if [[ $1 == "ro" ]];then
|
||||
cat << EOP >> ${user_local_conf}
|
||||
IMAGE_FEATURES += "read-only-rootfs"
|
||||
EOP
|
||||
fi
|
||||
}
|
||||
|
||||
declare -A ARRAYNAME=( [chrome]="yes" [rootfs]="rw" [optee]="no" )
|
||||
|
||||
cat << EOG
|
||||
--- Users' Configurations started ---
|
||||
EOG
|
||||
|
||||
for ARRAY in ${!ARRAYNAME[@]}; do
|
||||
select_string='default '
|
||||
eval array=\${${ARRAY}[@]}
|
||||
for value in ${array[@]}; do
|
||||
select_string+=${value}" "
|
||||
done # for value
|
||||
PS3="${ARRAY} configuration [ ${ARRAYNAME[${ARRAY}]} ] (Ctrl^C -- exit) : "
|
||||
select i in $select_string; do
|
||||
[[ -z ${i} ]] && echo "Invalid option -(" || case $i in
|
||||
default)
|
||||
break
|
||||
;;
|
||||
*)
|
||||
ARRAYNAME[${ARRAY}]=${i}
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done # select
|
||||
done # for ARRAY
|
||||
|
||||
for ARRAY in ${!ARRAYNAME[@]}; do
|
||||
command -v cfg_${ARRAY} &>/dev/null
|
||||
[[ $? -eq 0 ]] && cfg_${ARRAY} ${ARRAYNAME[${ARRAY}]}
|
||||
done
|
||||
|
||||
if [[ -f ${local_conf} ]] && [[ -f ${user_local_conf} ]];then
|
||||
cat << EOH >> ${local_conf}
|
||||
|
||||
# Users' Configurations
|
||||
EOH
|
||||
cat ${user_local_conf} >> ${local_conf}
|
||||
rm -f ${user_local_conf}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user