Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
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>
---
M util/scripts/ucode_h_to_bin.sh
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/util/scripts/ucode_h_to_bin.sh b/util/scripts/ucode_h_to_bin.sh
index f08b053..436c0fd 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 @@
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

To view, visit change 25546. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3c716e5ad42e55ab3a3a67de1e9bf10e58855540
Gerrit-Change-Number: 25546
Gerrit-PatchSet: 4
Gerrit-Owner: Lev
Gerrit-Reviewer: Huang Jin <huang.jin@intel.com>
Gerrit-Reviewer: Lev
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-Reviewer: York Yang <yyang024@gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Martin Roth <martinroth@google.com>
Gerrit-CC: Piotr Król <piotr.krol@3mdeb.com>
Gerrit-MessageType: merged