2023-05-31 12:47:22 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-01-31 13:45:02 +00:00
|
|
|
|
2023-08-10 11:31:51 +00:00
|
|
|
set -e
|
|
|
|
|
2023-04-14 13:12:57 +00:00
|
|
|
cd $(dirname $0)
|
|
|
|
|
2024-07-16 12:42:39 +00:00
|
|
|
BUILDVH=$(realpath ./build_vendorheader)
|
2024-07-31 15:40:17 +00:00
|
|
|
BINCTL=headertool
|
2023-05-31 12:47:22 +00:00
|
|
|
|
2023-08-10 11:31:51 +00:00
|
|
|
for arg in "$@"; do
|
|
|
|
if [ "$arg" == "--check" ]; then
|
|
|
|
CHECK="--check"
|
|
|
|
fi
|
|
|
|
if [ "$arg" == "--quiet" ]; then
|
|
|
|
QUIET="--quiet"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2024-07-16 12:42:39 +00:00
|
|
|
cd ../embed/models/
|
|
|
|
|
|
|
|
# Find directories and store them in an array
|
|
|
|
dirs=($(find . -maxdepth 1 -type d ! -name '.' | sed 's|^\./||'))
|
|
|
|
|
|
|
|
# Filter directories that have 'vendorheader' subdirectory
|
|
|
|
MODELS=()
|
|
|
|
for dir in "${dirs[@]}"; do
|
|
|
|
if [ -d "$dir/vendorheader" ]; then
|
|
|
|
MODELS+=("$dir")
|
|
|
|
fi
|
|
|
|
done
|
2023-05-31 12:47:22 +00:00
|
|
|
|
|
|
|
for MODEL in ${MODELS[@]}; do
|
2024-07-16 12:42:39 +00:00
|
|
|
cd ./$MODEL/vendorheader
|
2023-08-24 14:55:52 +00:00
|
|
|
echo "Generating vendor headers for $MODEL"
|
2023-05-31 12:47:22 +00:00
|
|
|
# construct all vendor headers
|
|
|
|
for fn in *.json; do
|
2024-04-12 12:20:32 +00:00
|
|
|
$BUILDVH $QUIET $CHECK $fn
|
2023-05-31 12:47:22 +00:00
|
|
|
done
|
2018-01-31 13:45:02 +00:00
|
|
|
|
2023-08-10 11:31:51 +00:00
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
trap "rm -rf $TMPDIR" EXIT
|
2023-05-31 12:47:22 +00:00
|
|
|
# sign dev and QA vendor header
|
2023-08-24 14:55:52 +00:00
|
|
|
for name in unsafe dev_DO_NOT_SIGN; do
|
2023-08-10 11:31:51 +00:00
|
|
|
SRC_NAME="vendorheader_${name}_unsigned.bin"
|
|
|
|
DEST_NAME="vendorheader_${name}_signed_dev.bin"
|
|
|
|
if [ ! -f "$SRC_NAME" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
cp -a vendorheader_${name}_unsigned.bin "$TMPDIR/$DEST_NAME"
|
|
|
|
$BINCTL $QUIET -D "$TMPDIR/$DEST_NAME"
|
|
|
|
if [ -n "$CHECK" ]; then
|
|
|
|
diff "$DEST_NAME" "$TMPDIR/$DEST_NAME"
|
|
|
|
fi
|
|
|
|
cp -a "$TMPDIR/$DEST_NAME" "$DEST_NAME"
|
2023-05-31 12:47:22 +00:00
|
|
|
done
|
2024-07-16 12:42:39 +00:00
|
|
|
cd ../../
|
2023-03-02 15:15:15 +00:00
|
|
|
done
|