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

View File

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