Wrap /lib/fel-load.sh as function

This commit is contained in:
hzy 2022-10-09 01:22:26 +08:00 committed by Igor Pečovnik
parent a4a4cc385f
commit e8ab9e73d0
2 changed files with 26 additions and 24 deletions

View File

@ -74,27 +74,29 @@ fel_load() {
write 0x43100000 "${FEL_ROOTFS}"/boot/boot.scr
}
if [[ -f $USERPATCHES_PATH/fel-hooks.sh ]]; then
display_alert "Using additional FEL hooks in" "userpatches/fel-hooks.sh" "info"
# shellcheck source=/dev/null
source "$USERPATCHES_PATH"/fel-hooks.sh
fi
function start_fel_boot() {
if [[ -f $USERPATCHES_PATH/fel-hooks.sh ]]; then
display_alert "Using additional FEL hooks in" "userpatches/fel-hooks.sh" "info"
# shellcheck source=/dev/null
source "$USERPATCHES_PATH"/fel-hooks.sh
fi
# basic sanity check
if [[ -n $FEL_ROOTFS ]]; then
fel_prepare_host
fel_prepare_target
[[ $(type -t fel_post_prepare) == function ]] && fel_post_prepare
RES=b
while [[ $RES != q ]]; do
if [[ $FEL_AUTO != yes ]]; then
display_alert "Connect device in FEL mode and press" "<Enter>" "info"
read -r
fi
fel_load
display_alert "Press any key to boot again, <q> to finish" "FEL" "info"
read -r -n 1 RES
echo
done
service nfs-kernel-server restart
fi
# basic sanity check
if [[ -n $FEL_ROOTFS ]]; then
fel_prepare_host
fel_prepare_target
[[ $(type -t fel_post_prepare) == function ]] && fel_post_prepare
RES=b
while [[ $RES != q ]]; do
if [[ $FEL_AUTO != yes ]]; then
display_alert "Connect device in FEL mode and press" "<Enter>" "info"
read -r
fi
fel_load
display_alert "Press any key to boot again, <q> to finish" "FEL" "info"
read -r -n 1 RES
echo
done
service nfs-kernel-server restart
fi
}

View File

@ -100,7 +100,7 @@ PRE_INSTALL_DISTRIBUTION_SPECIFIC
if [[ $ROOTFS_TYPE == fel ]]; then
FEL_ROOTFS=$SDCARD/
display_alert "Starting FEL boot" "$BOARD" "info"
source $SRC/lib/fel-load.sh
start_fel_boot
else
prepare_partitions
create_image