Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/25546 )
Change subject: util/scripts/ucode_h_to_bin.sh: Accept microcode in INC format ......................................................................
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(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
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