From 69a88ddb5d2f7e783f5dbe93e7dcf4594d245aca Mon Sep 17 00:00:00 2001 From: Bartek Pastudzki Date: Fri, 6 Apr 2018 12:40:09 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/25546 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/scripts/ucode_h_to_bin.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'util') 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 \"\"\n" "$0" + printf "Usage: %s \"\"\\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 -- cgit v1.2.3