update flash scripts to always flash active slot (#264)

* update flash scripts

* flash active slot

* more descriptive ending message
This commit is contained in:
Andrei Radulescu
2024-07-30 20:51:47 +03:00
committed by GitHub
parent 372633b7ba
commit e85baea994
2 changed files with 23 additions and 12 deletions
+12 -7
View File
@@ -1,14 +1,19 @@
#!/bin/bash
set -e
GREEN="\033[0;32m"
NO_COLOR='\033[0m'
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR
echo "Flashing kernel..."
tools/edl w boot_a output/boot.img
tools/edl w boot_b output/boot.img
echo "Checking active slot..."
ACTIVE_SLOT=$(tools/edl getactiveslot | grep "Current active slot:" | awk '{print $NF}')
echo -e "${GREEN}Flashed boot_a and boot_b!${NO_COLOR}"
if [[ "$ACTIVE_SLOT" != "a" && "$ACTIVE_SLOT" != "b" ]]; then
echo "Invalid active slot: '$ACTIVE_SLOT'"
exit 1
fi
echo "Active slot: $ACTIVE_SLOT"
echo "Flashing boot_$ACTIVE_SLOT..."
tools/edl w boot_$ACTIVE_SLOT $DIR/output/boot.img
echo "Flashed boot_$ACTIVE_SLOT!"
+11 -5
View File
@@ -4,12 +4,18 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR
echo "Flashing system..."
tools/edl w system_a $DIR/output/system-skip-chunks.img
echo "Checking active slot..."
ACTIVE_SLOT=$(tools/edl getactiveslot | grep "Current active slot:" | awk '{print $NF}')
tools/edl setactiveslot a
tools/edl setbootablestoragedrive 1
if [[ "$ACTIVE_SLOT" != "a" && "$ACTIVE_SLOT" != "b" ]]; then
echo "Invalid active slot: '$ACTIVE_SLOT'"
exit 1
fi
echo "Active slot: $ACTIVE_SLOT"
echo "Flashing system_$ACTIVE_SLOT..."
tools/edl w system_$ACTIVE_SLOT $DIR/output/system.img
tools/edl reset
echo "Done!"
echo "Flashed system_$ACTIVE_SLOT!"