Leroy P Leahy (leroy.p.leahy(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13758
-gerrit
commit b0f26fdee9360b1589ef79a6ba4b6c456c0af133
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Sat Feb 20 17:15:33 2016 -0800
soc/intel/quark: Add the initial pieces required for ACPI tables
Enable ACPI tables
TEST=None
Change-Id: I38b90f54cd9b00b063557c08980e71851bf3059b
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/soc/intel/quark/Makefile.inc | 1 +
src/soc/intel/quark/acpi.c | 33 +++++++++++++++++++++++++++++++++
src/soc/intel/quark/include/soc/acpi.h | 26 ++++++++++++++++++++++++++
3 files changed, 60 insertions(+)
diff --git a/src/soc/intel/quark/Makefile.inc b/src/soc/intel/quark/Makefile.inc
index 90398d2..c89a97e 100644
--- a/src/soc/intel/quark/Makefile.inc
+++ b/src/soc/intel/quark/Makefile.inc
@@ -22,6 +22,7 @@ romstage-y += memmap.c
romstage-y += tsc_freq.c
romstage-$(CONFIG_ENABLE_BUILTIN_HSUART1) += uart_common.c
+ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
ramstage-y += chip.c
ramstage-y += memmap.c
ramstage-y += northcluster.c
diff --git a/src/soc/intel/quark/acpi.c b/src/soc/intel/quark/acpi.c
new file mode 100644
index 0000000..f43a74c
--- /dev/null
+++ b/src/soc/intel/quark/acpi.c
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2009 coresystems GmbH
+ * Copyright (C) 2014 Google Inc.
+ * Copyright (C) 2015-2016 Intel Corporation.
+ *
+ * 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.
+ */
+
+#include <soc/acpi.h>
+
+unsigned long acpi_fill_madt(unsigned long current)
+{
+ return current;
+}
+
+
+unsigned long acpi_fill_mcfg(unsigned long current)
+{
+ return current;
+}
+
+void acpi_fill_in_fadt(acpi_fadt_t *fadt)
+{
+}
diff --git a/src/soc/intel/quark/include/soc/acpi.h b/src/soc/intel/quark/include/soc/acpi.h
new file mode 100644
index 0000000..20350c2
--- /dev/null
+++ b/src/soc/intel/quark/include/soc/acpi.h
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google Inc.
+ * Copyright (C) 2015-2016 Intel Corporation.
+ *
+ * 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.
+ */
+
+#ifndef _SOC_ACPI_H_
+#define _SOC_ACPI_H_
+
+#include <arch/acpi.h>
+#include <arch/acpigen.h>
+
+void acpi_fill_in_fadt(acpi_fadt_t *fadt);
+
+#endif /* _SOC_ACPI_H_ */
+
Leroy P Leahy (leroy.p.leahy(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13759
-gerrit
commit d5370b8cfae2f261f6569bb99fcaabfefd46b98f
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Sat Feb 20 17:53:54 2016 -0800
mainboard/intel/galileo: Enable minimal ACPI tables
Enable the minimal ACPI tables. Initialize the FADT header and provide
an empty DSDT.
Testing on Galileo:
* Edit the src/mainboard/intel/galileo/Makefile.inc file:
* Add "select ADD_FSP_PDAT_FILE"
* Add "select ADD_FSP_RAW_BIN"
* Add "select ADD_RMU_FILE"
* Place the FSP.bin file in the location specified by CONFIG_FSP_FILE
* Place the pdat.bin files in the location specified by
CONFIG_FSP_PDAT_FILE
* Place the rmu.bin file in the location specified by CONFIG_RMU_FILE
* Build EDK2 CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc to generate
UEFIPAYLOAD.fd
* Edit .config file and add the following lines:
* CONFIG_PAYLOAD_ELF=y
* CONFIG_PAYLOAD_FILE="path to UEFIPAYLOAD.fd"
* Testing successful if:
* Outputs multiple lines of debug serial text
Change-Id: I2e30c8af2994c9f56d9ba4fe6bc35e133b1d2d6b
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/mainboard/intel/galileo/Kconfig | 1 +
src/mainboard/intel/galileo/acpi_tables.c | 38 +++++++++++++++++++++++++++++++
src/mainboard/intel/galileo/dsdt.asl | 27 ++++++++++++++++++++++
3 files changed, 66 insertions(+)
diff --git a/src/mainboard/intel/galileo/Kconfig b/src/mainboard/intel/galileo/Kconfig
index cae136f..f89232f 100644
--- a/src/mainboard/intel/galileo/Kconfig
+++ b/src/mainboard/intel/galileo/Kconfig
@@ -18,6 +18,7 @@ if BOARD_INTEL_GALILEO
config BOARD_SPECIFIC_OPTIONS
def_bool y
select BOARD_ROMSIZE_KB_8192
+ select HAVE_ACPI_TABLES
select PLATFORM_USES_FSP1_1
select SOC_INTEL_QUARK
diff --git a/src/mainboard/intel/galileo/acpi_tables.c b/src/mainboard/intel/galileo/acpi_tables.c
new file mode 100644
index 0000000..543d265
--- /dev/null
+++ b/src/mainboard/intel/galileo/acpi_tables.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ * Copyright (C) 2015-2016 Intel Corporation.
+ *
+ * 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.
+ */
+
+#include <string.h>
+#include <soc/acpi.h>
+
+void acpi_create_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
+{
+ acpi_header_t *header = &(fadt->header);
+
+ /* Initialize the FADT header */
+ memset((void *) fadt, 0, sizeof(acpi_fadt_t));
+ memcpy(header->signature, "FACP", 4);
+ header->length = sizeof(acpi_fadt_t);
+ header->revision = 5;
+ memcpy(header->oem_id, OEM_ID, 6);
+ memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+ memcpy(header->asl_compiler_id, ASLC, 4);
+ header->asl_compiler_revision = 1;
+
+ /* Fill in SoC specific values */
+ acpi_fill_in_fadt(fadt);
+
+ header->checksum = acpi_checksum((void *) fadt, header->length);
+}
diff --git a/src/mainboard/intel/galileo/dsdt.asl b/src/mainboard/intel/galileo/dsdt.asl
new file mode 100644
index 0000000..881c1b9
--- /dev/null
+++ b/src/mainboard/intel/galileo/dsdt.asl
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2015 Google Inc.
+ * Copyright (C) 2015-2016 Intel Corporation
+ *
+ * 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.
+ */
+
+DefinitionBlock(
+ "dsdt.aml",
+ "DSDT",
+ 0x05, // DSDT revision: ACPI v5.0
+ "Intel", // OEM id
+ "COREBOOT", // OEM table id
+ 0x20160220 // OEM revision
+)
+{
+}
the following patch was just integrated into master:
commit cda71b8dea96dc4f2567ee1638a5968ba29b8ac5
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Sat Feb 20 05:39:10 2016 -0800
console: Add higher baud rates
Enable baud rates of 230400, 460800 and 921600. Leave the default set
to 115200.
TEST=Build and run on Galileo at 921600.
Change-Id: I8e3980f33665bc183b454cf97c68e297f1b0502c
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
Reviewed-on: https://review.coreboot.org/13755
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
See https://review.coreboot.org/13755 for details.
-gerrit
Joseph Pillow (joseph.a.pillow(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13752
-gerrit
commit 7cc9c80862539fe22725beb2981c0f6a844b899c
Author: Joe Pillow <joseph.a.pillow(a)gmail.com>
Date: Fri Feb 19 15:18:14 2016 -0800
util: Add scripts to download and extract blobs
This turned out really handy when I tried to build coreboot
for my Chromebox.
These scripts can be used to extract System Agent reference code
and other blobs (e.g. mrc.bin, refcode, VGA option roms) from a
Chrome OS recovery image.
crosfirmware.sh downloads a Chrome OS recovery image from the recovery
image server, unpacks it, extracts the firmware update shell archive,
extracts the firmware images from the shell archive.
To download all Chrome OS firmware images, run
$ ./crosfirmware.sh
To download, e.g. the Panther firmware image, run
$ ./crosfirmware.sh panther
extract_blobs.sh extracts the blobs from a Chrome OS firmware image.
Right now it will produce the ME firmware blob, IFD, VGA option rom,
and mrc.bin
Change-Id: I5fb7e14b10e03e18cd360bc35f1dc92e8ed34e63
Signed-off-by: Joe Pillow <joseph.a.pillow(a)gmail.com>
---
util/chromeos/README.md | 27 ++++++++
util/chromeos/crosfirmware.sh | 140 +++++++++++++++++++++++++++++++++++++++++
util/chromeos/extract_blobs.sh | 51 +++++++++++++++
3 files changed, 218 insertions(+)
diff --git a/util/chromeos/README.md b/util/chromeos/README.md
new file mode 100644
index 0000000..3c3d721
--- /dev/null
+++ b/util/chromeos/README.md
@@ -0,0 +1,27 @@
+Chrome OS binary extraction
+===========================
+
+These scripts can be used to extract System Agent reference code
+and other blobs (e.g. mrc.bin, refcode, VGA option roms) from a
+Chrome OS recovery image.
+
+crosfirmware.sh
+---------------
+
+crosfirmware.sh downloads a Chrome OS recovery image from the recovery
+image server, unpacks it, extracts the firmware update shell archive,
+extracts the firmware images from the shell archive.
+
+To download all Chrome OS firmware images, run
+$ ./crosfirmware.sh
+
+To download, e.g. the Panther firmware image, run
+$ ./crosfirmware.sh panther
+
+extract_blobs.sh
+----------------
+
+extract_blobs.sh extracts the blobs from a Chrome OS firmware image.
+
+Right now it will produce the ME firmware blob, IFD, VGA option rom,
+and mrc.bin
diff --git a/util/chromeos/crosfirmware.sh b/util/chromeos/crosfirmware.sh
new file mode 100644
index 0000000..a4cb487
--- /dev/null
+++ b/util/chromeos/crosfirmware.sh
@@ -0,0 +1,140 @@
+#!/bin/bash -x
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2016 Joe Pillow
+#
+# 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.
+#
+
+# This script needs
+# * sharutils
+
+#DEBUG=1
+
+debug()
+{
+ test "$DEBUG" == "1" && echo "$*"
+}
+
+get_inventory()
+{
+ _conf=$1
+ _url=https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf
+
+ debug "Downloading recovery image inventory..."
+
+ curl -s "$_url" > $_conf
+}
+
+download_image()
+{
+ _url=$1
+ _file=$2
+
+ debug "Downloading recovery image"
+ curl -s "$_url" > "$_file.zip"
+ debug "Decompressing recovery image"
+ unzip -q "$_file.zip"
+ rm "$_file.zip"
+}
+
+extract_partition()
+{
+ NAME=$1
+ FILE=$2
+ ROOTFS=$3
+ _bs=1024
+
+ debug "Extracting ROOT-A partition"
+ ROOTP=$( printf "unit\nB\nprint\nquit\n" | parted $FILE | grep $NAME )
+
+ START=$(( $( echo $ROOTP | cut -f2 -d\ | tr -d "B" ) ))
+ SIZE=$(( $( echo $ROOTP | cut -f4 -d\ | tr -d "B" ) ))
+
+ dd if=$FILE of=$ROOTFS bs=$_bs skip=$(( $START / $_bs )) \
+ count=$(( $SIZE / $_bs )) > /dev/null 2>&1
+}
+
+extract_shellball()
+{
+ ROOTFS=$1
+ SHELLBALL=$2
+
+ debug "Extracting chromeos-firmwareupdate"
+ printf "cd /usr/sbin\ndump chromeos-firmwareupdate $SHELLBALL\nquit" | \
+ debugfs $ROOTFS > /dev/null 2>&1
+}
+
+extract_coreboot()
+{
+ _shellball=$1
+ _unpacked=$( mktemp -d )
+
+ debug "Extracting coreboot image"
+ sh $_shellball --sb_extract $_unpacked > /dev/null
+
+ _version=$( cat $_unpacked/VERSION | grep BIOS\ version: | \
+ cut -f2 -d: | tr -d \ )
+
+ cp $_unpacked/bios.bin coreboot-$_version.bin
+ rm -r "$_unpacked"
+}
+
+do_one_board()
+{
+ _board=$1
+ _url=$2
+ _file=$3
+
+ download_image $_url $_file
+
+ extract_partition ROOT-A $_file root-a.ext2
+ extract_shellball root-a.ext2 chromeos-firmwareupdate-$_board
+ rm $_file root-a.ext2
+
+ extract_coreboot chromeos-firmwareupdate-$_board
+}
+
+#
+# Main
+#
+
+BOARD=$1
+
+if [ "$BOARD" == "all" ]; then
+ CONF=$( mktemp )
+ get_inventory $CONF
+
+ grep ^name= $CONF| while read _line; do
+ name=$( echo $_line | cut -f2 -d= )
+ echo Processing board $name
+ eval $( grep -v hwid= $CONF | grep -A11 "$_line" | \
+ grep '\(url=\|file=\)' )
+ BOARD=$( echo $url | cut -f3 -d_ )
+ do_one_board $BOARD $url $file
+ done
+
+ rm "$CONF"
+elif [ "$BOARD" != "" ]; then
+ CONF=$( mktemp )
+ get_inventory $CONF
+
+ echo Processing board $BOARD
+ eval $( grep $BOARD $CONF | grep '\(url=\|file=\)' )
+ do_one_board $BOARD $url $file
+
+ rm "$CONF"
+else
+ echo "Usage: $0 <boardname>"
+ echo " $0 all"
+ echo
+ exit 1
+fi
diff --git a/util/chromeos/extract_blobs.sh b/util/chromeos/extract_blobs.sh
new file mode 100644
index 0000000..3067ae6
--- /dev/null
+++ b/util/chromeos/extract_blobs.sh
@@ -0,0 +1,51 @@
+#!/bin/bash -x
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2016 Joe Pillow
+#
+# 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.
+#
+
+IMAGE=$1
+
+if [ ! -r "$IMAGE" ]; then
+ echo "Can't find image $IMAGE."
+ exit 1
+fi
+
+CBFSTOOL=$(which cbfstool)
+if [ $? != 0 ]; then
+ echo "Can't find cbfstool."
+ exit 1
+fi
+
+IFDTOOL=$(which ifdtool)
+if [ $? != 0 ]; then
+ echo "Can't find cbfstool."
+ exit 1
+fi
+
+$CBFSTOOL $IMAGE print
+
+if [ $? -ne 0 ]; then
+ echo "Not a coreboot image: $IMAGE"
+ exit 1
+fi
+
+PCI=$($CBFSTOOL $IMAGE print|grep pci|cut -f1 -d\ )
+MRC=$($CBFSTOOL $IMAGE print|grep mrc.bin|cut -f1 -d\ )
+
+$CBFSTOOL $IMAGE extract -n $PCI -f $PCI
+$CBFSTOOL $IMAGE extract -n $MRC -f $MRC
+$IFDTOOL -x $IMAGE
+mv flashregion_0_flashdescriptor.bin flashdescriptor.bin
+mv flashregion_2_intel_me.bin me.bin
+rm flashregion_*.bin
Joseph Pillow (joseph.a.pillow(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13752
-gerrit
commit cb12620159e8eebdcb9259dfc300a422b0e72a42
Author: Joe Pillow <joseph.a.pillow(a)gmail.com>
Date: Fri Feb 19 15:18:14 2016 -0800
util: Add scripts to download and extract blobs
This turned out really handy when I tried to build coreboot
for my Chromebox.
These scripts can be used to extract System Agent reference code
and other blobs (e.g. mrc.bin, refcode, VGA option roms) from a
Chrome OS recovery image.
crosfirmware.sh downloads a Chrome OS recovery image from the recovery
image server, unpacks it, extracts the firmware update shell archive,
extracts the firmware images from the shell archive.
To download all Chrome OS firmware images, run
$ ./crosfirmware.sh
To download, e.g. the Panther firmware image, run
$ ./crosfirmware.sh panther
extract_blobs.sh extracts the blobs from a Chrome OS firmware image.
Right now it will produce the ME firmware blob, IFD, VGA option rom,
and mrc.bin
Change-Id: I5fb7e14b10e03e18cd360bc35f1dc92e8ed34e63
Signed-off-by: Joe Pillow <joseph.a.pillow(a)gmail.com>
---
util/chromeos/README.md | 24 +++++++
util/chromeos/crosfirmware.sh | 140 +++++++++++++++++++++++++++++++++++++++++
util/chromeos/extract_blobs.sh | 39 ++++++++++++
3 files changed, 203 insertions(+)
diff --git a/util/chromeos/README.md b/util/chromeos/README.md
new file mode 100644
index 0000000..64736d2
--- /dev/null
+++ b/util/chromeos/README.md
@@ -0,0 +1,24 @@
+= Chrome OS binary extraction =
+
+These scripts can be used to extract System Agent reference code
+and other blobs (e.g. mrc.bin, refcode, VGA option roms) from a
+Chrome OS recovery image.
+
+== crosfirmware.sh ==
+
+crosfirmware.sh downloads a Chrome OS recovery image from the recovery
+image server, unpacks it, extracts the firmware update shell archive,
+extracts the firmware images from the shell archive.
+
+To download all Chrome OS firmware images, run
+$ ./crosfirmware.sh
+
+To download, e.g. the Panther firmware image, run
+$ ./crosfirmware.sh panther
+
+== extract_blobs.sh ==
+
+extract_blobs.sh extracts the blobs from a Chrome OS firmware image.
+
+Right now it will produce the ME firmware blob, IFD, VGA option rom,
+and mrc.bin
diff --git a/util/chromeos/crosfirmware.sh b/util/chromeos/crosfirmware.sh
new file mode 100644
index 0000000..6758d81
--- /dev/null
+++ b/util/chromeos/crosfirmware.sh
@@ -0,0 +1,140 @@
+#!/bin/bash -x
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2016 Joe Pillow
+#
+# 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.
+#
+
+# This script needs
+# * sharutils
+
+#DEBUG=1
+
+debug()
+{
+ test "$DEBUG" == "1" && echo "$*"
+}
+
+get_inventory()
+{
+ _conf=$1
+ _url=https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf
+
+ debug "Downloading recovery image inventory..."
+
+ curl -s "$_url" > $_conf
+}
+
+download_image()
+{
+ _url=$1
+ _file=$2
+
+ debug "Downloading recovery image"
+ curl -s "$_url" > "$_file.zip"
+ debug "Decompressing recovery image"
+ unzip -q "$_file.zip"
+ rm "$_file.zip"
+}
+
+extract_partition()
+{
+ NAME=$1
+ FILE=$2
+ ROOTFS=$3
+ _bs=1024
+
+ debug "Extracting ROOT-A partition"
+ ROOTP=$( printf "unit\nB\nprint\nquit\n" | parted $FILE | grep $NAME )
+
+ START=$(( $( echo $ROOTP | cut -f2 -d\ | tr -d "B" ) ))
+ SIZE=$(( $( echo $ROOTP | cut -f4 -d\ | tr -d "B" ) ))
+
+ dd if=$FILE of=$ROOTFS bs=$_bs skip=$(( $START / $_bs )) \
+ count=$(( $SIZE / $_bs )) > /dev/null 2>&1
+}
+
+extract_shellball()
+{
+ ROOTFS=$1
+ SHELLBALL=$2
+
+ debug "Extracting chromeos-firmwareupdate"
+ printf "cd /usr/sbin\ndump chromeos-firmwareupdate $SHELLBALL\nquit" | \
+ debugfs $ROOTFS > /dev/null 2>&1
+}
+
+extract_coreboot()
+{
+ _shellball=$1
+ _unpacked=$( mktemp -d )
+
+ debug "Extracting coreboot image"
+ sh $_shellball --sb_extract $_unpacked > /dev/null
+
+ _version=$( cat $_unpacked/VERSION | grep BIOS\ version: | \
+ cut -f2 -d: | tr -d \ )
+
+ cp $_unpacked/bios.bin coreboot-$_version.bin
+ rm -r "$_unpacked"
+}
+
+do_one_board()
+{
+ _board=$1
+ _url=$2
+ _file=$3
+
+ download_image $_url $_file
+
+ extract_partition ROOT-A $_file root-a.ext2
+ extract_shellball root-a.ext2 chromeos-firmwareupdate-$_board
+ rm $file root-a.ext2
+
+ extract_coreboot chromeos-firmwareupdate-$_board
+}
+
+#
+# Main
+#
+
+BOARD=$1
+
+if [ "$BOARD" == "all" ]; then
+ CONF=$( mktemp )
+ get_inventory $CONF
+
+ grep ^name= $CONF| while read _line; do
+ name=$( echo $_line | cut -f2 -d= )
+ echo Processing board $name
+ eval $( grep -v hwid= $CONF | grep -A11 "$_line" | \
+ grep '\(url=\|file=\)' )
+ BOARD=$( echo $url | cut -f3 -d_ )
+ do_one_board $BOARD $url $file
+ done
+
+ rm "$CONF"
+elif [ "$BOARD" != "" ]; then
+ CONF=$( mktemp )
+ get_inventory $CONF
+
+ echo Processing board $BOARD
+ eval $( grep $BOARD $CONF | grep '\(url=\|file=\)' )
+ do_one_board $BOARD $url $file
+
+ rm "$CONF"
+else
+ echo "Usage: $0 <boardname>"
+ echo " $0 all"
+ echo
+ exit 1
+fi
diff --git a/util/chromeos/extract_blobs.sh b/util/chromeos/extract_blobs.sh
new file mode 100644
index 0000000..902a2d2
--- /dev/null
+++ b/util/chromeos/extract_blobs.sh
@@ -0,0 +1,39 @@
+#!/bin/bash -x
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2016 Joe Pillow
+#
+# 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.
+#
+
+IMAGE=$1
+
+if [ ! -r "$IMAGE" ]; then
+ echo "Can't find image $IMAGE"
+ exit 1
+fi
+
+cbfstool $IMAGE print
+
+if [ $? -ne 0 ]; then
+ echo "Not a coreboot image: $IMAGE"
+ exit 1
+fi
+
+PCI=$(cbfstool $IMAGE print|grep pci|cut -f1 -d\ )
+MRC=$(cbfstool $IMAGE print|grep mrc.bin|cut -f1 -d\ )
+
+cbfstool $IMAGE extract -n $PCI -f $PCI
+cbfstool $IMAGE extract -n $MRC -f $MRC
+ifdtool -x $IMAGE
+mv flashregion_0_flashdescriptor.bin flashdescriptor.bin
+mv flashregion_2_intel_me.bin me.bin
+rm flashregion_*.bin
\ No newline at end of file
Denis Carikli (GNUtoo(a)no-log.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13763
-gerrit
commit 6a762d2f1cc7fb19e190e28be821b93779bd514b
Author: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
Date: Sun Feb 21 14:27:21 2016 +0100
util: Add a very simple utility to test POST cards.
It was tested with a mini-PCI POST card on a Toshiba
Satelite 1410 laptop with the stock BIOS.
Change-Id: Icdc0860e2c72b17862601c2cc59eaf0f3d8a0e54
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
---
util/post/.gitignore | 1 +
util/post/Makefile | 4 +++
util/post/README | 1 +
util/post/post.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 97 insertions(+)
diff --git a/util/post/.gitignore b/util/post/.gitignore
new file mode 100644
index 0000000..8b1e502
--- /dev/null
+++ b/util/post/.gitignore
@@ -0,0 +1 @@
+post
diff --git a/util/post/Makefile b/util/post/Makefile
new file mode 100644
index 0000000..d0a3eb9
--- /dev/null
+++ b/util/post/Makefile
@@ -0,0 +1,4 @@
+all:
+ $(CC) post.c -o post
+clean:
+ rm -f post
diff --git a/util/post/README b/util/post/README
new file mode 100644
index 0000000..95b33a9
--- /dev/null
+++ b/util/post/README
@@ -0,0 +1 @@
+This is a very simple userspace utility that can be used to test POST cards.
diff --git a/util/post/post.c b/util/post/post.c
new file mode 100644
index 0000000..04dbc32
--- /dev/null
+++ b/util/post/post.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 Denis 'GNUtoo' Carikli <GNUtoo(a)no-log.org>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/io.h>
+
+#define POST_DEFAULT_IO_PORT 0x80
+
+void usage(char *progname, const char *error, ...)
+{
+ printf("Usage: %s <VALUE> [PORT]\n", progname);
+ printf("The VALUE argument is an integer between 0x00 and 0xff\n");
+ printf("The PORT argument is an integer between 0x00 and 0xffff\n");
+
+ if (error) {
+ va_list args;
+
+ va_start(args, error);
+ vprintf(error, args);
+ va_end(args);
+ };
+}
+
+void check_int(long val, int min, int max, int err, char *string, char *endptr,
+ char *progname)
+{
+ if (val < min || val > max) {
+ usage(progname,
+ "\nError: The Value has to be between 0x%x and 0x%x\n",
+ min, max);
+ exit(EXIT_FAILURE);
+ }
+
+ if (endptr == string || *endptr != '\0') {
+ usage(progname, "\nError: An integer is required\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if ((err) && (!val)) {
+ perror("strtol");
+ exit(EXIT_FAILURE);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ unsigned long val;
+ unsigned long port = POST_DEFAULT_IO_PORT;
+ char *endptr;
+ int err;
+
+ if (argc != 2 && argc != 3) {
+ usage(argv[0], NULL);
+ exit(EXIT_FAILURE);
+ }
+
+ val = strtol(argv[1], &endptr, 0);
+ err = errno;
+ check_int(val, 0x00, 0xff, err, argv[1], endptr, argv[0]);
+
+ if (argc > 2) {
+ port = strtol(argv[2], &endptr, 0);
+ err = errno;
+ check_int(port, 0x0000, 0xffff, err, argv[2], endptr, argv[0]);
+ }
+
+ err = iopl(3);
+ if (err == -1) {
+ perror("Not root");
+ exit(EXIT_FAILURE);
+ }
+
+ outb(val, port);
+
+ return 0;
+}