summaryrefslogtreecommitdiff
path: root/util/scripts
diff options
context:
space:
mode:
authorBartek Pastudzki <Bartek.Pastudzki@3mdeb.com>2018-04-06 12:40:09 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-03-10 20:50:12 +0000
commit69a88ddb5d2f7e783f5dbe93e7dcf4594d245aca (patch)
tree8c8b692a9f536b964026e8bf45c0b6b449dce449 /util/scripts
parent47ac6355b3f74a945392eaf670aa38941d04fd60 (diff)
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>
Diffstat (limited to 'util/scripts')
-rwxr-xr-xutil/scripts/ucode_h_to_bin.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/util/scripts/ucode_h_to_bin.sh b/util/scripts/ucode_h_to_bin.sh
index f08b053b8e..436c0fd151 100755
--- a/util/scripts/ucode_h_to_bin.sh
+++ b/util/scripts/ucode_h_to_bin.sh
@@ -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