Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions flash_kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR

if ! command -v bun &> /dev/null; then
echo "Installing bun..."
curl -fsSL https://bun.sh/install | bash
export PATH="$HOME/.bun/bin:$PATH"
fi

QDL="bunx --bun commaai/qdl.js"

echo "Checking active slot..."
ACTIVE_SLOT=$(tools/edl getactiveslot | grep "Current active slot:" | awk '{print $NF}')
ACTIVE_SLOT=$($QDL getactiveslot)

if [[ "$ACTIVE_SLOT" != "a" && "$ACTIVE_SLOT" != "b" ]]; then
echo "Invalid active slot: '$ACTIVE_SLOT'"
Expand All @@ -14,6 +22,6 @@ fi

echo "Active slot: $ACTIVE_SLOT"
echo "Flashing boot_$ACTIVE_SLOT..."
tools/edl w boot_$ACTIVE_SLOT $DIR/output/boot.img
$QDL flash boot_$ACTIVE_SLOT $DIR/output/boot.img

echo "Flashed boot_$ACTIVE_SLOT!"
14 changes: 11 additions & 3 deletions flash_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR

if ! command -v bun &> /dev/null; then
echo "Installing bun..."
curl -fsSL https://bun.sh/install | bash
export PATH="$HOME/.bun/bin:$PATH"
fi

QDL="bunx --bun commaai/qdl.js"

echo "Checking active slot..."
ACTIVE_SLOT=$(tools/edl getactiveslot | grep "Current active slot:" | awk '{print $NF}')
ACTIVE_SLOT=$($QDL getactiveslot)

if [[ "$ACTIVE_SLOT" != "a" && "$ACTIVE_SLOT" != "b" ]]; then
echo "Invalid active slot: '$ACTIVE_SLOT'"
Expand All @@ -14,8 +22,8 @@ fi

echo "Active slot: $ACTIVE_SLOT"
echo "Flashing system_$ACTIVE_SLOT..."
tools/edl w system_$ACTIVE_SLOT $DIR/output/system.img
$QDL flash system_$ACTIVE_SLOT $DIR/output/system.img

tools/edl reset
$QDL reset

echo "Flashed system_$ACTIVE_SLOT!"