rocknix: add updateabl script

This commit is contained in:
spycat88
2025-12-21 23:18:07 +00:00
parent 0d0c4d3d57
commit 725b686756

View File

@@ -0,0 +1,43 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX)
#
# This script will update the ABL on the internal UFS.
set -euo pipefail
case "$HW_DEVICE" in
SM8250|SM8550|SM8650)
;;
*)
echo "This script is not compatible with this device!"
exit 1
;;
esac
ELF="/usr/share/bootloader/rocknix_abl/abl_signed.elf"
ABL_A="/dev/disk/by-partlabel/abl_a"
ABL_B="/dev/disk/by-partlabel/abl_b"
# ---- Sanity checks ----
if [ ! -b "${ABL_A}" ] || [ ! -b "${ABL_B}" ]; then
echo "Error: ABL partitions not found"
exit 1
fi
# ---- Get sector size ----
SS="$(blockdev --getss "${ABL_A}")"
if [ -z "${SS}" ]; then
echo "Error: failed to get sector size"
exit 1
fi
# ---- Flash ----
echo "Updating ABL partitions..."
dd if="${ELF}" of="${ABL_A}" bs="${SS}" conv=fsync,notrunc status=none
dd if="${ELF}" of="${ABL_B}" bs="${SS}" conv=fsync,notrunc status=none
sync
echo "ABL update completed successfully."