diff --git a/.gitignore b/.gitignore index 7ab197bc..6bcbf997 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,4 @@ qcom_xbl/ .vscode -edl_config.json -tools/edl_repo/ - edk2_tici/ diff --git a/flash_all.sh b/flash_all.sh index cb580af0..52f8480c 100755 --- a/flash_all.sh +++ b/flash_all.sh @@ -5,8 +5,8 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" cd $DIR for part in aop abl xbl xbl_config devcfg; do - tools/edl w ${part}_a $DIR/firmware/$part.img - tools/edl w ${part}_b $DIR/firmware/$part.img + tools/qdl flash ${part}_a $DIR/firmware/$part.img + tools/qdl flash ${part}_b $DIR/firmware/$part.img done ./flash_kernel.sh diff --git a/flash_kernel.sh b/flash_kernel.sh index 7d530c2a..8d29e1b3 100755 --- a/flash_kernel.sh +++ b/flash_kernel.sh @@ -5,7 +5,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" cd $DIR echo "Checking active slot..." -ACTIVE_SLOT=$(tools/edl getactiveslot | grep "Current active slot:" | awk '{print $NF}') +ACTIVE_SLOT=$(tools/qdl getactiveslot) if [[ "$ACTIVE_SLOT" != "a" && "$ACTIVE_SLOT" != "b" ]]; then echo "Invalid active slot: '$ACTIVE_SLOT'" @@ -14,6 +14,6 @@ fi echo "Active slot: $ACTIVE_SLOT" echo "Flashing boot_$ACTIVE_SLOT..." -tools/edl w boot_$ACTIVE_SLOT $DIR/output/boot.img +tools/qdl flash boot_$ACTIVE_SLOT $DIR/output/boot.img echo "Flashed boot_$ACTIVE_SLOT!" diff --git a/flash_system.sh b/flash_system.sh index d4c9ecbc..a3d99d21 100755 --- a/flash_system.sh +++ b/flash_system.sh @@ -5,7 +5,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" cd $DIR echo "Checking active slot..." -ACTIVE_SLOT=$(tools/edl getactiveslot | grep "Current active slot:" | awk '{print $NF}') +ACTIVE_SLOT=$(tools/qdl getactiveslot) if [[ "$ACTIVE_SLOT" != "a" && "$ACTIVE_SLOT" != "b" ]]; then echo "Invalid active slot: '$ACTIVE_SLOT'" @@ -14,8 +14,8 @@ fi echo "Active slot: $ACTIVE_SLOT" echo "Flashing system_$ACTIVE_SLOT..." -tools/edl w system_$ACTIVE_SLOT $DIR/output/system.img +tools/qdl flash system_$ACTIVE_SLOT $DIR/output/system.img -tools/edl reset +tools/qdl reset echo "Flashed system_$ACTIVE_SLOT!" diff --git a/tools/edl b/tools/edl deleted file mode 100755 index 3b5a7da7..00000000 --- a/tools/edl +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -set -e - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" -ROOT=$DIR/../ - -# just a nice wrapper around the edl python tool - -EDL_PATH=$DIR/edl_repo -VERSION="8573eba1b576305fec3a068393283143ffc34342" - -if [ ! -d "$EDL_PATH" ]; then - rm -rf $EDL_PATH - git clone https://github.com/bkerler/edl $EDL_PATH -fi - -pushd $EDL_PATH > /dev/null - -NEED_INSTALL=0 -if [ ! -d venv ]; then - python3 -m venv venv - NEED_INSTALL=1 -fi -source venv/bin/activate - -if [ "$(< .git/HEAD)" != "$VERSION" ]; then - echo "updating edl..." - git fetch origin $VERSION - git checkout $VERSION - git submodule update --depth=1 --init --recursive - NEED_INSTALL=1 -fi - -if [ "$NEED_INSTALL" -eq 1 ]; then - pip3 install -r requirements.txt -fi - -# patch in comma four USB id (https://github.com/commaai/agnos-builder/issues/533) -if ! grep -q '0x3801' $EDL_PATH/edlclient/Config/usb_ids.py; then - sed -i '/\[0x05c6, 0x9008, -1\]/a\ [0x3801, 0x9008, -1], # comma four' $EDL_PATH/edlclient/Config/usb_ids.py -fi - -popd > /dev/null - -$EDL_PATH/edl "$@" - -################################################################################ -# On M-series macs, if you get "No backend available" -# where python is installed with pyenv and libusb with brew -# try this: -# -# brew install libusb -# sudo mkdir -p /usr/local/lib -# sudo ln -s /opt/homebrew/lib/libusb-1.0.0.dylib /usr/local/lib/libusb.dylib -# -################################################################################ diff --git a/tools/qdl b/tools/qdl new file mode 100755 index 00000000..01bccd2d --- /dev/null +++ b/tools/qdl @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +if ! command -v bun &> /dev/null; then + echo "Installing bun..." >&2 + curl -fsSL https://bun.sh/install | bash >&2 + export PATH="$HOME/.bun/bin:$PATH" +fi + +QDL="bunx --bun commaai/qdl.js" + +# preload package so bunx output doesn't pollute stdout on first run +$QDL --help > /dev/null 2>&1 || true + +exec $QDL "$@"