Stefan Tauner (stefan.tauner(a)gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9322
-gerrit
commit d07484398ab2ae2bacc0c5bcc34d3720634abd13
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Mon Apr 6 12:40:17 2015 +0200
utils: pool together single-file scripts into a single directory
This will most probably break things - do not commit yet!
I want to get consensus about naming and what files to move at all before
fixing anything.
Shall we move gitconfig/ in there too?
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
Change-Id: I17d3f622a9c64724fe3471a92c243e6bd87ff7ca
---
util/acpi/acpidump-all | 50 -------
util/dtd_parser/dtd_parser.py | 213 ---------------------------
util/exynos/fixed_cksum.py | 59 --------
util/exynos/variable_cksum.py | 59 --------
util/find_usbdebug/find_usbdebug.sh | 149 -------------------
util/genbuild_h/genbuild_h.sh | 64 --------
util/ipqheader/ipqheader.py | 130 ----------------
util/rockchip/LICENSE | 25 ----
util/rockchip/make_idb.py | 124 ----------------
util/scripts/acpidump-all | 50 +++++++
util/scripts/dtd_parser.py | 213 +++++++++++++++++++++++++++
util/scripts/exynos_fixed_cksum.py | 59 ++++++++
util/scripts/exynos_variable_cksum.py | 59 ++++++++
util/scripts/find_usbdebug.sh | 149 +++++++++++++++++++
util/scripts/genbuild_h.sh | 64 ++++++++
util/scripts/ipqheader.py | 130 ++++++++++++++++
util/scripts/rk_make_idb.py | 150 +++++++++++++++++++
util/scripts/xcompile | 269 ++++++++++++++++++++++++++++++++++
util/xcompile/xcompile | 269 ----------------------------------
19 files changed, 1143 insertions(+), 1142 deletions(-)
diff --git a/util/acpi/acpidump-all b/util/acpi/acpidump-all
deleted file mode 100755
index aa73a15..0000000
--- a/util/acpi/acpidump-all
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2007-2010 by coresystems GmbH
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-#
-
-rm -rf out
-mkdir out
-
-# walk through all ACPI tables with their addresses
-# example:
-# RSDT @ 0xcf6794ba
-# we can not just dump the tables by their names because some
-# machines have double ACPI tables
-
-acpidump | grep "@ 0x" | while read line
-do
- NAME=$( echo `echo $line|cut -f1 -d@` )
- FNAME=$( echo $NAME | sed s/\ /_/g |sed s/\!/b/g )
- ADDR=$( echo `echo $line|cut -f2 -d@` )
- if [ "${!FNAME}" == "" ]; then
- eval $FNAME=0
- else
- eval $FNAME=$(( ${!FNAME} + 1 ))
- fi
- printf "Processing table \"$NAME\" at $ADDR ... "
- printf "${!FNAME} tables of that kind found before.\n"
-
- # acpidump -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.txt
- acpidump -b -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.bin
- if [ "`file -b out/$FNAME-$ADDR-${!FNAME}.bin`" != "ASCII text" ]; then
- iasl -d out/$FNAME-$ADDR-${!FNAME}.bin &>/dev/null
- else
- printf "Skipping $NAME because it was not dumped correctly.\n\n"
- fi
-
-done
-
diff --git a/util/dtd_parser/dtd_parser.py b/util/dtd_parser/dtd_parser.py
deleted file mode 100755
index 23cc7e7..0000000
--- a/util/dtd_parser/dtd_parser.py
+++ /dev/null
@@ -1,213 +0,0 @@
-#!/usr/bin/python
-# dtd_parser.py - DTD structure parser
-#
-# Copyright (C) 2012 The ChromiumOS Authors. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-'''
-DTD string parser/generator.
-
-Detailed timing descriptor (DTD) is an 18 byte array describing video mode
-(screen resolution, display properties, etc.) in EDID and used by Intel Option
-ROM. Option ROM can support multiple video modes, specific mode is picked by
-the BIOS through the appropriate Option ROM callback function.
-
-This program allows to interpret the 18 byte hex DTD dump, and/or modify
-certain values and generate a new DTD.
-'''
-
-import sys
-
-#
-# The DTD array format description can be found in
-# http://en.wikipedia.org/wiki/Extended_display_identification_data, (see the
-# EDID Detailed Timing Descriptor section).
-#
-# The below dictionary describes how different DTD parameters are laid out in
-# the array. Note that many parameters span multiple bit fields in the DTD.
-#
-# The keys in the dictionary are stings (field names), the values are tuples
-# of either numbers or tri-tuples. If the element of the tuple is a number, it
-# is the offset in DTD, and the entire byte is used in this field. If the
-# element is a tri-tuple, its components are (DTD offset, bit shift, field
-# width).
-#
-# The partial values are extracted from the DTD fields and concatenated
-# together to form actual parameter value.
-#
-
-dtd_descriptor = {
- 'dclck' : (1, 0),
- 'hor_active' : ((4, 4, 4), 2),
- 'hor_blank' : ((4, 0, 4), 3),
- 'vert_act' : ((7, 4, 4), 5),
- 'vert_blank' : ((7, 0, 4), 6),
- 'hsync_offset' : ((11, 6, 2), 8),
- 'hsync_pulse_width' : ((11, 4, 2), 9),
- 'vsync_offset' : ((11, 2, 2), (10, 4, 4)),
- 'vsync_pulse_width' : ((11, 0, 2), (10, 0, 4)),
- 'hor_image_size' : ((14, 4, 4), 12),
- 'vert_image_size' : ((14, 0, 4), 13),
- 'hor_border' : (15,),
- 'vert_border' : (16,),
- 'interlaced' : ((17, 7, 1),),
- 'reserved' : ((17, 5, 2), (17, 0, 1)),
- 'digital_separate' : ((17, 3, 2),),
- 'vert_polarity' : ((17, 2, 1),),
- 'hor_polarity' : ((17, 1, 1),),
- }
-
-PREFIX = 'attr_'
-
-class DTD(object):
- '''An object containing all DTD information.
-
- The attributes are created dynamically when the input DTD string is
- parsed. For each element of the above dictionary two attributes are added:
-
- 'attr_<param>' to hold the actual parameter value
- 'max_attr_<param>' to hold the maximum allowed value for this parameter.
- '''
-
- def __init__(self):
- for name in dtd_descriptor:
- setattr(self, PREFIX + name, 0)
-
- def init(self, sarray):
- '''Initialize the object with values from a DTD array.
-
- Inputs:
-
- sarray: a string, an array of ASCII hex representations of the 18 DTD
- bytes.
-
- Raises: implicitly raises ValueError or IndexError exceptions in case
- the input string has less than 18 elements, or some of the
- elements can not be converted to integer.
- '''
-
- harray = [int(x, 16) for x in sarray]
- for name, desc in dtd_descriptor.iteritems():
- attr_value = 0
- total_width = 0
- for tup in desc:
- if isinstance(tup, tuple):
- offset, shift, width = tup
- else:
- offset, shift, width = tup, 0, 8
-
- mask = (1 << width) - 1
- attr_value = (attr_value << width) + (
- (harray[offset] >> shift) & mask)
- total_width += width
- setattr(self, PREFIX + name, attr_value)
- setattr(self, 'max_' + PREFIX + name, (1 << total_width) - 1)
-
- def __str__(self):
- text = []
- for name in sorted(dtd_descriptor.keys()):
- text.append('%20s: %d' % (name, getattr(self, PREFIX + name)))
- return '\n'.join(text)
-
- def inhex(self):
- '''Generate contents of the DTD as a 18 byte ASCII hex array.'''
-
- result = [0] * 18
- for name, desc in dtd_descriptor.iteritems():
- attr_value = getattr(self, PREFIX + name)
- rdesc = list(desc)
- rdesc.reverse()
- for tup in rdesc:
- if isinstance(tup, tuple):
- offset, shift, width = tup
- else:
- offset, shift, width = tup, 0, 8
-
- mask = (1 << width) - 1
- value = attr_value & mask
- attr_value = attr_value >> width
- result[offset] = (result[offset] & ~(
- mask << shift)) | (value << shift)
-
- return ' '.join('%2.2x' % x for x in result)
-
- def handle_input(self, name):
- '''Get user input and set a new parameter value if required.
-
- Display the parameter name, its current value, and prompt user for a
- new value.
-
- If the user enters a dot, stop processing (return True).
-
- Empty user input means that this parameter does not have to change,
- but the next parameter should be prompted.
-
- If input is non-empty, it is interpreted as a hex number, checked if
- it fits the parameter and the new parameter value is set if checks
- pass.
-
- Inputs:
-
- name - a string, parameter name, a key in dtd_descriptor
-
- Returns:
-
- Boolean, True meaning no more field are required to be modified, False
- meaning that more field mods need to be prompted..
- '''
-
- param = PREFIX + name
- vmax = getattr(self, 'max_' + param)
- new_value = raw_input('%s : %d ' % (name, getattr(self, param)))
- if new_value == '':
- return False
- if new_value == '.':
- return True
- new_int = int(new_value)
- if new_int > vmax:
- print '%s exceeds maximum for %s (%d)' % (new_value, name, vmax)
- else:
- setattr(self, param, new_int)
- return False
-
-def main(args):
- if args[0] == '-m':
- modify = True
- base = 1
- else:
- modify = False
- base = 0
-
- d = DTD()
- d.init(args[base:])
- if modify:
- for line in str(d).splitlines():
- if d.handle_input(line.split(':')[0].strip()):
- break
- print d
- if modify:
- print d.inhex()
-
-
-if __name__ == '__main__':
- try:
- main(sys.argv[1:])
- except (ValueError, IndexError):
- print """
-A string of 18 byte values in hex is required.
-'-m' preceding the string will allow setting new parameter values.
-"""
- sys.exit(1)
diff --git a/util/exynos/fixed_cksum.py b/util/exynos/fixed_cksum.py
deleted file mode 100755
index 66da060..0000000
--- a/util/exynos/fixed_cksum.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2013 Google Inc.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-"""
-This utility computes and fills Exynos ROM checksum (for BL1 or BL2).
-(Algorithm from U-Boot: tools/mkexynosspl.c)
-
-Input: IN OUT DATA_SIZE
-
-Output:
-
- IN padded out to DATA_SIZE, checksum at the end, written to OUT.
-"""
-
-import struct
-import sys
-
-def main(argv):
- if len(argv) != 4:
- exit('usage: %s IN OUT DATA_SIZE' % argv[0])
-
- in_name, out_name = argv[1:3]
- size = int(argv[3], 0)
- checksum_format = "<I"
- with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
- data = in_file.read()
- checksum_size = struct.calcsize(checksum_format)
- data_size = size - checksum_size
- assert len(data) <= data_size
- checksum = struct.pack(checksum_format, sum(map(ord, data)))
- out_file.write(data + bytearray(data_size - len(data)) + checksum)
-
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/util/exynos/variable_cksum.py b/util/exynos/variable_cksum.py
deleted file mode 100755
index 75cdc74..0000000
--- a/util/exynos/variable_cksum.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2013 Google Inc.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-"""
-This utility computes and fills Exynos ROM checksum (for BL1 or BL2).
-(Algorithm from U-Boot: tools/mkexynosspl.c)
-
-Input: IN OUT
-
-Output:
-
- Checksum header added to IN and written to OUT.
- Header: uint32_t size, checksum, reserved[2].
-"""
-
-import struct
-import sys
-
-def main(argv):
- if len(argv) != 3:
- exit('usage: %s IN OUT' % argv[0])
-
- in_name, out_name = argv[1:3]
- header_format = "<IIII"
- with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
- data = in_file.read()
- header = struct.pack(header_format,
- struct.calcsize(header_format) + len(data),
- sum(map(ord, data)),
- 0, 0)
- out_file.write(header + data)
-
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/util/find_usbdebug/find_usbdebug.sh b/util/find_usbdebug/find_usbdebug.sh
deleted file mode 100755
index 2f82219..0000000
--- a/util/find_usbdebug/find_usbdebug.sh
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/sh
-
-# Copyright 2008 Carl-Daniel Hailfinger
-# Copyright 2015 Stefan Tauner
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc.
-
-LANG=C
-# Some tools emmit errors that don't matter (bugs in lspci/PCI firmware and lsusb).
-# To shown them anyway (e.g. for debugging) comment next line.
-exec 2>/dev/null
-
-if [ "$1" = "-h" ]; then
- printf "Usage: $0 [-h | path to dmesg log]
-
-This script tries to find USB ports compatible with USB2/EHCI debug devices and
-helps you to find their physical locations. To that end, attach at least one
-uniquely identifiable device to a USB port and run this script. The device needs
-to be visible in the output of \"lsusb -t\" (debug devices are often *not*!).
-
-After determining compatibility of the USB controllers the script will print the
-devices attached to the debug port as shown by lsusb. If nothing shows up simply
-switch ports and repeat the process.
-
-Note: usually only one port is supported for debugging.\n"
- exit 0
-fi
-uid=`id -u`
-if [ "$uid" -ne 0 ]; then
- echo "Must be run as root. Exiting."
- exit 1
-fi
-dmesgfile=$1
-
-find_devs_in_tree () {
- bus=$1
- port=$2
- busstr=`printf "Bus %02d" "$bus"`
- portstr="Port $port"
-
- found=
- # Iterate over the output of lsusb -t because it contains the physical port names
- while IFS='' read -r line; do
- # We need to keep track of the current bus "branch"
- # Look out for lines starting with /: (that indicate a bus)
- if [ "${line#*/:}" != "$line" ]; then
- if [ "${line#*$busstr}" != "$line" ]; then
- cur_bus=$busstr
- else
- cur_bus=
- fi
- continue
- fi
-
- # Skip all lines not belonging to the wanted bus number
- if [ "$cur_bus" != "$busstr" ]; then
- continue
- fi
-
- # check for matching physical USB port, and take only IF 0 into account
- if [ "${line#*$portstr}" != "$line" -a "${line#*If 0}" != "$line" ]; then
- dev=`echo ${line#*Dev } | cut -d ',' -f 1`
- lsusb -s "$bus":"$dev"
- found="yes"
- fi
- done<< EOF
-$(lsusb -t)
-EOF
- if [ -z "$found" ]; then
- echo "none"
- fi
-}
-
-debug_lspci_devs=`lspci -nvvD |
- grep -i "^[0-9a-f]\|debug port" |
- grep -iB1 --no-group-separator "debug port" |
- grep -vi "debug port" |
- cut -f 1 -d" " |
- sort |
- xargs echo`
-
-if [ -z "$debug_lspci_devs" ]; then
- printf "No USB controller with debug capability found by lspci.\n
-Possible reasons: lspci too old, USB controller does not support a debug device, ... Exiting.\n"
- exit 1
-fi
-printf "The following PCI devices support a USB debug port (says lspci): $debug_lspci_devs\n"
-
-debug_dmesg_devs_with_port=`( test -z "$dmesgfile" &&
- dmesg ||
- cat "$dmesgfile") |
- grep -i "ehci.*debug port" |
- sed "s/.* \([0-9a-f]*:*[0-9a-f]\{2\}:[0-9a-f]\{2\}\.[0-9a-f]\).*ebug port /\1 /" |
- sort`
-
-debug_dmesg_devs=`echo "$debug_dmesg_devs_with_port" |
- cut -f 1 -d" " |
- xargs echo`
-
-if [ -z "$debug_dmesg_devs" ]; then
- printf "dmesg does not show any supported ports.\n
-Possible reasons: dmesg scrolled off, kernel too old, USB controller does not support a debug device, ... Exiting.\n
-Note: You can specify a file containing kernel messages as an argument to this program (e.g. /var/log/dmesg)."
- exit 1
-fi
-
-if [ "$debug_lspci_devs" != "$debug_dmesg_devs" ]; then
- echo "lspci and the kernel do not agree on USB debug device support. Exiting."
- exit 1
-fi
-
-printf "and the kernel agrees, good.\n\n"
-
-while true; do
- for dev in $debug_dmesg_devs; do
- bus=`lsusb -v |
- grep "^Bus\|iSerial.*" |
- grep -B1 --no-group-separator "iSerial.*$dev" |
- grep "^Bus" |
- sed "s/Bus *0*\([0-9a-f]*\).*/\1/"`
- port=`echo "$debug_dmesg_devs_with_port" |
- grep "^$dev" |
- cut -f 2 -d" "`
-
- echo "Device(s) currently connected to the debug-capable port $port on PCI device $dev, USB bus $bus:"
-
- find_devs_in_tree $bus $port
- echo
- done
-
- echo "Enter 'q' to abort or anything else to repeat"
- read r
- if [ $? -ne 0 -o "$r" = "q" ]; then
- break;
- fi
-done
-
-return 0
diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh
deleted file mode 100755
index 55a3b85..0000000
--- a/util/genbuild_h/genbuild_h.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-
-# This file is part of the coreboot project.
-#
-# Copyright (C) 2014 Sage Electronic Engineering, LLC.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-DATE=""
-GITREV=""
-TIMESOURCE=""
-if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
- GITREV=$(LANG= git log remotes/origin/master -1 --format=format:%h)
- TIMESOURCE=git
- DATE=$(git log --pretty=format:%ct -1)
-else
- GITREV=Unknown
- TIMESOURCE="LANG= TZ=UTC date"
- DATE=$(date +%s)
-fi
-
-our_date() {
-case $(uname) in
-NetBSD|OpenBSD|DragonFly|FreeBSD)
- TZ=UTC date -r $1 $2
- ;;
-*)
- TZ=UTC date -d @$1 $2
-esac
-}
-
-#Print out the information that goes into build.h
-printf "/* build system definitions (autogenerated) */\n"
-printf "#ifndef __BUILD_H\n"
-printf "#define __BUILD_H\n\n"
-printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
-
-#See if the build is running in a git repo and the git command is available
-printf "/* timesource: $TIMESOURCE */\n"
-printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
-printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
-
-printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
-printf "#define COREBOOT_BUILD \"$(LANG= our_date "$DATE")\"\n"
-printf "#define COREBOOT_BUILD_YEAR_BCD 0x$(our_date "$DATE" +%y)\n"
-printf "#define COREBOOT_BUILD_MONTH_BCD 0x$(our_date "$DATE" +%m)\n"
-printf "#define COREBOOT_BUILD_DAY_BCD 0x$(our_date "$DATE" +%d)\n"
-printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
-printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
-printf "\n"
-printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
-printf "#endif\n"
diff --git a/util/ipqheader/ipqheader.py b/util/ipqheader/ipqheader.py
deleted file mode 100755
index eb1a316..0000000
--- a/util/ipqheader/ipqheader.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2013 The Linux Foundation. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the copyright holder nor the names of its
-# contributors may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-import os
-import struct
-import sys
-
-PROG_NAME = os.path.basename(sys.argv[0])
-
-def create_header(base, size):
- """Returns a packed MBN header image with the specified base and size.
-
- @arg base: integer, specifies the image load address in RAM
- @arg size: integer, specifies the size of the image
- @returns: string, the MBN header
- """
-
- # SBLs require size to be 4 bytes aligned.
- size = (size + 3) & 0xfffffffc
-
- # We currently do not support appending certificates. Signing GPL
- # code might violate the GPL. So U-Boot will never be signed. So
- # this is not required for U-Boot.
-
- header = [
- 0x5, # Type: APPSBL
- 0x3, # Version: 3
- 0x0, # Image source pointer
- base, # Image destination pointer
- size, # Code Size + Cert Size + Signature Size
- size, # Code Size
- base + size, # Destination + Code Size
- 0x0, # Signature Size
- base + size, # Destination + Code Size + Signature Size
- 0x0, # Cert Size
- ]
-
- header_packed = struct.pack('<10I', *header)
- return header_packed
-
-def mkheader(base_addr, infname, outfname):
- """Prepends the image with the MBN header.
-
- @arg base_addr: integer, specifies the image load address in RAM
- @arg infname: string, image filename
- @arg outfname: string, output image with header prepended
- @raises IOError: if reading/writing input/output file fails
- """
- with open(infname, "rb") as infp:
- image = infp.read()
- insize = len(image)
-
- if base_addr > 0xFFFFFFFF:
- raise ValueError("invalid base address")
-
- if base_addr + insize > 0xFFFFFFFF:
- raise ValueError("invalid destination range")
-
- header = create_header(base_addr, insize)
- with open(outfname, "wb") as outfp:
- outfp.write(header)
- outfp.write(image)
-
-def usage(msg=None):
- """Print command usage.
-
- @arg msg: string, error message if any (default: None)
- """
- if msg != None:
- sys.stderr.write("%s: %s\n" % (PROG_NAME, msg))
-
- print "Usage: %s <base-addr> <input-file> <output-file>" % PROG_NAME
-
- if msg != None:
- exit(1)
-
-def main():
- """Main entry function"""
-
- if len(sys.argv) != 4:
- usage("incorrect number of arguments")
-
- try:
- base_addr = int(sys.argv[1], 0)
- infname = sys.argv[2]
- outfname = sys.argv[3]
- except ValueError as e:
- sys.stderr.write("mkheader: invalid base address '%s'\n" % sys.argv[1])
- exit(1)
-
- try:
- mkheader(base_addr, infname, outfname)
- except IOError as e:
- sys.stderr.write("%s: %s\n" % (PROG_NAME, e))
- exit(1)
- except ValueError as e:
- sys.stderr.write("%s: %s\n" % (PROG_NAME, e))
- exit(1)
-
-if __name__ == "__main__":
- main()
-
diff --git a/util/rockchip/LICENSE b/util/rockchip/LICENSE
deleted file mode 100644
index cb4d35b..0000000
--- a/util/rockchip/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/util/rockchip/make_idb.py b/util/rockchip/make_idb.py
deleted file mode 100755
index e95f5c2..0000000
--- a/util/rockchip/make_idb.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import struct
-import sys
-from io import SEEK_SET, SEEK_END
-
-class IDBTool:
- def __init__(self):
- print "Initialize IDBTool"
-
- def p_rc4(self, buf, length):
- key = (124,78,3,4,85,5,9,7,45,44,123,56,23,13,23,17)
- K = key * 16
- S = [i for i in range(256)]
-
- j = 0
- for i in range(256):
- j = (j + S[i] + K[i]) % 256
- temp = S[i]; S[i] = S[j]; S[j] = temp;
-
- i = j = k = 0
- for x in range(length):
- i = (i+1) % 256
- j = (j + S[i]) % 256
- temp = S[i]; S[i] = S[j]; S[j] = temp
- k = (S[i] + S[j]) % 256
- buf[x] = struct.pack('B', ord(buf[x]) ^ S[k])
-
- def makeIDB(self, from_file, to_file, rc4_flag = False, align_flag = False):
- try:
- fin = open(from_file, 'rb')
- except:
- sys.exit("Failed to open file : " + from_file)
-
- try:
- fin.seek(0, SEEK_END)
- if (fin.tell() > 4 * 1024 * 1024):
- sys.exit("Input file is more than 4MB")
- fin.seek(0)
- data = fin.read()
- finally:
- fin.close()
-
- data_len = len(data)
- SECTOR_SIZE = 512
- PAGE_ALIGN = 4
- sectors = (data_len + 4 - 1) / SECTOR_SIZE + 1
- pages = (sectors - 1) / PAGE_ALIGN + 1
- sectors = pages * PAGE_ALIGN;
-
- buf = [B'\0'] * sectors * SECTOR_SIZE
- buf[:4] = "RK32"
- buf[4 : 4+data_len] = data
-
- idblock = [B'\0'] * 4 * SECTOR_SIZE
- blank = [B'\0'] * 4 * SECTOR_SIZE
- idblock[:4] = ['\x55', '\xAA', '\xF0', '\x0F']
-
- if (not rc4_flag):
- idblock[8:12] = struct.pack("<I", 1)
- else:
- for i in range(sectors):
- list_tmp = buf[SECTOR_SIZE*i : SECTOR_SIZE*(i+1)]
- self.p_rc4(list_tmp, SECTOR_SIZE)
- buf[SECTOR_SIZE*i : SECTOR_SIZE*(i+1)] = list_tmp
-
- idblock[12:16] = struct.pack("<HH", 4, 4);
- idblock[506:510] = struct.pack("<HH", sectors, sectors);
- self.p_rc4(idblock, SECTOR_SIZE)
-
- try:
- fout = open(to_file, "wb+")
- except:
- sys.exit("Failed to open output file : " + to_file)
-
- try:
- if (align_flag):
- fout.write(''.join(idblock))
- fout.write(''.join(blank))
-
- for s in xrange(0, sectors * SECTOR_SIZE, PAGE_ALIGN * SECTOR_SIZE):
- fout.write(''.join(buf[s : s + PAGE_ALIGN * SECTOR_SIZE]))
- fout.write(''.join(blank))
- else:
- fout.write(''.join(idblock))
- fout.write(''.join(buf))
- fout.flush()
- except:
- sys.exit("Failed to write data to : " + to_file)
- finally:
- fout.close()
- print "DONE"
-
-def usage():
- print "Usage: make_idb.py [--enable-rc4] [--enable-align] [--to=out] --from=in"
-
-if __name__ == '__main__':
- rc4_flag = align_flag = False
- to_file = "IDBlock.bin"
-
- for para in sys.argv[1:]:
- if (para == "--enable-rc4"):
- rc4_flag = True
- elif (para == "--enable-align"):
- align_flag = True
- elif (para.startswith("--to=")):
- to_file = para.split('=')[1]
- elif (para.startswith("--from=")):
- from_file = para.split('=')[1]
- elif (para == "--help" or para == "-h"):
- usage()
- sys.exit()
- else:
- usage()
- sys.exit()
- if ('from_file' not in vars() or to_file == ''):
- usage()
- sys.exit()
-
- idbtool = IDBTool()
- idbtool.makeIDB(from_file, to_file, rc4_flag, align_flag)
diff --git a/util/scripts/acpidump-all b/util/scripts/acpidump-all
new file mode 100755
index 0000000..aa73a15
--- /dev/null
+++ b/util/scripts/acpidump-all
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Copyright (C) 2007-2010 by coresystems GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+#
+
+rm -rf out
+mkdir out
+
+# walk through all ACPI tables with their addresses
+# example:
+# RSDT @ 0xcf6794ba
+# we can not just dump the tables by their names because some
+# machines have double ACPI tables
+
+acpidump | grep "@ 0x" | while read line
+do
+ NAME=$( echo `echo $line|cut -f1 -d@` )
+ FNAME=$( echo $NAME | sed s/\ /_/g |sed s/\!/b/g )
+ ADDR=$( echo `echo $line|cut -f2 -d@` )
+ if [ "${!FNAME}" == "" ]; then
+ eval $FNAME=0
+ else
+ eval $FNAME=$(( ${!FNAME} + 1 ))
+ fi
+ printf "Processing table \"$NAME\" at $ADDR ... "
+ printf "${!FNAME} tables of that kind found before.\n"
+
+ # acpidump -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.txt
+ acpidump -b -s ${!FNAME} --table "$NAME" > out/$FNAME-$ADDR-${!FNAME}.bin
+ if [ "`file -b out/$FNAME-$ADDR-${!FNAME}.bin`" != "ASCII text" ]; then
+ iasl -d out/$FNAME-$ADDR-${!FNAME}.bin &>/dev/null
+ else
+ printf "Skipping $NAME because it was not dumped correctly.\n\n"
+ fi
+
+done
+
diff --git a/util/scripts/dtd_parser.py b/util/scripts/dtd_parser.py
new file mode 100755
index 0000000..23cc7e7
--- /dev/null
+++ b/util/scripts/dtd_parser.py
@@ -0,0 +1,213 @@
+#!/usr/bin/python
+# dtd_parser.py - DTD structure parser
+#
+# Copyright (C) 2012 The ChromiumOS Authors. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+'''
+DTD string parser/generator.
+
+Detailed timing descriptor (DTD) is an 18 byte array describing video mode
+(screen resolution, display properties, etc.) in EDID and used by Intel Option
+ROM. Option ROM can support multiple video modes, specific mode is picked by
+the BIOS through the appropriate Option ROM callback function.
+
+This program allows to interpret the 18 byte hex DTD dump, and/or modify
+certain values and generate a new DTD.
+'''
+
+import sys
+
+#
+# The DTD array format description can be found in
+# http://en.wikipedia.org/wiki/Extended_display_identification_data, (see the
+# EDID Detailed Timing Descriptor section).
+#
+# The below dictionary describes how different DTD parameters are laid out in
+# the array. Note that many parameters span multiple bit fields in the DTD.
+#
+# The keys in the dictionary are stings (field names), the values are tuples
+# of either numbers or tri-tuples. If the element of the tuple is a number, it
+# is the offset in DTD, and the entire byte is used in this field. If the
+# element is a tri-tuple, its components are (DTD offset, bit shift, field
+# width).
+#
+# The partial values are extracted from the DTD fields and concatenated
+# together to form actual parameter value.
+#
+
+dtd_descriptor = {
+ 'dclck' : (1, 0),
+ 'hor_active' : ((4, 4, 4), 2),
+ 'hor_blank' : ((4, 0, 4), 3),
+ 'vert_act' : ((7, 4, 4), 5),
+ 'vert_blank' : ((7, 0, 4), 6),
+ 'hsync_offset' : ((11, 6, 2), 8),
+ 'hsync_pulse_width' : ((11, 4, 2), 9),
+ 'vsync_offset' : ((11, 2, 2), (10, 4, 4)),
+ 'vsync_pulse_width' : ((11, 0, 2), (10, 0, 4)),
+ 'hor_image_size' : ((14, 4, 4), 12),
+ 'vert_image_size' : ((14, 0, 4), 13),
+ 'hor_border' : (15,),
+ 'vert_border' : (16,),
+ 'interlaced' : ((17, 7, 1),),
+ 'reserved' : ((17, 5, 2), (17, 0, 1)),
+ 'digital_separate' : ((17, 3, 2),),
+ 'vert_polarity' : ((17, 2, 1),),
+ 'hor_polarity' : ((17, 1, 1),),
+ }
+
+PREFIX = 'attr_'
+
+class DTD(object):
+ '''An object containing all DTD information.
+
+ The attributes are created dynamically when the input DTD string is
+ parsed. For each element of the above dictionary two attributes are added:
+
+ 'attr_<param>' to hold the actual parameter value
+ 'max_attr_<param>' to hold the maximum allowed value for this parameter.
+ '''
+
+ def __init__(self):
+ for name in dtd_descriptor:
+ setattr(self, PREFIX + name, 0)
+
+ def init(self, sarray):
+ '''Initialize the object with values from a DTD array.
+
+ Inputs:
+
+ sarray: a string, an array of ASCII hex representations of the 18 DTD
+ bytes.
+
+ Raises: implicitly raises ValueError or IndexError exceptions in case
+ the input string has less than 18 elements, or some of the
+ elements can not be converted to integer.
+ '''
+
+ harray = [int(x, 16) for x in sarray]
+ for name, desc in dtd_descriptor.iteritems():
+ attr_value = 0
+ total_width = 0
+ for tup in desc:
+ if isinstance(tup, tuple):
+ offset, shift, width = tup
+ else:
+ offset, shift, width = tup, 0, 8
+
+ mask = (1 << width) - 1
+ attr_value = (attr_value << width) + (
+ (harray[offset] >> shift) & mask)
+ total_width += width
+ setattr(self, PREFIX + name, attr_value)
+ setattr(self, 'max_' + PREFIX + name, (1 << total_width) - 1)
+
+ def __str__(self):
+ text = []
+ for name in sorted(dtd_descriptor.keys()):
+ text.append('%20s: %d' % (name, getattr(self, PREFIX + name)))
+ return '\n'.join(text)
+
+ def inhex(self):
+ '''Generate contents of the DTD as a 18 byte ASCII hex array.'''
+
+ result = [0] * 18
+ for name, desc in dtd_descriptor.iteritems():
+ attr_value = getattr(self, PREFIX + name)
+ rdesc = list(desc)
+ rdesc.reverse()
+ for tup in rdesc:
+ if isinstance(tup, tuple):
+ offset, shift, width = tup
+ else:
+ offset, shift, width = tup, 0, 8
+
+ mask = (1 << width) - 1
+ value = attr_value & mask
+ attr_value = attr_value >> width
+ result[offset] = (result[offset] & ~(
+ mask << shift)) | (value << shift)
+
+ return ' '.join('%2.2x' % x for x in result)
+
+ def handle_input(self, name):
+ '''Get user input and set a new parameter value if required.
+
+ Display the parameter name, its current value, and prompt user for a
+ new value.
+
+ If the user enters a dot, stop processing (return True).
+
+ Empty user input means that this parameter does not have to change,
+ but the next parameter should be prompted.
+
+ If input is non-empty, it is interpreted as a hex number, checked if
+ it fits the parameter and the new parameter value is set if checks
+ pass.
+
+ Inputs:
+
+ name - a string, parameter name, a key in dtd_descriptor
+
+ Returns:
+
+ Boolean, True meaning no more field are required to be modified, False
+ meaning that more field mods need to be prompted..
+ '''
+
+ param = PREFIX + name
+ vmax = getattr(self, 'max_' + param)
+ new_value = raw_input('%s : %d ' % (name, getattr(self, param)))
+ if new_value == '':
+ return False
+ if new_value == '.':
+ return True
+ new_int = int(new_value)
+ if new_int > vmax:
+ print '%s exceeds maximum for %s (%d)' % (new_value, name, vmax)
+ else:
+ setattr(self, param, new_int)
+ return False
+
+def main(args):
+ if args[0] == '-m':
+ modify = True
+ base = 1
+ else:
+ modify = False
+ base = 0
+
+ d = DTD()
+ d.init(args[base:])
+ if modify:
+ for line in str(d).splitlines():
+ if d.handle_input(line.split(':')[0].strip()):
+ break
+ print d
+ if modify:
+ print d.inhex()
+
+
+if __name__ == '__main__':
+ try:
+ main(sys.argv[1:])
+ except (ValueError, IndexError):
+ print """
+A string of 18 byte values in hex is required.
+'-m' preceding the string will allow setting new parameter values.
+"""
+ sys.exit(1)
diff --git a/util/scripts/exynos_fixed_cksum.py b/util/scripts/exynos_fixed_cksum.py
new file mode 100755
index 0000000..66da060
--- /dev/null
+++ b/util/scripts/exynos_fixed_cksum.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2013 Google Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+"""
+This utility computes and fills Exynos ROM checksum (for BL1 or BL2).
+(Algorithm from U-Boot: tools/mkexynosspl.c)
+
+Input: IN OUT DATA_SIZE
+
+Output:
+
+ IN padded out to DATA_SIZE, checksum at the end, written to OUT.
+"""
+
+import struct
+import sys
+
+def main(argv):
+ if len(argv) != 4:
+ exit('usage: %s IN OUT DATA_SIZE' % argv[0])
+
+ in_name, out_name = argv[1:3]
+ size = int(argv[3], 0)
+ checksum_format = "<I"
+ with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
+ data = in_file.read()
+ checksum_size = struct.calcsize(checksum_format)
+ data_size = size - checksum_size
+ assert len(data) <= data_size
+ checksum = struct.pack(checksum_format, sum(map(ord, data)))
+ out_file.write(data + bytearray(data_size - len(data)) + checksum)
+
+
+if __name__ == '__main__':
+ main(sys.argv)
diff --git a/util/scripts/exynos_variable_cksum.py b/util/scripts/exynos_variable_cksum.py
new file mode 100755
index 0000000..75cdc74
--- /dev/null
+++ b/util/scripts/exynos_variable_cksum.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2013 Google Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+"""
+This utility computes and fills Exynos ROM checksum (for BL1 or BL2).
+(Algorithm from U-Boot: tools/mkexynosspl.c)
+
+Input: IN OUT
+
+Output:
+
+ Checksum header added to IN and written to OUT.
+ Header: uint32_t size, checksum, reserved[2].
+"""
+
+import struct
+import sys
+
+def main(argv):
+ if len(argv) != 3:
+ exit('usage: %s IN OUT' % argv[0])
+
+ in_name, out_name = argv[1:3]
+ header_format = "<IIII"
+ with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
+ data = in_file.read()
+ header = struct.pack(header_format,
+ struct.calcsize(header_format) + len(data),
+ sum(map(ord, data)),
+ 0, 0)
+ out_file.write(header + data)
+
+
+if __name__ == '__main__':
+ main(sys.argv)
diff --git a/util/scripts/find_usbdebug.sh b/util/scripts/find_usbdebug.sh
new file mode 100755
index 0000000..2f82219
--- /dev/null
+++ b/util/scripts/find_usbdebug.sh
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+# Copyright 2008 Carl-Daniel Hailfinger
+# Copyright 2015 Stefan Tauner
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc.
+
+LANG=C
+# Some tools emmit errors that don't matter (bugs in lspci/PCI firmware and lsusb).
+# To shown them anyway (e.g. for debugging) comment next line.
+exec 2>/dev/null
+
+if [ "$1" = "-h" ]; then
+ printf "Usage: $0 [-h | path to dmesg log]
+
+This script tries to find USB ports compatible with USB2/EHCI debug devices and
+helps you to find their physical locations. To that end, attach at least one
+uniquely identifiable device to a USB port and run this script. The device needs
+to be visible in the output of \"lsusb -t\" (debug devices are often *not*!).
+
+After determining compatibility of the USB controllers the script will print the
+devices attached to the debug port as shown by lsusb. If nothing shows up simply
+switch ports and repeat the process.
+
+Note: usually only one port is supported for debugging.\n"
+ exit 0
+fi
+uid=`id -u`
+if [ "$uid" -ne 0 ]; then
+ echo "Must be run as root. Exiting."
+ exit 1
+fi
+dmesgfile=$1
+
+find_devs_in_tree () {
+ bus=$1
+ port=$2
+ busstr=`printf "Bus %02d" "$bus"`
+ portstr="Port $port"
+
+ found=
+ # Iterate over the output of lsusb -t because it contains the physical port names
+ while IFS='' read -r line; do
+ # We need to keep track of the current bus "branch"
+ # Look out for lines starting with /: (that indicate a bus)
+ if [ "${line#*/:}" != "$line" ]; then
+ if [ "${line#*$busstr}" != "$line" ]; then
+ cur_bus=$busstr
+ else
+ cur_bus=
+ fi
+ continue
+ fi
+
+ # Skip all lines not belonging to the wanted bus number
+ if [ "$cur_bus" != "$busstr" ]; then
+ continue
+ fi
+
+ # check for matching physical USB port, and take only IF 0 into account
+ if [ "${line#*$portstr}" != "$line" -a "${line#*If 0}" != "$line" ]; then
+ dev=`echo ${line#*Dev } | cut -d ',' -f 1`
+ lsusb -s "$bus":"$dev"
+ found="yes"
+ fi
+ done<< EOF
+$(lsusb -t)
+EOF
+ if [ -z "$found" ]; then
+ echo "none"
+ fi
+}
+
+debug_lspci_devs=`lspci -nvvD |
+ grep -i "^[0-9a-f]\|debug port" |
+ grep -iB1 --no-group-separator "debug port" |
+ grep -vi "debug port" |
+ cut -f 1 -d" " |
+ sort |
+ xargs echo`
+
+if [ -z "$debug_lspci_devs" ]; then
+ printf "No USB controller with debug capability found by lspci.\n
+Possible reasons: lspci too old, USB controller does not support a debug device, ... Exiting.\n"
+ exit 1
+fi
+printf "The following PCI devices support a USB debug port (says lspci): $debug_lspci_devs\n"
+
+debug_dmesg_devs_with_port=`( test -z "$dmesgfile" &&
+ dmesg ||
+ cat "$dmesgfile") |
+ grep -i "ehci.*debug port" |
+ sed "s/.* \([0-9a-f]*:*[0-9a-f]\{2\}:[0-9a-f]\{2\}\.[0-9a-f]\).*ebug port /\1 /" |
+ sort`
+
+debug_dmesg_devs=`echo "$debug_dmesg_devs_with_port" |
+ cut -f 1 -d" " |
+ xargs echo`
+
+if [ -z "$debug_dmesg_devs" ]; then
+ printf "dmesg does not show any supported ports.\n
+Possible reasons: dmesg scrolled off, kernel too old, USB controller does not support a debug device, ... Exiting.\n
+Note: You can specify a file containing kernel messages as an argument to this program (e.g. /var/log/dmesg)."
+ exit 1
+fi
+
+if [ "$debug_lspci_devs" != "$debug_dmesg_devs" ]; then
+ echo "lspci and the kernel do not agree on USB debug device support. Exiting."
+ exit 1
+fi
+
+printf "and the kernel agrees, good.\n\n"
+
+while true; do
+ for dev in $debug_dmesg_devs; do
+ bus=`lsusb -v |
+ grep "^Bus\|iSerial.*" |
+ grep -B1 --no-group-separator "iSerial.*$dev" |
+ grep "^Bus" |
+ sed "s/Bus *0*\([0-9a-f]*\).*/\1/"`
+ port=`echo "$debug_dmesg_devs_with_port" |
+ grep "^$dev" |
+ cut -f 2 -d" "`
+
+ echo "Device(s) currently connected to the debug-capable port $port on PCI device $dev, USB bus $bus:"
+
+ find_devs_in_tree $bus $port
+ echo
+ done
+
+ echo "Enter 'q' to abort or anything else to repeat"
+ read r
+ if [ $? -ne 0 -o "$r" = "q" ]; then
+ break;
+ fi
+done
+
+return 0
diff --git a/util/scripts/genbuild_h.sh b/util/scripts/genbuild_h.sh
new file mode 100755
index 0000000..55a3b85
--- /dev/null
+++ b/util/scripts/genbuild_h.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2014 Sage Electronic Engineering, LLC.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+DATE=""
+GITREV=""
+TIMESOURCE=""
+if [ -d "${top}/.git" ] && [ -f "$(command -v git)" ]; then
+ GITREV=$(LANG= git log remotes/origin/master -1 --format=format:%h)
+ TIMESOURCE=git
+ DATE=$(git log --pretty=format:%ct -1)
+else
+ GITREV=Unknown
+ TIMESOURCE="LANG= TZ=UTC date"
+ DATE=$(date +%s)
+fi
+
+our_date() {
+case $(uname) in
+NetBSD|OpenBSD|DragonFly|FreeBSD)
+ TZ=UTC date -r $1 $2
+ ;;
+*)
+ TZ=UTC date -d @$1 $2
+esac
+}
+
+#Print out the information that goes into build.h
+printf "/* build system definitions (autogenerated) */\n"
+printf "#ifndef __BUILD_H\n"
+printf "#define __BUILD_H\n\n"
+printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
+
+#See if the build is running in a git repo and the git command is available
+printf "/* timesource: $TIMESOURCE */\n"
+printf "#define COREBOOT_VERSION_TIMESTAMP $DATE\n"
+printf "#define COREBOOT_ORIGIN_GIT_REVISION \"$GITREV\"\n"
+
+printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
+printf "#define COREBOOT_BUILD \"$(LANG= our_date "$DATE")\"\n"
+printf "#define COREBOOT_BUILD_YEAR_BCD 0x$(our_date "$DATE" +%y)\n"
+printf "#define COREBOOT_BUILD_MONTH_BCD 0x$(our_date "$DATE" +%m)\n"
+printf "#define COREBOOT_BUILD_DAY_BCD 0x$(our_date "$DATE" +%d)\n"
+printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
+printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
+printf "\n"
+printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
+printf "#endif\n"
diff --git a/util/scripts/ipqheader.py b/util/scripts/ipqheader.py
new file mode 100755
index 0000000..eb1a316
--- /dev/null
+++ b/util/scripts/ipqheader.py
@@ -0,0 +1,130 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2013 The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+import os
+import struct
+import sys
+
+PROG_NAME = os.path.basename(sys.argv[0])
+
+def create_header(base, size):
+ """Returns a packed MBN header image with the specified base and size.
+
+ @arg base: integer, specifies the image load address in RAM
+ @arg size: integer, specifies the size of the image
+ @returns: string, the MBN header
+ """
+
+ # SBLs require size to be 4 bytes aligned.
+ size = (size + 3) & 0xfffffffc
+
+ # We currently do not support appending certificates. Signing GPL
+ # code might violate the GPL. So U-Boot will never be signed. So
+ # this is not required for U-Boot.
+
+ header = [
+ 0x5, # Type: APPSBL
+ 0x3, # Version: 3
+ 0x0, # Image source pointer
+ base, # Image destination pointer
+ size, # Code Size + Cert Size + Signature Size
+ size, # Code Size
+ base + size, # Destination + Code Size
+ 0x0, # Signature Size
+ base + size, # Destination + Code Size + Signature Size
+ 0x0, # Cert Size
+ ]
+
+ header_packed = struct.pack('<10I', *header)
+ return header_packed
+
+def mkheader(base_addr, infname, outfname):
+ """Prepends the image with the MBN header.
+
+ @arg base_addr: integer, specifies the image load address in RAM
+ @arg infname: string, image filename
+ @arg outfname: string, output image with header prepended
+ @raises IOError: if reading/writing input/output file fails
+ """
+ with open(infname, "rb") as infp:
+ image = infp.read()
+ insize = len(image)
+
+ if base_addr > 0xFFFFFFFF:
+ raise ValueError("invalid base address")
+
+ if base_addr + insize > 0xFFFFFFFF:
+ raise ValueError("invalid destination range")
+
+ header = create_header(base_addr, insize)
+ with open(outfname, "wb") as outfp:
+ outfp.write(header)
+ outfp.write(image)
+
+def usage(msg=None):
+ """Print command usage.
+
+ @arg msg: string, error message if any (default: None)
+ """
+ if msg != None:
+ sys.stderr.write("%s: %s\n" % (PROG_NAME, msg))
+
+ print "Usage: %s <base-addr> <input-file> <output-file>" % PROG_NAME
+
+ if msg != None:
+ exit(1)
+
+def main():
+ """Main entry function"""
+
+ if len(sys.argv) != 4:
+ usage("incorrect number of arguments")
+
+ try:
+ base_addr = int(sys.argv[1], 0)
+ infname = sys.argv[2]
+ outfname = sys.argv[3]
+ except ValueError as e:
+ sys.stderr.write("mkheader: invalid base address '%s'\n" % sys.argv[1])
+ exit(1)
+
+ try:
+ mkheader(base_addr, infname, outfname)
+ except IOError as e:
+ sys.stderr.write("%s: %s\n" % (PROG_NAME, e))
+ exit(1)
+ except ValueError as e:
+ sys.stderr.write("%s: %s\n" % (PROG_NAME, e))
+ exit(1)
+
+if __name__ == "__main__":
+ main()
+
diff --git a/util/scripts/rk_make_idb.py b/util/scripts/rk_make_idb.py
new file mode 100755
index 0000000..26e26b8
--- /dev/null
+++ b/util/scripts/rk_make_idb.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+"""
+Creates a Rockchip ID Block (IDB), optionally RC4 encrypted and aligned
+"""
+
+import struct
+import sys
+from io import SEEK_SET, SEEK_END
+
+class IDBTool:
+ def __init__(self):
+ print "Initialize IDBTool"
+
+ def p_rc4(self, buf, length):
+ key = (124,78,3,4,85,5,9,7,45,44,123,56,23,13,23,17)
+ K = key * 16
+ S = [i for i in range(256)]
+
+ j = 0
+ for i in range(256):
+ j = (j + S[i] + K[i]) % 256
+ temp = S[i]; S[i] = S[j]; S[j] = temp;
+
+ i = j = k = 0
+ for x in range(length):
+ i = (i+1) % 256
+ j = (j + S[i]) % 256
+ temp = S[i]; S[i] = S[j]; S[j] = temp
+ k = (S[i] + S[j]) % 256
+ buf[x] = struct.pack('B', ord(buf[x]) ^ S[k])
+
+ def makeIDB(self, from_file, to_file, rc4_flag = False, align_flag = False):
+ try:
+ fin = open(from_file, 'rb')
+ except:
+ sys.exit("Failed to open file : " + from_file)
+
+ try:
+ fin.seek(0, SEEK_END)
+ if (fin.tell() > 4 * 1024 * 1024):
+ sys.exit("Input file is more than 4MB")
+ fin.seek(0)
+ data = fin.read()
+ finally:
+ fin.close()
+
+ data_len = len(data)
+ SECTOR_SIZE = 512
+ PAGE_ALIGN = 4
+ sectors = (data_len + 4 - 1) / SECTOR_SIZE + 1
+ pages = (sectors - 1) / PAGE_ALIGN + 1
+ sectors = pages * PAGE_ALIGN;
+
+ buf = [B'\0'] * sectors * SECTOR_SIZE
+ buf[:4] = "RK32"
+ buf[4 : 4+data_len] = data
+
+ idblock = [B'\0'] * 4 * SECTOR_SIZE
+ blank = [B'\0'] * 4 * SECTOR_SIZE
+ idblock[:4] = ['\x55', '\xAA', '\xF0', '\x0F']
+
+ if (not rc4_flag):
+ idblock[8:12] = struct.pack("<I", 1)
+ else:
+ for i in range(sectors):
+ list_tmp = buf[SECTOR_SIZE*i : SECTOR_SIZE*(i+1)]
+ self.p_rc4(list_tmp, SECTOR_SIZE)
+ buf[SECTOR_SIZE*i : SECTOR_SIZE*(i+1)] = list_tmp
+
+ idblock[12:16] = struct.pack("<HH", 4, 4);
+ idblock[506:510] = struct.pack("<HH", sectors, sectors);
+ self.p_rc4(idblock, SECTOR_SIZE)
+
+ try:
+ fout = open(to_file, "wb+")
+ except:
+ sys.exit("Failed to open output file : " + to_file)
+
+ try:
+ if (align_flag):
+ fout.write(''.join(idblock))
+ fout.write(''.join(blank))
+
+ for s in xrange(0, sectors * SECTOR_SIZE, PAGE_ALIGN * SECTOR_SIZE):
+ fout.write(''.join(buf[s : s + PAGE_ALIGN * SECTOR_SIZE]))
+ fout.write(''.join(blank))
+ else:
+ fout.write(''.join(idblock))
+ fout.write(''.join(buf))
+ fout.flush()
+ except:
+ sys.exit("Failed to write data to : " + to_file)
+ finally:
+ fout.close()
+ print "DONE"
+
+def usage():
+ print "Usage: make_idb.py [--enable-rc4] [--enable-align] [--to=out] --from=in"
+
+if __name__ == '__main__':
+ rc4_flag = align_flag = False
+ to_file = "IDBlock.bin"
+
+ for para in sys.argv[1:]:
+ if (para == "--enable-rc4"):
+ rc4_flag = True
+ elif (para == "--enable-align"):
+ align_flag = True
+ elif (para.startswith("--to=")):
+ to_file = para.split('=')[1]
+ elif (para.startswith("--from=")):
+ from_file = para.split('=')[1]
+ elif (para == "--help" or para == "-h"):
+ usage()
+ sys.exit()
+ else:
+ usage()
+ sys.exit()
+ if ('from_file' not in vars() or to_file == ''):
+ usage()
+ sys.exit()
+
+ idbtool = IDBTool()
+ idbtool.makeIDB(from_file, to_file, rc4_flag, align_flag)
diff --git a/util/scripts/xcompile b/util/scripts/xcompile
new file mode 100755
index 0000000..5809ec0
--- /dev/null
+++ b/util/scripts/xcompile
@@ -0,0 +1,269 @@
+#!/bin/bash
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2007-2010 coresystems GmbH
+# Copyright (C) 2012 Google Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+TMPFILE=""
+XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
+
+die() {
+ echo "ERROR: $*" >&2
+ exit 1
+}
+
+clean_up() {
+ if [ -n "$TMPFILE" ]; then
+ rm -f "$TMPFILE" "$TMPFILE.c" "$TMPFILE.o"
+ fi
+}
+
+# Create temporary file(s).
+TMPFILE="$(mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz)"
+touch "$TMPFILE"
+trap clean_up EXIT
+
+
+program_exists() {
+ type "$1" >/dev/null 2>&1
+}
+
+
+if [ "$(${XGCCPATH}/iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
+ IASL=${XGCCPATH}iasl
+elif [ "$(iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
+ IASL=iasl
+else
+ die "no iasl found"
+fi
+
+if program_exists gcc; then
+ HOSTCC=gcc
+elif program_exists cc; then
+ HOSTCC=cc
+else
+ die "no host compiler found"
+fi
+
+cat <<EOF
+# platform agnostic and host tools
+IASL:=${IASL}
+HOSTCC:=${HOSTCC}
+
+EOF
+
+testcc() {
+ local tmp_c="$TMPFILE.c"
+ local tmp_o="$TMPFILE.o"
+ rm -f "$tmp_c" "$tmp_o"
+ echo "void _start(void) {}" >"$tmp_c"
+ "$1" -nostdlib -Werror $2 "$tmp_c" -o "$tmp_o" >/dev/null 2>&1
+}
+
+testas() {
+ local gccprefixes="$1"
+ local twidth="$2"
+ local arch="$3"
+ local use_dash_twidth="$4"
+ local obj_file="$TMPFILE.o"
+ local full_arch="elf$twidth-$arch"
+
+ rm -f "$obj_file"
+ [ -n "$use_dash_twidth" ] && use_dash_twidth="--$twidth"
+ ${gccprefixes}as $use_dash_twidth -o "$obj_file" $TMPFILE 2>/dev/null ||
+ return 1
+
+ # Check output content type.
+ local obj_type="$(${gccprefixes}objdump -p $obj_file)"
+ local obj_arch="$(expr "$obj_type" : '.*format \(.[a-z0-9-]*\)')"
+ [ "$obj_arch" = "$full_arch" ] || return 1
+
+ # Architecture matched.
+ GCCPREFIX="$gccprefixes"
+
+ if [ -z "$use_dash_twidth" ]; then
+ ASFLAGS=""
+ CFLAGS=""
+ LDFLAGS=""
+ else
+ ASFLAGS="--$twidth"
+ CFLAGS="-m$twidth"
+ LDFLAGS="-b $full_arch"
+
+ fi
+
+ # Special parameters only available in dash_twidth mode.
+ [ -n "$use_dash_twidth" ] && case "$full_arch" in
+ "elf32-i386" )
+ LDFLAGS="$LDFLAGS -melf_i386"
+ CFLAGS="$CFLAGS -Wl,-b,elf32-i386 -Wl,-melf_i386"
+ ;;
+ esac
+
+ return 0
+}
+
+detect_special_flags() {
+ local architecture="$1"
+ # GCC 4.6 is much more picky about unused variables.
+ # Turn off it's warnings for now:
+ testcc "$CC" "$CFLAGS -Wno-unused-but-set-variable " &&
+ CFLAGS="$CFLAGS -Wno-unused-but-set-variable "
+
+ # Use bfd linker instead of gold if available:
+ testcc "$CC" "$CFLAGS -fuse-ld=bfd" &&
+ CFLAGS="$CFLAGS -fuse-ld=bfd" && LINKER_SUFFIX='.bfd'
+
+ testcc "$CC" "$CFLAGS -fno-stack-protector"&&
+ CFLAGS="$CFLAGS -fno-stack-protector"
+ testcc "$CC" "$CFLAGS -Wl,--build-id=none" &&
+ CFLAGS="$CFLAGS -Wl,--build-id=none"
+
+ case "$architecture" in
+ x86)
+ testcc "$CC" "$CFLAGS -Wa,--divide" &&
+ CFLAGS="$CFLAGS -Wa,--divide"
+ # Always build for i686 -- no sse/mmx instructions since SMM
+ # modules are compiled using these flags. Note that this
+ # doesn't prevent a project using xcompile to explicitly
+ # specify -mmsse, etc flags.
+ CFLAGS="$CFLAGS -march=i686"
+ ;;
+ mipsel)
+ testcc "$CC" "$CFLAGS -mno-abicalls -fno-pic" && \
+ CFLAGS+=" -mno-abicalls -fno-pic"
+ ;;
+ esac
+}
+
+report_arch_toolchain() {
+ cat <<EOF
+# elf${TWIDTH}-${TBFDARCH} toolchain (${GCCPREFIX}gcc)
+ARCH_SUPPORTED+=${TARCH}
+SUBARCH_SUPPORTED+=${TSUPP-${TARCH}}
+CC_${TARCH}:=${GCCPREFIX}gcc
+CFLAGS_${TARCH}:=${CFLAGS}
+CPP_${TARCH}:=${GCCPREFIX}cpp
+AS_${TARCH}:=${GCCPREFIX}as ${ASFLAGS}
+LD_${TARCH}:=${GCCPREFIX}ld${LINKER_SUFFIX} ${LDFLAGS}
+NM_${TARCH}:=${GCCPREFIX}nm
+OBJCOPY_${TARCH}:=${GCCPREFIX}objcopy
+OBJDUMP_${TARCH}:=${GCCPREFIX}objdump
+READELF_${TARCH}:=${GCCPREFIX}readelf
+STRIP_${TARCH}:=${GCCPREFIX}strip
+AR_${TARCH}:=${GCCPREFIX}ar
+
+EOF
+}
+
+# Architecture definition
+SUPPORTED_ARCHITECTURE="x86 arm arm64 riscv mipsel"
+
+arch_config_arm() {
+ TARCH="arm"
+ TBFDARCHS="littlearm"
+ TCLIST="armv7a armv7-a"
+ TWIDTH="32"
+ TSUPP="arm armv4 armv7"
+ TABI="eabi"
+}
+
+arch_config_arm64() {
+ TARCH="arm64"
+ TBFDARCHS="littleaarch64"
+ TCLIST="aarch64"
+ TWIDTH="64"
+ TSUPP="arm64 armv8_64"
+ TABI="elf"
+}
+
+arch_config_riscv() {
+ TARCH="riscv"
+ TBFDARCHS="littleriscv"
+ TCLIST="riscv"
+ TWIDTH="64"
+ TABI="elf"
+}
+
+arch_config_x86() {
+ TARCH="x86_32"
+ TBFDARCHS="i386"
+ TCLIST="i386 x86_64"
+ TWIDTH="32"
+ TABI="elf"
+}
+
+arch_config_mipsel() {
+ TARCH="mips"
+ TBFDARCHS="tradlittlemips littlemips"
+ TCLIST="mipsel"
+ TWIDTH="32"
+ TSUPP="mips mipsel"
+ TABI="elf"
+}
+
+test_architecture() {
+ architecture=$1
+
+ GCCPREFIX="invalid"
+ unset TARCH TBFDARCH TCLIST TWIDTH TSUPP TABI
+ if type arch_config_$architecture > /dev/null; then
+ arch_config_$architecture
+ else
+ die "no architecture definition for $architecture"
+ fi
+
+ # To override toolchain, define CROSS_COMPILE_$arch or CROSS_COMPILE as
+ # environment variable.
+ # Ex: CROSS_COMPILE_arm="armv7a-cros-linux-gnueabi-"
+ # CROSS_COMPILE_x86="i686-pc-linux-gnu-"
+ search="$(eval echo \$CROSS_COMPILE_$architecture 2>/dev/null)"
+ search="$search $CROSS_COMPILE"
+ for toolchain in $TCLIST; do
+ search="$search $XGCCPATH$toolchain-$TABI-"
+ search="$search $toolchain-$TABI-"
+ search="$search $toolchain-linux-gnu-"
+ search="$search $toolchain-"
+ done
+ echo "# $architecture TARCH_SEARCH=$search"
+
+ # Search toolchain by checking assembler capability.
+ for TBFDARCH in $TBFDARCHS; do
+ for gccprefixes in $search ""; do
+ program_exists "${gccprefixes}as" || continue
+ testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "" && break
+ testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "TRUE" && break
+ done
+ [ "$GCCPREFIX" = "invalid" ] || break
+ done
+
+ if [ "$GCCPREFIX" = "invalid" ]; then
+ echo "Warning: no suitable GCC for $architecture." >&2
+ continue
+ fi
+ CC="${GCCPREFIX}"gcc
+
+ detect_special_flags "$architecture"
+ report_arch_toolchain
+}
+
+# This loops over all supported architectures.
+for architecture in $SUPPORTED_ARCHITECTURE; do
+ test_architecture $architecture
+done
+
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
deleted file mode 100755
index 5809ec0..0000000
--- a/util/xcompile/xcompile
+++ /dev/null
@@ -1,269 +0,0 @@
-#!/bin/bash
-#
-# This file is part of the coreboot project.
-#
-# Copyright (C) 2007-2010 coresystems GmbH
-# Copyright (C) 2012 Google Inc
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-TMPFILE=""
-XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"}
-
-die() {
- echo "ERROR: $*" >&2
- exit 1
-}
-
-clean_up() {
- if [ -n "$TMPFILE" ]; then
- rm -f "$TMPFILE" "$TMPFILE.c" "$TMPFILE.o"
- fi
-}
-
-# Create temporary file(s).
-TMPFILE="$(mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz)"
-touch "$TMPFILE"
-trap clean_up EXIT
-
-
-program_exists() {
- type "$1" >/dev/null 2>&1
-}
-
-
-if [ "$(${XGCCPATH}/iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
- IASL=${XGCCPATH}iasl
-elif [ "$(iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
- IASL=iasl
-else
- die "no iasl found"
-fi
-
-if program_exists gcc; then
- HOSTCC=gcc
-elif program_exists cc; then
- HOSTCC=cc
-else
- die "no host compiler found"
-fi
-
-cat <<EOF
-# platform agnostic and host tools
-IASL:=${IASL}
-HOSTCC:=${HOSTCC}
-
-EOF
-
-testcc() {
- local tmp_c="$TMPFILE.c"
- local tmp_o="$TMPFILE.o"
- rm -f "$tmp_c" "$tmp_o"
- echo "void _start(void) {}" >"$tmp_c"
- "$1" -nostdlib -Werror $2 "$tmp_c" -o "$tmp_o" >/dev/null 2>&1
-}
-
-testas() {
- local gccprefixes="$1"
- local twidth="$2"
- local arch="$3"
- local use_dash_twidth="$4"
- local obj_file="$TMPFILE.o"
- local full_arch="elf$twidth-$arch"
-
- rm -f "$obj_file"
- [ -n "$use_dash_twidth" ] && use_dash_twidth="--$twidth"
- ${gccprefixes}as $use_dash_twidth -o "$obj_file" $TMPFILE 2>/dev/null ||
- return 1
-
- # Check output content type.
- local obj_type="$(${gccprefixes}objdump -p $obj_file)"
- local obj_arch="$(expr "$obj_type" : '.*format \(.[a-z0-9-]*\)')"
- [ "$obj_arch" = "$full_arch" ] || return 1
-
- # Architecture matched.
- GCCPREFIX="$gccprefixes"
-
- if [ -z "$use_dash_twidth" ]; then
- ASFLAGS=""
- CFLAGS=""
- LDFLAGS=""
- else
- ASFLAGS="--$twidth"
- CFLAGS="-m$twidth"
- LDFLAGS="-b $full_arch"
-
- fi
-
- # Special parameters only available in dash_twidth mode.
- [ -n "$use_dash_twidth" ] && case "$full_arch" in
- "elf32-i386" )
- LDFLAGS="$LDFLAGS -melf_i386"
- CFLAGS="$CFLAGS -Wl,-b,elf32-i386 -Wl,-melf_i386"
- ;;
- esac
-
- return 0
-}
-
-detect_special_flags() {
- local architecture="$1"
- # GCC 4.6 is much more picky about unused variables.
- # Turn off it's warnings for now:
- testcc "$CC" "$CFLAGS -Wno-unused-but-set-variable " &&
- CFLAGS="$CFLAGS -Wno-unused-but-set-variable "
-
- # Use bfd linker instead of gold if available:
- testcc "$CC" "$CFLAGS -fuse-ld=bfd" &&
- CFLAGS="$CFLAGS -fuse-ld=bfd" && LINKER_SUFFIX='.bfd'
-
- testcc "$CC" "$CFLAGS -fno-stack-protector"&&
- CFLAGS="$CFLAGS -fno-stack-protector"
- testcc "$CC" "$CFLAGS -Wl,--build-id=none" &&
- CFLAGS="$CFLAGS -Wl,--build-id=none"
-
- case "$architecture" in
- x86)
- testcc "$CC" "$CFLAGS -Wa,--divide" &&
- CFLAGS="$CFLAGS -Wa,--divide"
- # Always build for i686 -- no sse/mmx instructions since SMM
- # modules are compiled using these flags. Note that this
- # doesn't prevent a project using xcompile to explicitly
- # specify -mmsse, etc flags.
- CFLAGS="$CFLAGS -march=i686"
- ;;
- mipsel)
- testcc "$CC" "$CFLAGS -mno-abicalls -fno-pic" && \
- CFLAGS+=" -mno-abicalls -fno-pic"
- ;;
- esac
-}
-
-report_arch_toolchain() {
- cat <<EOF
-# elf${TWIDTH}-${TBFDARCH} toolchain (${GCCPREFIX}gcc)
-ARCH_SUPPORTED+=${TARCH}
-SUBARCH_SUPPORTED+=${TSUPP-${TARCH}}
-CC_${TARCH}:=${GCCPREFIX}gcc
-CFLAGS_${TARCH}:=${CFLAGS}
-CPP_${TARCH}:=${GCCPREFIX}cpp
-AS_${TARCH}:=${GCCPREFIX}as ${ASFLAGS}
-LD_${TARCH}:=${GCCPREFIX}ld${LINKER_SUFFIX} ${LDFLAGS}
-NM_${TARCH}:=${GCCPREFIX}nm
-OBJCOPY_${TARCH}:=${GCCPREFIX}objcopy
-OBJDUMP_${TARCH}:=${GCCPREFIX}objdump
-READELF_${TARCH}:=${GCCPREFIX}readelf
-STRIP_${TARCH}:=${GCCPREFIX}strip
-AR_${TARCH}:=${GCCPREFIX}ar
-
-EOF
-}
-
-# Architecture definition
-SUPPORTED_ARCHITECTURE="x86 arm arm64 riscv mipsel"
-
-arch_config_arm() {
- TARCH="arm"
- TBFDARCHS="littlearm"
- TCLIST="armv7a armv7-a"
- TWIDTH="32"
- TSUPP="arm armv4 armv7"
- TABI="eabi"
-}
-
-arch_config_arm64() {
- TARCH="arm64"
- TBFDARCHS="littleaarch64"
- TCLIST="aarch64"
- TWIDTH="64"
- TSUPP="arm64 armv8_64"
- TABI="elf"
-}
-
-arch_config_riscv() {
- TARCH="riscv"
- TBFDARCHS="littleriscv"
- TCLIST="riscv"
- TWIDTH="64"
- TABI="elf"
-}
-
-arch_config_x86() {
- TARCH="x86_32"
- TBFDARCHS="i386"
- TCLIST="i386 x86_64"
- TWIDTH="32"
- TABI="elf"
-}
-
-arch_config_mipsel() {
- TARCH="mips"
- TBFDARCHS="tradlittlemips littlemips"
- TCLIST="mipsel"
- TWIDTH="32"
- TSUPP="mips mipsel"
- TABI="elf"
-}
-
-test_architecture() {
- architecture=$1
-
- GCCPREFIX="invalid"
- unset TARCH TBFDARCH TCLIST TWIDTH TSUPP TABI
- if type arch_config_$architecture > /dev/null; then
- arch_config_$architecture
- else
- die "no architecture definition for $architecture"
- fi
-
- # To override toolchain, define CROSS_COMPILE_$arch or CROSS_COMPILE as
- # environment variable.
- # Ex: CROSS_COMPILE_arm="armv7a-cros-linux-gnueabi-"
- # CROSS_COMPILE_x86="i686-pc-linux-gnu-"
- search="$(eval echo \$CROSS_COMPILE_$architecture 2>/dev/null)"
- search="$search $CROSS_COMPILE"
- for toolchain in $TCLIST; do
- search="$search $XGCCPATH$toolchain-$TABI-"
- search="$search $toolchain-$TABI-"
- search="$search $toolchain-linux-gnu-"
- search="$search $toolchain-"
- done
- echo "# $architecture TARCH_SEARCH=$search"
-
- # Search toolchain by checking assembler capability.
- for TBFDARCH in $TBFDARCHS; do
- for gccprefixes in $search ""; do
- program_exists "${gccprefixes}as" || continue
- testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "" && break
- testas "$gccprefixes" "$TWIDTH" "$TBFDARCH" "TRUE" && break
- done
- [ "$GCCPREFIX" = "invalid" ] || break
- done
-
- if [ "$GCCPREFIX" = "invalid" ]; then
- echo "Warning: no suitable GCC for $architecture." >&2
- continue
- fi
- CC="${GCCPREFIX}"gcc
-
- detect_special_flags "$architecture"
- report_arch_toolchain
-}
-
-# This loops over all supported architectures.
-for architecture in $SUPPORTED_ARCHITECTURE; do
- test_architecture $architecture
-done
-
Stefan Tauner (stefan.tauner(a)gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9305
-gerrit
commit 3c4092f1279fe3aeb797a6f02d677f8ec80d142f
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Mon Apr 6 12:04:08 2015 +0200
utils: introduce find_usbdebug.sh to help find USB debug ports
Carl-Daniel made this script a long time ago but it never was picked up
in the tree. Now that USB debugging is way more common it makes
sense to include it.
I have made a number of changes to the original version:
* -h help text
* check for running as root
* removed bashism
* enhanced readability (test -> if)
* new execution flow and refined output that better shows the device(s)
attached to the debug port(s)
* hiding of (bogus) error messages from lspci and lsusb
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
Change-Id: Iadf775e990f5c5f91a28d57e3331d1f59acee305
---
util/find_usbdebug/find_usbdebug.sh | 149 ++++++++++++++++++++++++++++++++++++
1 file changed, 149 insertions(+)
diff --git a/util/find_usbdebug/find_usbdebug.sh b/util/find_usbdebug/find_usbdebug.sh
new file mode 100755
index 0000000..2f82219
--- /dev/null
+++ b/util/find_usbdebug/find_usbdebug.sh
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+# Copyright 2008 Carl-Daniel Hailfinger
+# Copyright 2015 Stefan Tauner
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc.
+
+LANG=C
+# Some tools emmit errors that don't matter (bugs in lspci/PCI firmware and lsusb).
+# To shown them anyway (e.g. for debugging) comment next line.
+exec 2>/dev/null
+
+if [ "$1" = "-h" ]; then
+ printf "Usage: $0 [-h | path to dmesg log]
+
+This script tries to find USB ports compatible with USB2/EHCI debug devices and
+helps you to find their physical locations. To that end, attach at least one
+uniquely identifiable device to a USB port and run this script. The device needs
+to be visible in the output of \"lsusb -t\" (debug devices are often *not*!).
+
+After determining compatibility of the USB controllers the script will print the
+devices attached to the debug port as shown by lsusb. If nothing shows up simply
+switch ports and repeat the process.
+
+Note: usually only one port is supported for debugging.\n"
+ exit 0
+fi
+uid=`id -u`
+if [ "$uid" -ne 0 ]; then
+ echo "Must be run as root. Exiting."
+ exit 1
+fi
+dmesgfile=$1
+
+find_devs_in_tree () {
+ bus=$1
+ port=$2
+ busstr=`printf "Bus %02d" "$bus"`
+ portstr="Port $port"
+
+ found=
+ # Iterate over the output of lsusb -t because it contains the physical port names
+ while IFS='' read -r line; do
+ # We need to keep track of the current bus "branch"
+ # Look out for lines starting with /: (that indicate a bus)
+ if [ "${line#*/:}" != "$line" ]; then
+ if [ "${line#*$busstr}" != "$line" ]; then
+ cur_bus=$busstr
+ else
+ cur_bus=
+ fi
+ continue
+ fi
+
+ # Skip all lines not belonging to the wanted bus number
+ if [ "$cur_bus" != "$busstr" ]; then
+ continue
+ fi
+
+ # check for matching physical USB port, and take only IF 0 into account
+ if [ "${line#*$portstr}" != "$line" -a "${line#*If 0}" != "$line" ]; then
+ dev=`echo ${line#*Dev } | cut -d ',' -f 1`
+ lsusb -s "$bus":"$dev"
+ found="yes"
+ fi
+ done<< EOF
+$(lsusb -t)
+EOF
+ if [ -z "$found" ]; then
+ echo "none"
+ fi
+}
+
+debug_lspci_devs=`lspci -nvvD |
+ grep -i "^[0-9a-f]\|debug port" |
+ grep -iB1 --no-group-separator "debug port" |
+ grep -vi "debug port" |
+ cut -f 1 -d" " |
+ sort |
+ xargs echo`
+
+if [ -z "$debug_lspci_devs" ]; then
+ printf "No USB controller with debug capability found by lspci.\n
+Possible reasons: lspci too old, USB controller does not support a debug device, ... Exiting.\n"
+ exit 1
+fi
+printf "The following PCI devices support a USB debug port (says lspci): $debug_lspci_devs\n"
+
+debug_dmesg_devs_with_port=`( test -z "$dmesgfile" &&
+ dmesg ||
+ cat "$dmesgfile") |
+ grep -i "ehci.*debug port" |
+ sed "s/.* \([0-9a-f]*:*[0-9a-f]\{2\}:[0-9a-f]\{2\}\.[0-9a-f]\).*ebug port /\1 /" |
+ sort`
+
+debug_dmesg_devs=`echo "$debug_dmesg_devs_with_port" |
+ cut -f 1 -d" " |
+ xargs echo`
+
+if [ -z "$debug_dmesg_devs" ]; then
+ printf "dmesg does not show any supported ports.\n
+Possible reasons: dmesg scrolled off, kernel too old, USB controller does not support a debug device, ... Exiting.\n
+Note: You can specify a file containing kernel messages as an argument to this program (e.g. /var/log/dmesg)."
+ exit 1
+fi
+
+if [ "$debug_lspci_devs" != "$debug_dmesg_devs" ]; then
+ echo "lspci and the kernel do not agree on USB debug device support. Exiting."
+ exit 1
+fi
+
+printf "and the kernel agrees, good.\n\n"
+
+while true; do
+ for dev in $debug_dmesg_devs; do
+ bus=`lsusb -v |
+ grep "^Bus\|iSerial.*" |
+ grep -B1 --no-group-separator "iSerial.*$dev" |
+ grep "^Bus" |
+ sed "s/Bus *0*\([0-9a-f]*\).*/\1/"`
+ port=`echo "$debug_dmesg_devs_with_port" |
+ grep "^$dev" |
+ cut -f 2 -d" "`
+
+ echo "Device(s) currently connected to the debug-capable port $port on PCI device $dev, USB bus $bus:"
+
+ find_devs_in_tree $bus $port
+ echo
+ done
+
+ echo "Enter 'q' to abort or anything else to repeat"
+ read r
+ if [ $? -ne 0 -o "$r" = "q" ]; then
+ break;
+ fi
+done
+
+return 0
Sergej Ivanov (getinaks(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9291
-gerrit
commit 0b4f87647e1cf5745c13a15039d4c3a669202472
Author: Sergej Ivanov <getinaks(a)gmail.com>
Date: Fri Apr 3 16:53:49 2015 +0300
vendorcode/amd/agesa/f16kb: Enable support for AM1 socket
Add check for AGESA_AM1_HACK to disable package check.
Default agesa for kabini doesn't know about AM1 socket
so it returns FALSE, that stops memory config code.
With this hack current agesa version will support AM1
Change-Id: I99e9cec5cd558087092cf195094df20489f6d3b5
Signed-off-by: Sergej Ivanov <getinaks(a)gmail.com>
---
src/vendorcode/amd/agesa/f16kb/Proc/Mem/Ps/mp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Ps/mp.c b/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Ps/mp.c
index 348f704..7132ce9 100644
--- a/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Ps/mp.c
+++ b/src/vendorcode/amd/agesa/f16kb/Proc/Mem/Ps/mp.c
@@ -489,7 +489,10 @@ MemPIsIdSupported (
return TRUE;
}
}
- return FALSE;
+ if (IS_ENABLED(CONFIG_AGESA_AM1_HACK))
+ return TRUE;
+ else
+ return FALSE;
}
/* -----------------------------------------------------------------------------*/