util/scripts/ucode_h_to_bin.sh: Accept microcode in INC format

Intel supplies microcode (at least for MinnowBoard) in Intel Assembly
*.inc format rather than C header. This change allow to pass in
configuration directory with *.inc files rather than list of *.h
files.

Change-Id: I3c716e5ad42e55ab3a3a67de1e9bf10e58855540
Signed-off-by: Bartek Pastudzki <Bartek.Pastudzki@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/25546
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Bartek Pastudzki 2018-04-06 12:40:09 +02:00 committed by Patrick Georgi
parent 47ac6355b3
commit 69a88ddb5d
1 changed files with 19 additions and 3 deletions

View File

@ -30,7 +30,7 @@
#
if [ -z "$1" ] || [ -z "$2" ]; then
printf "Usage: %s <output file> \"<microcode .h files>\"\n" "$0"
printf "Usage: %s <output file> \"<microcode .h files>\"\\n" "$0"
fi
OUTFILE=$1
@ -40,8 +40,24 @@ cat > "${TMPFILE}.c" << EOF
unsigned int microcode[] = {
EOF
for UCODE in ${@:2}; do
echo "#include \"$UCODE\"" >> "${TMPFILE}.c"
include_file() {
if [ "${1: -4}" == ".inc" ]; then
awk '{gsub( /h.*$/, "", $2 ); print "0x" $2 ","; }' "$1" \
>> "${TMPFILE}.c"
else
echo "#include \"$1\"" >> "${TMPFILE}.c"
fi
}
for UCODE in "${@:2}"; do
if [ -d "$UCODE" ]; then
for f in "$UCODE/"*.inc
do
include_file "$f"
done
else
include_file "$UCODE"
fi
done
cat >> "${TMPFILE}.c" << EOF