File: test_vip_generation.sh

package info (click to toggle)
qdl 2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 388 kB
  • sloc: ansic: 4,810; makefile: 87; xml: 75; sh: 70
file content (42 lines) | stat: -rwxr-xr-x 1,171 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause

set -e

SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

FLAT_BUILD=${SCRIPT_PATH}/data

REP_ROOT=${SCRIPT_PATH}/..
VIP_PATH=${FLAT_BUILD}/vip
EXPECTED_DIGEST="a05e1124edbe34dc504a327544fb66572591353dc3fa25e6e7eafbe4803e63e0"
VIP_TABLE_FILE=${VIP_PATH}/DigestsToSign.bin

mkdir -p $VIP_PATH

cd $FLAT_BUILD
${REP_ROOT}/qdl --dry-run --create-digests=${VIP_PATH} \
        prog_firehose_ddr.elf rawprogram*.xml patch*.xml

if command -v sha256sum >/dev/null 2>&1; then
    shacmd="sha256sum"
elif command -v shasum >/dev/null 2>&1; then
    shacmd="shasum -a 256"
else
    echo "No SHA-256 checksum tool found (need 'sha256sum' or 'shasum')"
    exit 1
fi

actual_digest=`${shacmd} "${VIP_TABLE_FILE}" | cut -d ' ' -f1`
if [ "$actual_digest" != "${EXPECTED_DIGEST}" ]; then
	echo "Expected SHA256 digest of ${VIP_TABLE_FILE} file is ${EXPECTED_DIGEST}"
	echo "Calculated SHA256 digest of ${VIP_TABLE_FILE} file is $actual_digest"
	echo "VIP table folder contents:"
	ls -la ${VIP_PATH}
	exit 1
fi

echo "VIP tables are generated successfully and validated"

rm -r ${VIP_PATH}/*.bin
rmdir ${VIP_PATH}