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 <reinauer@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/47685 Reviewed-by: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
parent
895adf9c72
commit
1b419a2c5d
2 changed files with 47 additions and 0 deletions
26
util/scripts/convert.sh
Executable file
26
util/scripts/convert.sh
Executable file
|
|
@ -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 <hex number>h' in each line) into a C source (each number
|
||||
# represented as `0x<num>, ', 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
|
||||
21
util/scripts/xml_converter.sh
Executable file
21
util/scripts/xml_converter.sh
Executable file
|
|
@ -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 '<unformatted-xml-file>' > '<formatted-xml-file>'
|
||||
#
|
||||
cat $1 | sed 's/></>\n</g;
|
||||
s/\r$//;
|
||||
s/^[\t ]\+//;
|
||||
s/" /"\n /g;
|
||||
s/^/ /;
|
||||
s/^ </</;
|
||||
/^\s*$/d;'
|
||||
Loading…
Add table
Add a link
Reference in a new issue