You-Cheng Syu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32333
Change subject: util/mtkheader: Add a tool to extract bootload header from binary files.
......................................................................
util/mtkheader: Add a tool to extract bootload header from binary files.
Add a tool, extract-bl-img.py, which can extract MTK bootload header
from binary files. This could be useful for boards (e.g., Kukui) which
put the bootblock in other places (e.g., Chrome EC).
Change-Id: Ib744c80bdc2adfe27d4287365e161096e3fe08c7
Signed-off-by: You-Cheng Syu <youcheng(a)google.com>
---
A util/mtkheader/extract-bl-img.py
1 file changed, 55 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/32333/1
diff --git a/util/mtkheader/extract-bl-img.py b/util/mtkheader/extract-bl-img.py
new file mode 100755
index 0000000..21bf9eb
--- /dev/null
+++ b/util/mtkheader/extract-bl-img.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# This file is part of the coreboot project.
+#
+# Copyright 2019 Google 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.
+
+import argparse
+import struct
+import sys
+
+
+_DESCRIPTION = 'Extract MTK bootload header from a binary file.'
+
+
+def parse_args():
+ parser = argparse.ArgumentParser(description=_DESCRIPTION)
+ parser.add_argument('input_path', metavar='INPUT_FILE')
+ parser.add_argument('output_path', metavar='OUTPUT_FILE')
+ return parser.parse_args()
+
+
+def main():
+ args = parse_args()
+
+ with open(args.input_path, 'rb') as f:
+ data = f.read()
+
+ header = struct.pack('<8sII', 'BRLYT', 1, 2048)
+
+ start = -1
+ while True:
+ start = data.find(header, start + 1)
+ if start < 0:
+ raise RuntimeError('Cannot find MTK bootload header')
+ offset = start + len(header)
+ buf = struct.unpack('<II', data[offset:offset+8])
+ if buf[1] == 0x42424242:
+ break
+ size = buf[0]
+ offset = start - 512
+
+ with open(args.output_path, 'wb') as f:
+ f.write(data[offset:offset+size])
+
+
+if __name__ == '__main__':
+ main()
--
To view, visit https://review.coreboot.org/c/coreboot/+/32333
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib744c80bdc2adfe27d4287365e161096e3fe08c7
Gerrit-Change-Number: 32333
Gerrit-PatchSet: 1
Gerrit-Owner: You-Cheng Syu <youcheng(a)google.com>
Gerrit-MessageType: newchange
Daniel Maslowski has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33008
Change subject: sb/intel/lynxpoint: Fix flashconsole after lockdown
......................................................................
sb/intel/lynxpoint: Fix flashconsole after lockdown
Same as with sb/intel/bd82x6x:
SMM final locks the SPI BAR, which causes flashconsole to hang.
Re-init it like SMM does with CONFIG_SPI_FLASH_SMM.
Change-Id: Ie35af9610ebbba5c66351e9668e9a55cae3c7520
Signed-off-by: Daniel Maslowski <dan(a)orangecms.org>
---
M src/southbridge/intel/lynxpoint/lpc.c
1 file changed, 9 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/33008/1
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index b0f57c1..714c696 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -965,8 +965,16 @@
RCBA32(0x3898) = SPI_OPMENU_LOWER;
RCBA32(0x389c) = SPI_OPMENU_UPPER;
- if (acpi_is_wakeup_s3() || CONFIG(INTEL_CHIPSET_LOCKDOWN))
+ if (acpi_is_wakeup_s3() || CONFIG(INTEL_CHIPSET_LOCKDOWN)) {
outb(APM_CNT_FINALIZE, APM_CNT);
+ if (CONFIG(CONSOLE_SPI_FLASH)) {
+ /* Re-init SPI driver to handle locked BAR.
+ This prevents flashconsole from hanging.
+ If other code needs to use SPI during
+ ramstage, whitelist it here. */
+ spi_init();
+ }
+ }
}
static struct pci_operations pci_ops = {
--
To view, visit https://review.coreboot.org/c/coreboot/+/33008
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie35af9610ebbba5c66351e9668e9a55cae3c7520
Gerrit-Change-Number: 33008
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Maslowski <info(a)orangecms.org>
Gerrit-MessageType: newchange