From 1b419a2c5dc65a1c9c15bb9985e5ee9af65513ce Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 9 Apr 2013 14:34:35 -0700 Subject: [PATCH] chromeos: add internal scripts to handle 3rdparty files We're using these scripts to clean up some of the files in 3rdparty. Moving 3rdparty out of the coreboot repository and into the private overlays would have required to duplicate these scripts in every overlay. Instead, move them to coreboot's util/ directory. BUG=none TEST=none needed. BRANCH=none Change-Id: Ia914a2e23b97381c0490a8a03441caf8d2a0532d Signed-off-by: Stefan Reinauer Reviewed-on: https://gerrit.chromium.org/gerrit/47685 Reviewed-by: Gabe Black --- util/scripts/convert.sh | 26 ++++++++++++++++++++++++++ util/scripts/xml_converter.sh | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 util/scripts/convert.sh create mode 100755 util/scripts/xml_converter.sh 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