Files
makronix/mobile/tools/check.sh
T
lotherkandClaude Sonnet 5.5 73c9de51a6 licence: the CNCL line in every file Makronix wrote (tools, docs, www, mobile, top level)
consmirror.c: the BSD notice is replaced (Makronix's own file).  Files with
changes of other sessions pending are left for their commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 11:50:26 +00:00

27 lines
838 B
Bash

#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# Verify the pinned inputs of a device: the DTB and the initramfs must be the
# ones the baseline was built from. A device without a pin is not checked.
#
# Usage: check.sh DEVICEDIR INITRAMFS
set -eu
. "$(dirname "$0")/lib.sh"
[ $# -eq 2 ] || { echo "usage: $0 DEVICEDIR INITRAMFS" >&2; exit 2; }
load_device "$1"
initramfs=$2
pin() { # pin NAME FILE EXPECTED
[ -n "$3" ] || return 0
_got=$(sha256sum "$2" | cut -c1-16)
[ "$_got" = "$3" ] || die "$1 is $_got, pinned $3 ($2)"
}
# a DTB built from the kernel tree (KERNEL_DTB) is pinned by the tree's
# commit and patches, a binary one (DTB) by its hash
[ -z "${DTB:-}" ] || pin dtb "$DTB" "${DTB_SHA256_PREFIX:-}"
pin initramfs "$initramfs" "${INITRAMFS_SHA256_PREFIX:-}"
echo "pins ok"