diff --git a/util/scripts/convert.sh b/util/scripts/convert.sh new file mode 100755 index 0000000000..b08d3178c7 --- /dev/null +++ b/util/scripts/convert.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# This file is part of the coreboot project. +# +# Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. +# +# Use this file to convert intel microcode represented as an assembler source +# (with `dd h' in each line) into a C source (each number +# represented as `0x, ', four per line. +# +# convert.sh 'intel asm file' > 'coreboot C file' +# + +awk ' +BEGIN { n = 0 }; +{ sub(";.*", ""); } + /^dd / { + sub ("^dd 0","dd "); + sub ("h.*$","", $2); + printf (" 0x%s,", $2); + n = n + 1; + if (n ==4) { + printf ("\n"); + n = 0; + } +}' $1 diff --git a/util/scripts/xml_converter.sh b/util/scripts/xml_converter.sh new file mode 100755 index 0000000000..e783392bc7 --- /dev/null +++ b/util/scripts/xml_converter.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script is a filter processing XML files. +# +# Processing is as follows: +# +# - get rid of DOS line ends; +# - place each opening tag on a separate line, with no leading spaces and the +# first attribute definition following the tag name; +# - place each attribute definition on a separate line, starting with a space; +# +# usage: +# xml_converter.sh '' > '' +# +cat $1 | sed 's/>\n