coreboot/util/scripts/convert.sh
Stefan Reinauer 1b419a2c5d 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>
2013-04-12 13:18:10 -07:00

26 lines
564 B
Bash
Executable file

#!/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