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