| #!/bin/bash |
| |
| source /usr/lib/payload-lib.sh |
| |
| MACHINE=@MACHINE@ |
| |
| payload_status || return |
| |
| img="emmc-image-${MACHINE}.squashfs-xz.verity" |
| emmcdir="/mnt/luks-mmcblk0_fs/emmc-image/${active_half}" |
| hashfile="/usr/share/emmc-image-verity/${img}.env" |
| |
| if ! source "${hashfile}"; then |
| echo "no supported eMMC image, skip" &>2 |
| exit 0 |
| fi |
| |
| if [[ ! -f "${emmcdir}" ]]; then |
| # we probably don't want to interfere eMMC infra failure for now. |
| echo "no eMMC image is found, skip" &>2 |
| exit 0 |
| fi |
| |
| echo "Verifying eMMC image ${image}" >&2 |
| |
| veritysetup --data-block-size=$DATA_BLOCK_SIZE --hash=$HASH_ALGORITHM --hash-block-size=$HASH_BLOCK_SIZE --hash-offset=$DATA_SIZE verify "${emmcdir}/${img}" ${emmcdir}/${img} $ROOT_HASH || exit 1 |
| |
| echo "Verified eMMC image" >&2 |
| |