device_google_zuma/storage/ufs_firmware_update.sh
Leo Liou ad2150d56a conf: run ufs ffu script after boot complete
The ufs script is to work for ffu preparing. If device's ufs has an
old firmware, the script will copy the valid firmware into disk and
wait for ffu update on bootloader.

Bug: 224464892
Test: full build and test ffu update
Change-Id: I4e9c3766aa79740b8497a8914ad658b8339bd5a9
Signed-off-by: Leo Liou <leoliou@google.com>
2023-01-03 13:04:10 +08:00

17 lines
554 B
Bash
Executable file

#!/vendor/bin/sh
#
# The script belongs to the feature of UFS FFU via OTA: go/p23-ffu-ota
# Its purpose is to copy the corresponding firmware into partition for UFS FFU.
ufs_dev="/dev/sys/block/bootdevice"
fw_dir="/vendor/firmware"
blk_dev="/dev/block/by-name/ufs_internal"
vendor=$(cat ${ufs_dev}/vendor | tr -d "[:space:]")
model=$(cat ${ufs_dev}/model | tr -d "[:space:]")
rev=$(cat ${ufs_dev}/rev | tr -d "[:space:]")
file=$(find ${fw_dir} -name "*${vendor}${model}${rev}*" | head -n 1)
if [ -n "$file" ]; then
dd if="$file" of=$blk_dev bs=4k
fi