mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
rocknix: add updateabl script
This commit is contained in:
43
projects/ROCKNIX/packages/rocknix/sources/scripts/updateabl
Executable file
43
projects/ROCKNIX/packages/rocknix/sources/scripts/updateabl
Executable 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."
|
||||
Reference in New Issue
Block a user