mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-06-08 02:54:40 +08:00
migrate flash scripts from edl to qdl.js (#544)
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,7 +15,4 @@ qcom_xbl/
|
||||
|
||||
.vscode
|
||||
|
||||
edl_config.json
|
||||
tools/edl_repo/
|
||||
|
||||
edk2_tici/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!"
|
||||
|
||||
@@ -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!"
|
||||
|
||||
56
tools/edl
56
tools/edl
@@ -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
|
||||
#
|
||||
################################################################################
|
||||
15
tools/qdl
Executable file
15
tools/qdl
Executable file
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user