code:
From 260f0e096b385c9f53e9a28e79293131a11122a6 Mon Sep 17 00:00:00 2001
From: Leah Rowe <info@minifree.org>
Date: Fri, 11 Mar 2016 06:50:50 +0000
Subject: [PATCH 1/1] purged chips

---
 flashchips.c | 303 -----------------------------------------------------------
 1 file changed, 303 deletions(-)

diff --git a/flashchips.c b/flashchips.c
index 0fc1b7a..5c94304 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -7451,80 +7451,6 @@ const struct flashchip flashchips[] = {

 	{
 		.vendor		= "Macronix",
-		.name		= "MX25L1605",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L1605,
-		.total_size	= 2048,
-		.page_size	= 256,
-		.feature_bits	= FEATURE_WRSR_WREN,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {64 * 1024, 32} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {64 * 1024, 32} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {2 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {2 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			},
-		},
-		.printlock	= spi_prettyprint_status_register_bp2_srwd, /* bit6: error flag */
-		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
-		.name		= "MX25L1605A/MX25L1606E/MX25L1608E",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L1605,
-		.total_size	= 2048,
-		.page_size	= 256,
-		/* OTP: 64B total; enter 0xB1, exit 0xC1 (MX25L1606E and MX25L1608E only) */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {4 * 1024, 512} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {64 * 1024, 32} },
-				.block_erase = spi_block_erase_52,
-			}, {
-				.eraseblocks = { {64 * 1024, 32} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {2 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {2 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			},
-		},
-		.printlock	= spi_prettyprint_status_register_bp3_srwd, /* MX25L1605A bp2 only */
-		.unlock		= spi_disable_blockprotect_bp3_srwd,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) supported (MX25L1608E supports dual-I/O read) */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
 		.name		= "MX25L1605D/MX25L1608D/MX25L1673E",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= MACRONIX_ID,
@@ -7632,41 +7558,6 @@ const struct flashchip flashchips[] = {

 	{
 		.vendor		= "Macronix",
-		.name		= "MX25L3205(A)",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L3205,
-		.total_size	= 4096,
-		.page_size	= 256,
-		.feature_bits	= FEATURE_WRSR_WREN,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {64 * 1024, 64} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {64 * 1024, 64} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {4 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {4 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			},
-		},
-		.printlock	= spi_prettyprint_status_register_bp2_srwd, /* bit6: error flag */
-		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
 		.name		= "MX25L3205D/MX25L3208D",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= MACRONIX_ID,
@@ -7703,84 +7594,6 @@ const struct flashchip flashchips[] = {

 	{
 		.vendor		= "Macronix",
-		.name		= "MX25L3206E/MX25L3208E",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L3205,
-		.total_size	= 4096,
-		.page_size	= 256,
-		/* OTP: 64B total; enter 0xB1, exit 0xC1 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {4 * 1024, 1024} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {64 * 1024, 64} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {64 * 1024, 64} },
-				.block_erase = spi_block_erase_52,
-			}, {
-				.eraseblocks = { {4 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {4 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			},
-		},
-		.printlock	= spi_prettyprint_status_register_bp3_srwd,
-		.unlock		= spi_disable_blockprotect_bp3_srwd,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) and dual I/O supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
-		.name		= "MX25L3273E",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L3205,
-		.total_size	= 4096,
-		.page_size	= 256,
-		/* OTP: 64B total; enter 0xB1, exit 0xC1 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {4 * 1024, 1024} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {32 * 1024, 128} },
-				.block_erase = spi_block_erase_52,
-			}, {
-				.eraseblocks = { {64 * 1024, 64} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {4 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {4 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			},
-		},
-		.printlock	= spi_prettyprint_status_register_bp3_srwd,
-		.unlock		= spi_disable_blockprotect_bp3_srwd,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) and dual I/O supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
 		.name		= "MX25L3235D",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= MACRONIX_ID,
@@ -7817,42 +7630,6 @@ const struct flashchip flashchips[] = {

 	{
 		.vendor		= "Macronix",
-		.name		= "MX25L6405",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L6405,
-		.total_size	= 8192,
-		.page_size	= 256,
-		/* Has an additional 512B EEPROM sector */
-		.feature_bits	= FEATURE_WRSR_WREN,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {64 * 1024, 128} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {64 * 1024, 128} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {8 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {8 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			}
-		},
-		.printlock	= spi_prettyprint_status_register_bp3_srwd, /* bit6: error flag */
-		.unlock		= spi_disable_blockprotect_bp3_srwd,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
 		.name		= "MX25L6405D",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= MACRONIX_ID,
@@ -7889,86 +7666,6 @@ const struct flashchip flashchips[] = {

 	{
 		.vendor		= "Macronix",
-		.name		= "MX25L6406E/MX25L6408E",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L6405,
-		.total_size	= 8192,
-		.page_size	= 256,
-		/* MX25L6406E supports SFDP */
-		/* OTP: 06E 64B total; enter 0xB1, exit 0xC1 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {4 * 1024, 2048} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {64 * 1024, 128} },
-				.block_erase = spi_block_erase_52,
-			}, {
-				.eraseblocks = { {64 * 1024, 128} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {8 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {8 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			}
-		},
-		.printlock	= spi_prettyprint_status_register_bp3_srwd,
-		.unlock		= spi_disable_blockprotect_bp3_srwd,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B), dual I/O read supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
-		.name		= "MX25L6436E/MX25L6445E/MX25L6465E/MX25L6473E",
-		.bustype	= BUS_SPI,
-		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L6405,
-		.total_size	= 8192,
-		.page_size	= 256,
-		/* supports SFDP */
-		/* OTP: 512B total; enter 0xB1, exit 0xC1 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
-		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
-		.probe_timing	= TIMING_ZERO,
-		.block_erasers	=
-		{
-			{
-				.eraseblocks = { {4 * 1024, 2048} },
-				.block_erase = spi_block_erase_20,
-			}, {
-				.eraseblocks = { {32 * 1024, 256} },
-				.block_erase = spi_block_erase_52,
-			}, {
-				.eraseblocks = { {64 * 1024, 128} },
-				.block_erase = spi_block_erase_d8,
-			}, {
-				.eraseblocks = { {8 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_60,
-			}, {
-				.eraseblocks = { {8 * 1024 * 1024, 1} },
-				.block_erase = spi_block_erase_c7,
-			}
-		},
-		.printlock	= spi_prettyprint_status_register_bp3_srwd, /* bit6 is quad enable */
-		.unlock		= spi_disable_blockprotect_bp3_srwd,
-		.write		= spi_chip_write_256,
-		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
-		.voltage	= {2700, 3600},
-	},
-
-	{
-		.vendor		= "Macronix",
 		.name		= "MX25L12805D",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= MACRONIX_ID,
--
1.9.1


code:
From 8c970dcf19661bc3d128a10e3ca79c24b4479186 Mon Sep 17 00:00:00 2001
From: Gauvain Roussel-Tarbouriech <govanify@protonmail.com>
Date: Sat, 29 Apr 2017 19:01:11 +0200
Subject: [PATCH 1/1] Whitelist ThinkPad W500

---
 board_enable.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board_enable.c b/board_enable.c
index fc99615..a418e4f 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2430,6 +2430,7 @@ const struct board_match board_matches[] = {
     {0x8086, 0x2917, 0x17AA, 0x20F5,  0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad R400", NULL, NULL,      P2, "IBM/Lenovo",  "ThinkPad R400",         0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x2917, 0x17AA, 0x20F5,  0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad T400", NULL, NULL,       P2, "IBM/Lenovo",  "ThinkPad T400",         0,   OK, p2_whitelist_laptop},
     {0x8086, 0x2917, 0x17AA, 0x20F5,  0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad T500", NULL, NULL,      P2, "IBM/Lenovo",  "ThinkPad T500",         0,   OK, p2_whitelist_laptop},
+	{0x8086, 0x2917, 0x17AA, 0x20F5,  0x8086, 0x2930, 0x17AA, 0x20F9, "^ThinkPad W500", NULL, NULL,      P2, "IBM/Lenovo",  "ThinkPad W500",         0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x1E22, 0x17AA, 0x21F6,  0x8086, 0x1E55, 0x17AA, 0x21F6, "^ThinkPad T530", NULL, NULL,       P2, "IBM/Lenovo",  "ThinkPad T530",         0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x27a0, 0x17aa, 0x2015,  0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad T60", NULL, NULL,        P2, "IBM/Lenovo",  "ThinkPad T60",          0,   OK, p2_whitelist_laptop},
 	{0x8086, 0x27a0, 0x17aa, 0x2017,  0x8086, 0x27b9, 0x17aa, 0x2009, "^ThinkPad T60", NULL, NULL,        P2, "IBM/Lenovo",  "ThinkPad T60(s)",       0,   OK, p2_whitelist_laptop},
--
2.12.2

license: mit


code:
diff --git a/cli_classic.c b/cli_classic.c
index 0a09cfd..9eeafe1 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -61,6 +61,7 @@ static void cli_classic_usage(const char *name)
 	       " -i | --image <name>                only flash image <name> from flash layout\n"
 	       " -o | --output <logfile>            log output to <logfile>\n"
 	       " -L | --list-supported              print supported devices\n"
+	       "    | --workaround-mx               keep flash busy before sending command\n"
 #if CONFIG_PRINT_WIKI == 1
 	       " -z | --list-supported-wiki         print supported devices in wiki syntax\n"
 #endif
@@ -130,6 +131,7 @@ int main(int argc, char *argv[])
 		{"help",		0, NULL, 'h'},
 		{"version",		0, NULL, 'R'},
 		{"output",		1, NULL, 'o'},
+		{"workaround-mx", 	0, NULL, 0x0101},
 		{NULL,			0, NULL, 0},
 	};

@@ -337,6 +339,9 @@ int main(int argc, char *argv[])
 			}
 #endif /* STANDALONE */
 			break;
+		case 0x0101: /* --workaround-mx */
+		    	workaround_mx = 1;
+		    	break;
 		default:
 			cli_classic_abort_usage();
 			break;
diff --git a/programmer.h b/programmer.h
index 1a6216a..6f97cfc 100644
--- a/programmer.h
+++ b/programmer.h
@@ -650,6 +650,7 @@ enum ich_chipset {
 	CHIPSET_8_SERIES_WELLSBURG,
 	CHIPSET_9_SERIES_WILDCAT_POINT,
 };
+extern int workaround_mx; /* workaround for MX25* chips, makes flash operations more reliable, less failures */

 /* ichspi.c */
 #if CONFIG_INTERNAL == 1
diff --git a/spi.c b/spi.c
index 894f73f..05aa5d0 100644
--- a/spi.c
+++ b/spi.c
@@ -30,10 +30,19 @@
 #include "programmer.h"
 #include "spi.h"

+int workaround_mx; /* Make operations with MX25* chips more reliable */
+
 int spi_send_command(struct flashctx *flash, unsigned int writecnt,
 		     unsigned int readcnt, const unsigned char *writearr,
 		     unsigned char *readarr)
 {
+	if (workaround_mx) {
+		const unsigned char cmd[JEDEC_READ_OUTSIZE] = {JEDEC_READ, 0, 0, 0};
+		unsigned char buf[256];
+		/* keep flash busy for some time, keep CS warm before sending actual command */
+		flash->mst->spi.command(flash, sizeof(cmd), sizeof(buf), cmd, buf);
+	}
+	/* actual command */
 	return flash->mst->spi.command(flash, writecnt, readcnt, writearr,
 				       readarr);
 }


code:
From aa2dd05f61f6ca91212d7f6d4055486af6e01436 Mon Sep 17 00:00:00 2001
From: Leah Rowe <info@minifree.org>
Date: Fri, 5 Aug 2016 22:40:49 +0200
Subject: [PATCH] Lenovobios adaptation for Macronix and SST chips

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 flashchips.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/flashchips.c b/flashchips.c
index e5ea181..f3a017c 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -7454,12 +7454,12 @@ const struct flashchip flashchips[] = {
 		.name		= "MX25L1605D/MX25L1608D/MX25L1673E",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= MACRONIX_ID,
-		.model_id	= MACRONIX_MX25L1605,
+		.model_id	= 0x14,
 		.total_size	= 2048,
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
+		.probe		= probe_spi_res1,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
@@ -9857,7 +9857,7 @@ const struct flashchip flashchips[] = {
 		},
 		.printlock	= spi_prettyprint_status_register_bp2_srwd,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_chip_write_256,
+		.write		= spi_chip_write_1,
 		.read		= spi_chip_read, /* Fast read (0x0B), dual I/O supported */
 		.voltage	= {2700, 3600},
 	},
@@ -12150,12 +12150,12 @@ const struct flashchip flashchips[] = {
 		.name		= "SST25VF016B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= SST_ID,
-		.model_id	= SST_SST25VF016B,
+		.model_id	= 0x41,
 		.total_size	= 2048,
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_EITHER,
 		.tested		= TEST_OK_PREW,
-		.probe		= probe_spi_rdid,
+		.probe		= probe_spi_res2,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
@@ -12178,7 +12178,7 @@ const struct flashchip flashchips[] = {
 		},
 		.printlock	= spi_prettyprint_status_register_sst25vf016,
 		.unlock		= spi_disable_blockprotect,
-		.write		= spi_aai_write,
+		.write		= spi_chip_write_1,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
--
2.9.0


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

arguments() {
	project_arguments_targets "$project" "$@"
}

usage() {
	project_usage_actions "$project"
	project_usage_arguments "$project" "$@"
}

download() {
	local repository="$project"

	project_download_git "$project" \
			     "$repository" \
			     'https://anongit.freedesktop.org/git/fontconfig' \
			     "$@"
}

download_check() {
	local repository="$project"

	project_download_check_git "$project" "$repository" "$@"
}

extract() {
	local repository="$project"

	project_extract "$project" "$@"
}

extract_check() {
	local repository="$project"

	project_extract_check "$project" "$@"
}

update() {
	local repository="$project"

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository="$project"

	project_update_check_git "$project" "$repository" "$@"
}

release() {
	local repository="$project"

	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository="$project"

	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/fontconfig/fontconfig


code:
set root=(cbfsdisk)
source (cbfsdisk)/fallback/grub.cfg

path: projects/grub/configs/bios/config


code:
i386-pc/acpi.mod:i386-pc/acpi.mod
i386-pc/adler32.mod:i386-pc/adler32.mod
i386-pc/affs.mod:i386-pc/affs.mod
i386-pc/afs.mod:i386-pc/afs.mod
i386-pc/ahci.mod:i386-pc/ahci.mod
i386-pc/all_video.mod:i386-pc/all_video.mod
i386-pc/archelp.mod:i386-pc/archelp.mod
i386-pc/ata.mod:i386-pc/ata.mod
i386-pc/at_keyboard.mod:i386-pc/at_keyboard.mod
i386-pc/backtrace.mod:i386-pc/backtrace.mod
i386-pc/bfs.mod:i386-pc/bfs.mod
i386-pc/biosdisk.mod:i386-pc/biosdisk.mod
i386-pc/bitmap.mod:i386-pc/bitmap.mod
i386-pc/bitmap_scale.mod:i386-pc/bitmap_scale.mod
i386-pc/boot.mod:i386-pc/boot.mod
i386-pc/bsd.mod:i386-pc/bsd.mod
i386-pc/btrfs.mod:i386-pc/btrfs.mod
i386-pc/cat.mod:i386-pc/cat.mod
i386-pc/cbfs.mod:i386-pc/cbfs.mod
i386-pc/cbls.mod:i386-pc/cbls.mod
i386-pc/cbmemc.mod:i386-pc/cbmemc.mod
i386-pc/cbtime.mod:i386-pc/cbtime.mod
i386-pc/chain.mod:i386-pc/chain.mod
i386-pc/cmosdump.mod:i386-pc/cmosdump.mod
i386-pc/cmostest.mod:i386-pc/cmostest.mod
i386-pc/cmp.mod:i386-pc/cmp.mod
i386-pc/configfile.mod:i386-pc/configfile.mod
i386-pc/cpio.mod:i386-pc/cpio.mod
i386-pc/cpio_be.mod:i386-pc/cpio_be.mod
i386-pc/cpuid.mod:i386-pc/cpuid.mod
i386-pc/crc64.mod:i386-pc/crc64.mod
i386-pc/crypto.mod:i386-pc/crypto.mod
i386-pc/cryptodisk.mod:i386-pc/cryptodisk.mod
i386-pc/cs5536.mod:i386-pc/cs5536.mod
i386-pc/date.mod:i386-pc/date.mod
i386-pc/datehook.mod:i386-pc/datehook.mod
i386-pc/datetime.mod:i386-pc/datetime.mod
i386-pc/disk.mod:i386-pc/disk.mod
i386-pc/diskfilter.mod:i386-pc/diskfilter.mod
i386-pc/div_test.mod:i386-pc/div_test.mod
i386-pc/echo.mod:i386-pc/echo.mod
i386-pc/efiemu.mod:i386-pc/efiemu.mod
i386-pc/ehci.mod:i386-pc/ehci.mod
i386-pc/elf.mod:i386-pc/elf.mod
i386-pc/eval.mod:i386-pc/eval.mod
i386-pc/exfat.mod:i386-pc/exfat.mod
i386-pc/ext2.mod:i386-pc/ext2.mod
i386-pc/extcmd.mod:i386-pc/extcmd.mod
i386-pc/fat.mod:i386-pc/fat.mod
i386-pc/file.mod:i386-pc/file.mod
i386-pc/fshelp.mod:i386-pc/fshelp.mod
i386-pc/gcry_arcfour.mod:i386-pc/gcry_arcfour.mod
i386-pc/gcry_blowfish.mod:i386-pc/gcry_blowfish.mod
i386-pc/gcry_camellia.mod:i386-pc/gcry_camellia.mod
i386-pc/gcry_cast5.mod:i386-pc/gcry_cast5.mod
i386-pc/gcry_crc.mod:i386-pc/gcry_crc.mod
i386-pc/gcry_des.mod:i386-pc/gcry_des.mod
i386-pc/gcry_dsa.mod:i386-pc/gcry_dsa.mod
i386-pc/gcry_idea.mod:i386-pc/gcry_idea.mod
i386-pc/gcry_md4.mod:i386-pc/gcry_md4.mod
i386-pc/gcry_md5.mod:i386-pc/gcry_md5.mod
i386-pc/gcry_rfc2268.mod:i386-pc/gcry_rfc2268.mod
i386-pc/gcry_rijndael.mod:i386-pc/gcry_rijndael.mod
i386-pc/gcry_rmd160.mod:i386-pc/gcry_rmd160.mod
i386-pc/gcry_rsa.mod:i386-pc/gcry_rsa.mod
i386-pc/gcry_seed.mod:i386-pc/gcry_seed.mod
i386-pc/gcry_serpent.mod:i386-pc/gcry_serpent.mod
i386-pc/gcry_sha1.mod:i386-pc/gcry_sha1.mod
i386-pc/gcry_sha256.mod:i386-pc/gcry_sha256.mod
i386-pc/gcry_sha512.mod:i386-pc/gcry_sha512.mod
i386-pc/gcry_tiger.mod:i386-pc/gcry_tiger.mod
i386-pc/gcry_twofish.mod:i386-pc/gcry_twofish.mod
i386-pc/gcry_whirlpool.mod:i386-pc/gcry_whirlpool.mod
i386-pc/gettext.mod:i386-pc/gettext.mod
i386-pc/gfxmenu.mod:i386-pc/gfxmenu.mod
i386-pc/gfxterm_background.mod:i386-pc/gfxterm_background.mod
i386-pc/gfxterm_menu.mod:i386-pc/gfxterm_menu.mod
i386-pc/gptsync.mod:i386-pc/gptsync.mod
i386-pc/gzio.mod:i386-pc/gzio.mod
i386-pc/halt.mod:i386-pc/halt.mod
i386-pc/hashsum.mod:i386-pc/hashsum.mod
i386-pc/hdparm.mod:i386-pc/hdparm.mod
i386-pc/help.mod:i386-pc/help.mod
i386-pc/hexdump.mod:i386-pc/hexdump.mod
i386-pc/hfs.mod:i386-pc/hfs.mod
i386-pc/hfsplus.mod:i386-pc/hfsplus.mod
i386-pc/http.mod:i386-pc/http.mod
i386-pc/iorw.mod:i386-pc/iorw.mod
i386-pc/iso9660.mod:i386-pc/iso9660.mod
i386-pc/jfs.mod:i386-pc/jfs.mod
i386-pc/jpeg.mod:i386-pc/jpeg.mod
i386-pc/keystatus.mod:i386-pc/keystatus.mod
i386-pc/linux.mod:i386-pc/linux.mod
i386-pc/linux16.mod:i386-pc/linux16.mod
i386-pc/loadenv.mod:i386-pc/loadenv.mod
i386-pc/loopback.mod:i386-pc/loopback.mod
i386-pc/ls.mod:i386-pc/ls.mod
i386-pc/lsacpi.mod:i386-pc/lsacpi.mod
i386-pc/lsmmap.mod:i386-pc/lsmmap.mod
i386-pc/lspci.mod:i386-pc/lspci.mod
i386-pc/luks.mod:i386-pc/luks.mod
i386-pc/lvm.mod:i386-pc/lvm.mod
i386-pc/lzopio.mod:i386-pc/lzopio.mod
i386-pc/mda_text.mod:i386-pc/mda_text.mod
i386-pc/mdraid09.mod:i386-pc/mdraid09.mod
i386-pc/mdraid09_be.mod:i386-pc/mdraid09_be.mod
i386-pc/mdraid1x.mod:i386-pc/mdraid1x.mod
i386-pc/memdisk.mod:i386-pc/memdisk.mod
i386-pc/memrw.mod:i386-pc/memrw.mod
i386-pc/minicmd.mod:i386-pc/minicmd.mod
i386-pc/minix.mod:i386-pc/minix.mod
i386-pc/minix2.mod:i386-pc/minix2.mod
i386-pc/minix2_be.mod:i386-pc/minix2_be.mod
i386-pc/minix3.mod:i386-pc/minix3.mod
i386-pc/minix3_be.mod:i386-pc/minix3_be.mod
i386-pc/minix_be.mod:i386-pc/minix_be.mod
i386-pc/mmap.mod:i386-pc/mmap.mod
i386-pc/morse.mod:i386-pc/morse.mod
i386-pc/mpi.mod:i386-pc/mpi.mod
i386-pc/msdospart.mod:i386-pc/msdospart.mod
i386-pc/multiboot.mod:i386-pc/multiboot.mod
i386-pc/multiboot2.mod:i386-pc/multiboot2.mod
i386-pc/nativedisk.mod:i386-pc/nativedisk.mod
i386-pc/net.mod:i386-pc/net.mod
i386-pc/newc.mod:i386-pc/newc.mod
i386-pc/nilfs2.mod:i386-pc/nilfs2.mod
i386-pc/normal.mod:i386-pc/normal.mod
i386-pc/ntfs.mod:i386-pc/ntfs.mod
i386-pc/ntfscomp.mod:i386-pc/ntfscomp.mod
i386-pc/odc.mod:i386-pc/odc.mod
i386-pc/offsetio.mod:i386-pc/offsetio.mod
i386-pc/ohci.mod:i386-pc/ohci.mod
i386-pc/part_bsd.mod:i386-pc/part_bsd.mod
i386-pc/part_gpt.mod:i386-pc/part_gpt.mod
i386-pc/part_msdos.mod:i386-pc/part_msdos.mod
i386-pc/parttool.mod:i386-pc/parttool.mod
i386-pc/password.mod:i386-pc/password.mod
i386-pc/password_pbkdf2.mod:i386-pc/password_pbkdf2.mod
i386-pc/pata.mod:i386-pc/pata.mod
i386-pc/pbkdf2.mod:i386-pc/pbkdf2.mod
i386-pc/pci.mod:i386-pc/pci.mod
i386-pc/pcidump.mod:i386-pc/pcidump.mod
i386-pc/play.mod:i386-pc/play.mod
i386-pc/png.mod:i386-pc/png.mod
i386-pc/priority_queue.mod:i386-pc/priority_queue.mod
i386-pc/probe.mod:i386-pc/probe.mod
i386-pc/procfs.mod:i386-pc/procfs.mod
i386-pc/progress.mod:i386-pc/progress.mod
i386-pc/raid5rec.mod:i386-pc/raid5rec.mod
i386-pc/raid6rec.mod:i386-pc/raid6rec.mod
i386-pc/read.mod:i386-pc/read.mod
i386-pc/reboot.mod:i386-pc/reboot.mod
i386-pc/regexp.mod:i386-pc/regexp.mod
i386-pc/reiserfs.mod:i386-pc/reiserfs.mod
i386-pc/relocator.mod:i386-pc/relocator.mod
i386-pc/romfs.mod:i386-pc/romfs.mod
i386-pc/scsi.mod:i386-pc/scsi.mod
i386-pc/search.mod:i386-pc/search.mod
i386-pc/search_fs_file.mod:i386-pc/search_fs_file.mod
i386-pc/search_fs_uuid.mod:i386-pc/search_fs_uuid.mod
i386-pc/search_label.mod:i386-pc/search_label.mod
i386-pc/serial.mod:i386-pc/serial.mod
i386-pc/setjmp.mod:i386-pc/setjmp.mod
i386-pc/setpci.mod:i386-pc/setpci.mod
i386-pc/sfs.mod:i386-pc/sfs.mod
i386-pc/sleep.mod:i386-pc/sleep.mod
i386-pc/spkmodem.mod:i386-pc/spkmodem.mod
i386-pc/squash4.mod:i386-pc/squash4.mod
i386-pc/syslinuxcfg.mod:i386-pc/syslinuxcfg.mod
i386-pc/tar.mod:i386-pc/tar.mod
i386-pc/terminal.mod:i386-pc/terminal.mod
i386-pc/terminfo.mod:i386-pc/terminfo.mod
i386-pc/test.mod:i386-pc/test.mod
i386-pc/testload.mod:i386-pc/testload.mod
i386-pc/testspeed.mod:i386-pc/testspeed.mod
i386-pc/tftp.mod:i386-pc/tftp.mod
i386-pc/tga.mod:i386-pc/tga.mod
i386-pc/time.mod:i386-pc/time.mod
i386-pc/tr.mod:i386-pc/tr.mod
i386-pc/trig.mod:i386-pc/trig.mod
i386-pc/true.mod:i386-pc/true.mod
i386-pc/udf.mod:i386-pc/udf.mod
i386-pc/ufs1.mod:i386-pc/ufs1.mod
i386-pc/ufs1_be.mod:i386-pc/ufs1_be.mod
i386-pc/ufs2.mod:i386-pc/ufs2.mod
i386-pc/uhci.mod:i386-pc/uhci.mod
i386-pc/usb.mod:i386-pc/usb.mod
i386-pc/usb_keyboard.mod:i386-pc/usb_keyboard.mod
i386-pc/usbms.mod:i386-pc/usbms.mod
i386-pc/usbserial_common.mod:i386-pc/usbserial_common.mod
i386-pc/usbserial_ftdi.mod:i386-pc/usbserial_ftdi.mod
i386-pc/usbserial_pl2303.mod:i386-pc/usbserial_pl2303.mod
i386-pc/usbserial_usbdebug.mod:i386-pc/usbserial_usbdebug.mod
i386-pc/usbtest.mod:i386-pc/usbtest.mod
i386-pc/verify.mod:i386-pc/verify.mod
i386-pc/video_colors.mod:i386-pc/video_colors.mod
i386-pc/videoinfo.mod:i386-pc/videoinfo.mod
i386-pc/videotest.mod:i386-pc/videotest.mod
i386-pc/videotest_checksum.mod:i386-pc/videotest_checksum.mod
i386-pc/xfs.mod:i386-pc/xfs.mod
i386-pc/xzio.mod:i386-pc/xzio.mod
i386-pc/zfs.mod:i386-pc/zfs.mod

path: projects/grub/configs/bios/install


code:
biosdisk
cbmemc
ext2
halt
part_bsd
part_gpt
reboot
verify


code: pc

path: projects/grub/configs/bios/platform


code: (cbfsdisk)/fallback

path: projects/grub/configs/bios/prefix


code:
set prefix=(cbfsdisk)/fallback

set root=(cbfsdisk)
source (cbfsdisk)/fallback/grub.cfg

path: projects/grub/configs/coreboot/config


path: projects/grub/configs/coreboot/format


path: projects/grub/configs/coreboot/install


code:
ahci
cbmemc
ehci
ext2
halt
part_bsd
part_gpt
pata
reboot
usbms
verify


code: coreboot

path: projects/grub/configs/coreboot/platform


path: projects/grub/configs/fonts/font-file


code:
bios
coreboot
uefi

path: projects/grub/configs/targets


path: projects/grub/configs/uefi/config


code: efi

path: projects/grub/configs/uefi/platform


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

arguments() {
	project_arguments_targets "$project" "$@"
}

usage() {
	project_usage_actions "$project"
	project_usage_arguments "$project" "$@"
}

download() {
	local repository="$project"

	project_download_git "$project" "$repository" 'https://git.savannah.gnu.org/r/grub.git' "$@"
}

download_check() {
	local repository="$project"

	project_download_check_git "$project" "$repository" "$@"
}

extract() {
	project_extract "$project" "$@"
}

extract_check() {
	project_extract_check "$project" "$@"
}

update() {
	local repository="$project"

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository="$project"

	project_update_check_git "$project" "$repository" "$@"
}

build() {
	local target="$1"
	local repository="$project"

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	if git_project_check "$repository"; then
		git_project_checkout "$project" "$repository" "$@"
	fi

	local project_path="$(project_path "$project")"
	local sources_path="$(project_sources_path "$project" "$repository" "$@")"
	local build_path="$(project_build_path "$project" "$@")"
	local raw_keymap_path="$project_path/$CONFIGS/keymaps"

	mkdir -p "$build_path"

	grub_build_utils

	if [[ "$target" == 'bios' ]]; then
		grub_build_floppy_image
	else
		grub_build_standalone_image
	fi

	for raw_keymap in "$raw_keymap_path"/*; do
		grub_build_layout "$raw_keymap"
	done

	grub_build_font

	grub_copy_modules

	make -C "$sources_path" distclean
}

build_check() {
	project_build_check "$project" "$@"
}

install() {
	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local repository="$project"

	project_release_install_archive "$project" "$IMAGES" "$@"
	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository="$project"

	project_release_install_archive_check "$project" "$IMAGES" "$@"
	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/grub/grub


code:
#!/usr/bin/env bash

# Copyright (C) 2017 Andrew Robbins <contact@andrewrobbins.info>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

ARCH='arch'
CONFIG='config'
FONTS='fonts'
FONT_FILE='font-file'
FONT_PROJECT='font-project'
FORMAT='format'
MODMIN='modules-minimal'
PLATFORM='platform'
PREFIX='prefix'
SIZE='size'

grub_arch() {
	project_file_contents "$project" "$CONFIGS" "$ARCH" "$@"
}

grub_font_file() {
	project_file_contents "$project" "$CONFIGS" "$FONT_FILE" "$@"
}

grub_font_project() {
	project_file_contents "$project" "$CONFIGS" "$FONT_PROJECT" "$@"
}

grub_format() {
	project_file_contents "$project" "$CONFIGS" "$FORMAT" "$@"
}

grub_platform() {
	project_file_contents "$project" "$CONFIGS" "$PLATFORM" "$@"
}

grub_prefix() {
	project_file_contents "$project" "$CONFIGS" "$PREFIX" "$@"
}

grub_size() {
	project_file_contents "$project" "$CONFIGS" "$SIZE" "$@"
}

grub_config_path() {
	project_file_path "$project" "$CONFIGS" "$CONFIG" "$@"
}

grub_modmin_path() {
	project_file_path "$project" "$CONFIGS" "$MODMIN" "$@"
}

grub_copy_modules() {
	local grub_module_dir="$sources_path/grub-core"
	local keep_dir="$build_path/$(grub_format "$target" "$@")"

	mkdir -p "$keep_dir"

	cp -a "$grub_module_dir"/*.@(mod|lst) "$keep_dir"
}

grub_build_font() {
	# Font project-specific filenames and paths
	local font_file="$(grub_font_file "$FONTS" "$@")"
	local font_project="$(grub_font_project "$FONTS" "$@")"
	local font_build_dir="$root/$BUILD/$font_project"

	local grub_mkfont="$sources_path/grub-mkfont"

	# GRUB font directory for outputting the built PF2 file
	mkdir -p "$build_path/$FONTS"

	"$grub_mkfont" --output="$build_path/$FONTS/${font_file%.*}.pf2" \
			"$font_build_dir/$font_file"
}

grub_build_utils() {
	(
		# If arch and/or platform files don't exist,
		# the configure script will pick a reasonable default
		local arch="$(grub_arch "$target" "$@")"
		local platform="$(grub_platform "$target" "$@")"

		cd "$sources_path" || return

		if git_project_check "$repository"; then
			./autogen.sh
		fi

		./configure --target="$arch" --with-platform="$platform"

		make -j"$TASKS"
	)
}

grub_build_layout() {
	local raw_layout="${1##*/}"
	local raw_layout_path="$1"
	local keymap_out_path="$build_path/keymaps"
	local grub_mklayout="$sources_path/grub-mklayout"
	local grub_kbd_layout="$keymap_out_path/$raw_layout.gkb"

	if ! [[ -e "$keymap_out_path" ]]; then
		mkdir -p "$keymap_out_path"
	elif ! [[ -d "$keymap_out_path" ]]; then
		printf '\n%s\n' "Error: File $keymap_out_path is not a directory" 1>&2

		return 1
	fi

	"$grub_mklayout" --output="$grub_kbd_layout" --input="$raw_layout_path"
}

grub_build_bootable_image() {
	local arch="$(grub_arch "$target" "$@")"
	local format="$(grub_format "$target" "$@")"
	local prefix="$(grub_prefix "$target" "$@")"
	local config_path="$(grub_config_path "$target" "$@")"

	local grub_mkimage="$sources_path/grub-mkimage"
	local grub_module_dir="$sources_path/grub-core"

	local grubimg="$build_path/grub.img"
	local grub_bootimg="$grub_module_dir/boot.img"
	local grub_bootable_img="$build_path/grub2"

	"$grub_mkimage" \
		--config="$config_path" \
		--directory="$grub_module_dir" \
		--output="$grubimg" \
		--format="$format" \
		--prefix="$prefix" \
		cbfs configfile

	cat "$grub_bootimg" "$grubimg" > "$grub_bootable_img"
	rm -f "$grubimg"
}

grub_build_floppy_image() {
	local grubimg="$build_path/grub2"
	local tempfile="$build_path/temp.file"

	if ! grub_build_bootable_image "$@"; then
		printf '\n%s\n\n' "Error: Failed to build a GRUB image" 1>&2

		return 1
	fi

	local size="$(grub_size "$target" "$@")"

	# Pre-allocate a floppy-sized image
	# SeaBIOS requires floppy images to have a "correct" size
	if ! [[ -e "$tempfile" ]]; then
		dd if=/dev/zero of="$tempfile" bs=1024 count="${size:-160}"
	else
		printf '\n%s\n\n' "Error: File $tempfile already exists!" 1>&2

		return 1
	fi

	local -i grubimg_size="$(stat -c %s "$grubimg")"
	local -i floppy_size="$((${size:-160} * 1024))"

	# Graft the GRUB image onto the blank floppy image
	if ((grubimg_size <= floppy_size)); then
		dd if="$grubimg" of="$tempfile" bs=1 conv=notrunc

		rm -f "$grubimg"
		mv "$tempfile" "$grubimg"
	else
		printf '\n%s' "Error: Image ${grubimg##*/} is too large; " 1>&2
		printf '%s\n\n' "it must be less than ${size}KiB in size" 1>&2

		return 1
	fi
}

grub_build_standalone_image() {
	local arch="$(grub_arch "$target" "$@")"
	local format="$(grub_format "$target" "$@")"
	local prefix="$(grub_prefix "$target" "$@")"
	local config_path="$(grub_config_path "$target" "$@")"

	local grubimg="$build_path/grub2"

	local grub_mkimage="$sources_path/grub-mkimage"
	local grub_mkstandalone="$sources_path/grub-mkstandalone"
	local grub_module_dir="$sources_path/grub-core"

	"$grub_mkstandalone" \
		--grub-mkimage="$grub_mkimage" \
		--fonts='' \
		--themes='' \
		--locales='' \
		--install-modules='cbfs configfile' \
		--directory="$grub_module_dir" \
		--format="$format" \
		--output="$grubimg" \
		/boot/grub/grub.cfg="$config_path"
}

path: projects/grub/grub-helper


code:
Copyright (C) 2014, 2015, 2016 Leah Rowe <info@minifree.org>
Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>


code:
insmod nativedisk
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbms
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug
insmod png

# Serial and keyboard configuration, very important.
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input --append  serial
terminal_output --append serial
terminal_input --append at_keyboard
terminal_output --append cbmemc
terminal_output --append gfxterm

load_env --file (cbfsdisk)/grubenv

# User's preferred keyboard layout
if [ -n "${keymap}" ]; then
	keymap "${keymap}"
fi

# Prettify GRUB
background_image "${gfxterm_background}"

function try_user_config {
	set root="${1}"
	for dir in boot grub grub2 boot/grub boot/grub2; do
		for name in libreboot_ autoboot_ librecore_ coreboot_ ''; do
			if [ -f /"${dir}"/"${name}"grub.cfg ]; then
                unset superusers
				configfile /"${dir}"/"${name}"grub.cfg
			fi
		done
	done
}

function search_grub {
	for i in 0 1; do
		# raw devices
		try_user_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_user_config "(${1}${i},${part})"
		done
	done
}

function try_isolinux_config {
	set root="${1}"
	for dir in '' /boot; do
		if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
			syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
		elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
			syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
		fi
	done
}

function search_isolinux {
	for i in 0 1; do
		# raw devices
		try_isolinux_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_isolinux_config "(${1}${i},${part})"
		done
	done
}

menuentry 'Load Operating System (incl. fully encrypted disks)  [o]' --hotkey='o' {
# GRUB2 handles (almost) every possible disk setup, but only the location of
# /boot is actually important since GRUB2 only loads the user's config.

# LVM, RAID, filesystems and encryption on both raw devices and partitions in
# all various combinations need to be supported. Since full disk encryption is
# possible with GRUB2 as payload and probably even used by most users, this
# configuration tries to load the operating system in the following way:

# 1. Look for user configuration on unencrypted devices first to avoid
# unnecessary decryption routines in the following order:

#	1) raw devices and MBR/GPT partitions
	search_grub ahci
    search_grub ata
#	2) LVM and RAID which might be used accross multiple devices
	lvm="lvm/matrix-rootvol lvm/matrix-boot"
	raid="md/0 md/1 md/2 md/3 md/4 md/5 md/6 md/7 md/8 md/9"
	for vol in ${lvm} ${raid}; do
		try_user_config "(${vol})"
	done
# 2. In case no configuration could be found, try decrypting devices. Look
# on raw crypto devices as well as inside LVM volumes this time.

#	The user will be prompted for a passphrase if a LUKS header was found.
	for dev in ahci0 ata0 usb0 ${lvm}; do
		cryptomount "(${dev})"
	done
#	3) encrypted devices/partitions
	for i in 0 1; do
		for part in 1 2 3 4 5; do
            for type in ahci ata; do
    			cryptomount "(${type}${i},${part})"
            done
		done
	done

#	3) encrypted devices/partitions
	search_grub crypto
#	4) LVM inside LUKS containers
	for vol in ${lvm}; do
		try_user_config "(${vol})"
	done

    # Last resort, if all else fails
    set root=ahci0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done

    # Last resort (for GA-G41-ES2L which uses IDE emulation mode for SATA)
    set root=ata0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done
}

menuentry 'Search ISOLINUX menu (AHCI)  [a]' --hotkey='a' {
	search_isolinux ahci
}

menuentry 'Search ISOLINUX menu (USB)  [u]' --hotkey='u' {
	search_isolinux usb
}

menuentry 'Search ISOLINUX menu (CD/DVD)  [d]' --hotkey='d' {
	insmod ata
	for dev in ata0 ata1 ata2 ata3 ahci1; do
		try_isolinux_config "(${dev})"
	done
}

menuentry 'Load test configuration (grubtest.cfg) inside of CBFS  [t]' --hotkey='t' {
	set root='(cbfsdisk)'
	configfile /grubtest.cfg
}

menuentry 'Search for GRUB2 configuration on external media  [s]' --hotkey='s' {
	search_grub usb
}

menuentry 'Poweroff  [p]' --hotkey='p' {
	halt
}

menuentry 'Reboot  [r]' --hotkey='r' {
	reboot
}


code:
insmod nativedisk
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbms
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug
insmod png

# Serial and keyboard configuration, very important.
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input --append  serial
terminal_output --append serial
terminal_input --append at_keyboard
terminal_output --append cbmemc
terminal_output --append gfxterm

load_env --file (cbfsdisk)/grubenv

# User's preferred keyboard layout
if [ -n "${keymap}" ]; then
	keymap "${keymap}"
fi

# Prettify GRUB
background_image "${gfxterm_background}"

function try_user_config {
	set root="${1}"
	for dir in boot grub grub2 boot/grub boot/grub2; do
		for name in libreboot_ autoboot_ librecore_ coreboot_ ''; do
			if [ -f /"${dir}"/"${name}"grub.cfg ]; then
                unset superusers
				configfile /"${dir}"/"${name}"grub.cfg
			fi
		done
	done
}

function search_grub {
	for i in 0 1; do
		# raw devices
		try_user_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_user_config "(${1}${i},${part})"
		done
	done
}

function try_isolinux_config {
	set root="${1}"
	for dir in '' /boot; do
		if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
			syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
		elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
			syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
		fi
	done
}

function search_isolinux {
	for i in 0 1; do
		# raw devices
		try_isolinux_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_isolinux_config "(${1}${i},${part})"
		done
	done
}

menuentry 'Load Operating System (incl. fully encrypted disks)  [o]' --hotkey='o' {
# GRUB2 handles (almost) every possible disk setup, but only the location of
# /boot is actually important since GRUB2 only loads the user's config.

# LVM, RAID, filesystems and encryption on both raw devices and partitions in
# all various combinations need to be supported. Since full disk encryption is
# possible with GRUB2 as payload and probably even used by most users, this
# configuration tries to load the operating system in the following way:

# 1. Look for user configuration on unencrypted devices first to avoid
# unnecessary decryption routines in the following order:

#	1) raw devices and MBR/GPT partitions
	search_grub ahci
    search_grub ata
#	2) LVM and RAID which might be used accross multiple devices
	lvm="lvm/matrix-rootvol lvm/matrix-boot"
	raid="md/0 md/1 md/2 md/3 md/4 md/5 md/6 md/7 md/8 md/9"
	for vol in ${lvm} ${raid}; do
		try_user_config "(${vol})"
	done
# 2. In case no configuration could be found, try decrypting devices. Look
# on raw crypto devices as well as inside LVM volumes this time.

#	The user will be prompted for a passphrase if a LUKS header was found.
	for dev in ahci0 ata0 usb0 ${lvm}; do
		cryptomount "(${dev})"
	done
#	3) encrypted devices/partitions
	for i in 0 1; do
		for part in 1 2 3 4 5; do
            for type in ahci ata; do
    			cryptomount "(${type}${i},${part})"
            done
		done
	done

#	3) encrypted devices/partitions
	search_grub crypto
#	4) LVM inside LUKS containers
	for vol in ${lvm}; do
		try_user_config "(${vol})"
	done

    # Last resort, if all else fails
    set root=ahci0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done

    # Last resort (for GA-G41-ES2L which uses IDE emulation mode for SATA)
    set root=ata0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done
}

menuentry 'Search ISOLINUX menu (AHCI)  [a]' --hotkey='a' {
	search_isolinux ahci
}

menuentry 'Search ISOLINUX menu (USB)  [u]' --hotkey='u' {
	search_isolinux usb
}

menuentry 'Search ISOLINUX menu (CD/DVD)  [d]' --hotkey='d' {
	insmod ata
	for dev in ata0 ata1 ata2 ata3 ahci1; do
		try_isolinux_config "(${dev})"
	done
}

menuentry 'Load standard configuration (grub.cfg) inside of CBFS  [t]' --hotkey='t' {
	set root='(cbfsdisk)'
	configfile /grub.cfg
}

menuentry 'Search for GRUB2 configuration on external media  [s]' --hotkey='s' {
	search_grub usb
}

menuentry 'Poweroff  [p]' --hotkey='p' {
	halt
}

menuentry 'Reboot  [r]' --hotkey='r' {
	reboot
}


path: projects/grub/install/textmode/AUTHORS


code:
insmod nativedisk
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbms
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug

# Serial and keyboard configuration, very important.
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input --append  serial
terminal_output --append serial
terminal_input --append at_keyboard
terminal_output --append cbmemc
terminal_output --append gfxterm

load_env --file (cbfsdisk)/grubenv

# User's preferred keyboard layout
if [ -n "${keymap}" ]; then
	keymap "${keymap}"
fi

function try_user_config {
	set root="${1}"
	for dir in boot grub grub2 boot/grub boot/grub2; do
		for name in libreboot_ autoboot_ librecore_ coreboot_ ''; do
			if [ -f /"${dir}"/"${name}"grub.cfg ]; then
                unset superusers
				configfile /"${dir}"/"${name}"grub.cfg
			fi
		done
	done
}

function search_grub {
	for i in 0 1; do
		# raw devices
		try_user_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_user_config "(${1}${i},${part})"
		done
	done
}

function try_isolinux_config {
	set root="${1}"
	for dir in '' /boot; do
		if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
			syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
		elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
			syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
		fi
	done
}

function search_isolinux {
	for i in 0 1; do
		# raw devices
		try_isolinux_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_isolinux_config "(${1}${i},${part})"
		done
	done
}

menuentry 'Load Operating System (incl. fully encrypted disks)  [o]' --hotkey='o' {
# GRUB2 handles (almost) every possible disk setup, but only the location of
# /boot is actually important since GRUB2 only loads the user's config.

# LVM, RAID, filesystems and encryption on both raw devices and partitions in
# all various combinations need to be supported. Since full disk encryption is
# possible with GRUB2 as payload and probably even used by most users, this
# configuration tries to load the operating system in the following way:

# 1. Look for user configuration on unencrypted devices first to avoid
# unnecessary decryption routines in the following order:

#	1) raw devices and MBR/GPT partitions
	search_grub ahci
    search_grub ata
#	2) LVM and RAID which might be used accross multiple devices
	lvm="lvm/matrix-rootvol lvm/matrix-boot"
	raid="md/0 md/1 md/2 md/3 md/4 md/5 md/6 md/7 md/8 md/9"
	for vol in ${lvm} ${raid}; do
		try_user_config "(${vol})"
	done
# 2. In case no configuration could be found, try decrypting devices. Look
# on raw crypto devices as well as inside LVM volumes this time.

#	The user will be prompted for a passphrase if a LUKS header was found.
	for dev in ahci0 ata0 usb0 ${lvm}; do
		cryptomount "(${dev})"
	done
#	3) encrypted devices/partitions
	for i in 0 1; do
		for part in 1 2 3 4 5; do
            for type in ahci ata; do
    			cryptomount "(${type}${i},${part})"
            done
		done
	done

#	3) encrypted devices/partitions
	search_grub crypto
#	4) LVM inside LUKS containers
	for vol in ${lvm}; do
		try_user_config "(${vol})"
	done

    # Last resort, if all else fails
    set root=ahci0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done

    # Last resort (for GA-G41-ES2L which uses IDE emulation mode for SATA)
    set root=ata0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done
}

menuentry 'Search ISOLINUX menu (AHCI)  [a]' --hotkey='a' {
	search_isolinux ahci
}

menuentry 'Search ISOLINUX menu (USB)  [u]' --hotkey='u' {
	search_isolinux usb
}

menuentry 'Search ISOLINUX menu (CD/DVD)  [d]' --hotkey='d' {
	insmod ata
	for dev in ata0 ata1 ata2 ata3 ahci1; do
		try_isolinux_config "(${dev})"
	done
}

menuentry 'Load test configuration (grubtest.cfg) inside of CBFS  [t]' --hotkey='t' {
	set root='(cbfsdisk)'
	configfile /grubtest.cfg
}

menuentry 'Search for GRUB2 configuration on external media  [s]' --hotkey='s' {
	search_grub usb
}

menuentry 'Load MemTest86+  [m]' --hotkey='m' {
	linux16 (cbfsdisk)/memtest.bin
}

menuentry 'Poweroff  [p]' --hotkey='p' {
	halt
}

menuentry 'Reboot  [r]' --hotkey='r' {
	reboot
}


code:
insmod nativedisk
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbms
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug

# Serial and keyboard configuration, very important.
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input --append  serial
terminal_output --append serial
terminal_input --append at_keyboard
terminal_output --append cbmemc
terminal_output --append gfxterm

load_env --file (cbfsdisk)/grubenv

# User's preferred keyboard layout
if [ -n "${keymap}" ]; then
	keymap "${keymap}"
fi

function try_user_config {
	set root="${1}"
	for dir in boot grub grub2 boot/grub boot/grub2; do
		for name in libreboot_ autoboot_ librecore_ coreboot_ ''; do
			if [ -f /"${dir}"/"${name}"grub.cfg ]; then
                unset superusers
				configfile /"${dir}"/"${name}"grub.cfg
			fi
		done
	done
}

function search_grub {
	for i in 0 1; do
		# raw devices
		try_user_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_user_config "(${1}${i},${part})"
		done
	done
}

function try_isolinux_config {
	set root="${1}"
	for dir in '' /boot; do
		if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
			syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
		elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
			syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
		fi
	done
}

function search_isolinux {
	for i in 0 1; do
		# raw devices
		try_isolinux_config "(${1}${i})"
		for part in 1 2 3 4 5; do
			# MBR/GPT partitions
			try_isolinux_config "(${1}${i},${part})"
		done
	done
}

menuentry 'Load Operating System (incl. fully encrypted disks)  [o]' --hotkey='o' {
# GRUB2 handles (almost) every possible disk setup, but only the location of
# /boot is actually important since GRUB2 only loads the user's config.

# LVM, RAID, filesystems and encryption on both raw devices and partitions in
# all various combinations need to be supported. Since full disk encryption is
# possible with GRUB2 as payload and probably even used by most users, this
# configuration tries to load the operating system in the following way:

# 1. Look for user configuration on unencrypted devices first to avoid
# unnecessary decryption routines in the following order:

#	1) raw devices and MBR/GPT partitions
	search_grub ahci
    search_grub ata
#	2) LVM and RAID which might be used accross multiple devices
	lvm="lvm/matrix-rootvol lvm/matrix-boot"
	raid="md/0 md/1 md/2 md/3 md/4 md/5 md/6 md/7 md/8 md/9"
	for vol in ${lvm} ${raid}; do
		try_user_config "(${vol})"
	done
# 2. In case no configuration could be found, try decrypting devices. Look
# on raw crypto devices as well as inside LVM volumes this time.

#	The user will be prompted for a passphrase if a LUKS header was found.
	for dev in ahci0 ata0 usb0 ${lvm}; do
		cryptomount "(${dev})"
	done
#	3) encrypted devices/partitions
	for i in 0 1; do
		for part in 1 2 3 4 5; do
            for type in ahci ata; do
    			cryptomount "(${type}${i},${part})"
            done
		done
	done

#	3) encrypted devices/partitions
	search_grub crypto
#	4) LVM inside LUKS containers
	for vol in ${lvm}; do
		try_user_config "(${vol})"
	done

    # Last resort, if all else fails
    set root=ahci0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done

    # Last resort (for GA-G41-ES2L which uses IDE emulation mode for SATA)
    set root=ata0,1
    for p in / /boot/; do
        if [ -f "${p}vmlinuz" ]; then
            linux ${p}vmlinuz root=/dev/sda1 rw
            if [ -f "${p}initrd.img" ]; then
                initrd ${p}initrd.img
            fi
        fi
    done
}

menuentry 'Search ISOLINUX menu (AHCI)  [a]' --hotkey='a' {
	search_isolinux ahci
}

menuentry 'Search ISOLINUX menu (USB)  [u]' --hotkey='u' {
	search_isolinux usb
}

menuentry 'Search ISOLINUX menu (CD/DVD)  [d]' --hotkey='d' {
	insmod ata
	for dev in ata0 ata1 ata2 ata3 ahci1; do
		try_isolinux_config "(${dev})"
	done
}

menuentry 'Load standard configuration (grub.cfg) inside of CBFS  [t]' --hotkey='t' {
	set root='(cbfsdisk)'
	configfile /grub.cfg
}

menuentry 'Search for GRUB2 configuration on external media  [s]' --hotkey='s' {
	search_grub usb
}

menuentry 'Load MemTest86+  [m]' --hotkey='m' {
	linux16 (cbfsdisk)/memtest.bin
}

menuentry 'Poweroff  [p]' --hotkey='p' {
	halt
}

menuentry 'Reboot  [r]' --hotkey='r' {
	reboot
}


code:
From 721f09ef24e1879667ac3469c17774450602b29e Mon Sep 17 00:00:00 2001
From: Leah Rowe <info@minifree.org>
Date: Sat, 14 Feb 2015 01:24:23 +0000
Subject: [PATCH 01/10] grub-core/normal/main.c: Display "FREE AS IN FREEDOM",
 not version

---
 grub-core/normal/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 78a70a8..982bde3 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -208,7 +208,7 @@ grub_normal_init_page (struct grub_term_output *term,

   grub_term_cls (term);

-  msg_formatted = grub_xasprintf (_("GNU GRUB  version %s"), PACKAGE_VERSION);
+  msg_formatted = grub_xasprintf("FREE AS IN FREEDOM");
   if (!msg_formatted)
     return;

--
1.9.1


code:
lib/libftdigpio.so:libftdigpio.so
lib/libftdii2c.so:libftdii2c.so
lib/libftdiuart.so:libftdiuart.so
servo:servo
src/toad/toad:toad
usbkm232:usbkm232

path: projects/hdctools/configs/install


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

download() {
	local repository=$project

	project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/third_party/hdctools" "$@"
}

download_check() {
	local repository=$project

	project_download_check_git "$project" "$repository" "$@"
}

extract() {
	local repository=$project

	project_extract "$project" "$@"
}

extract_check() {
	local repository=$project

	project_extract_check "$project" "$@"
}

update() {
	local repository=$project

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository=$project

	project_update_check_git "$project" "$repository" "$@"
}

build() {
	local repository=$project

	requirements "tidy"

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	local sources_path=$(project_sources_path "$project" "$repository" "$@")
	local build_path=$(project_build_path "$project" "$@")

	if git_project_check "$repository"
	then
		git_project_checkout "$project" "$repository" "$@"
	fi

	mkdir -p "$build_path"

	make -C "$sources_path" HDCTOOLS_BUILD_DIR="$build_path" -j$TASKS
}

build_check() {
	project_build_check "$project" "$@"
}

install() {
	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local repository=$project

	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository=$project

	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/hdctools/hdctools


code:
From 05fde50f4991623525edb6b15340011af53cd31e Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Sun, 20 Nov 2016 15:08:39 +0100
Subject: [PATCH] Remove Werror flag

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 defs/c-Linux.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/defs/c-Linux.mk b/defs/c-Linux.mk
index c2c3129..4f1bbee 100644
--- a/defs/c-Linux.mk
+++ b/defs/c-Linux.mk
@@ -34,7 +34,6 @@ HOSTOS_CWARN	=				\
 	-Wdeclaration-after-statement		\
 	-Wdisabled-optimization			\
 	-Wempty-body				\
-	-Werror					\
 	-Wextra					\
 	-Wfloat-equal				\
 	-Wformat				\
--
2.10.2


code: depthcharge

path: projects/libpayload/configs/targets


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

arguments() {
	project_arguments_targets "$project" "$@"
}

usage() {
	project_usage_actions "$project"
	project_usage_arguments "$project" "$@"
}

build() {
	local repository="coreboot"

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	if git_project_check $repository
	then
		git_project_checkout "$repository" "$repository" "$@"
	fi

	local coreboot_sources_path=$(project_sources_path "$repository" "$repository" "$@")
	local sources_path="$coreboot_sources_path/payloads/libpayload/"
	local build_path=$(project_build_path "$project" "$@")
	local build_install_path="$build_path/install"

	local config_name=$(libpayload_config "$@")
	local config_path="$sources_path/configs/$config_name"

	local arch=$(libpayload_arch "$@")

	local crossgcc_build_path=$(project_build_path "crossgcc" "$arch")
	local crossgcc_bin_path="$crossgcc_build_path/bin/"

	rm -f "$sources_path/.xcompile"

	mkdir -p "$build_path"

	make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" KBUILD_DEFCONFIG="$config_path" "defconfig"
	make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" -j$TASKS
	make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" XGCCPATH="$crossgcc_bin_path" DESTDIR="$build_install_path" "install"

	rm -f "$sources_path/.xcompile"
}

build_check() {
	project_build_check "$project" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/libpayload/libpayload


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

CONFIG="config"
ARCH="arch"

libpayload_arch() {
	project_file_contents "$project" "$CONFIGS" "$ARCH" "$@"
}

libpayload_config() {
	project_file_contents "$project" "$CONFIGS" "$CONFIG" "$@"
}

path: projects/libpayload/libpayload-helper


code:
libreboot-tools
libreboot-images
libreboot-sources
libreboot-release

path: projects/libreboot-all/configs/projects


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

download() {
	project_action_projects "$action" "$project" "$@"
}

extract() {
	project_action_projects "$action" "$project" "$@"
}

update() {
	project_action_projects "$action" "$project" "$@"
}

build() {
	project_action_projects "$action" "$project" "$@"
}

install() {
	project_action_projects "$action" "$project" "$@"
}

release() {
	project_action_projects "$action" "$project" "$@"
}

clean() {
	project_action_projects "$action" "$project" "$@"
}

path: projects/libreboot-all/libreboot-all


code:
coreboot
crossgcc
vboot devices
libpayload
depthcharge
cros-ec


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

BUILD_SYSTEM="paper"

SOURCES="sources"
SYSTEMS="systems"
IMAGES="images"
TOOLS="tools"

ARCHIVE="tar.xz"
CHECKSUM="sha256sum"
ASC="asc"

usage() {
	printf 1>&2 '%s\n' "$executable [action] [projects...]"

	printf 1>&2 '\n%s\n' 'Actions:'
	printf 1>&2 '%s\n' '  download - Download project files'
	printf 1>&2 '%s\n' '  sources - Download project sources'
	printf 1>&2 '%s\n' '  verify - Verify project files'
	printf 1>&2 '%s\n' '  extract - Extract project files'
	printf 1>&2 '%s\n' '  prepare - Download, verify and extract project files'

	printf 1>&2 '\n%s\n' 'Environment variables:'
	printf 1>&2 '%s\n' '  MACHINE - Machine architecture to use'
	printf 1>&2 '%s\n' '  DOWNLOAD_URL - Base URL to download files from'
}

download() {
	local project=$1

	local ifs_save
	local prefix
	local directory
	local path
	local url

	for prefix in "$SYSTEMS/$MACHINE" "$IMAGES" "$TOOLS/$MACHINE"
	do
		ifs_save=$IFS
		IFS=$'-'

		directory=""

		for part in $project
		do
			if [ -z "$directory" ]
			then
				directory="$part"
			else
				directory="$directory-$part"
			fi

			path="$root/$prefix/$directory/$project.$ARCHIVE"
			url="$DOWNLOAD_URL/$prefix/$directory/$project.$ARCHIVE"

			if wget --quiet --spider "$url"
			then
				mkdir -p "$( dirname "$path" )"
				wget -O "$path" "$url"
				wget -O "$path.$CHECKSUM" "$url.$CHECKSUM"
				wget -O "$path.$DSIG" "$url.$DSIG"

				printf '\n%s\n' "Downloaded $project"

				return 0
			fi
		done

		IFS=$ifs_save
	done

	printf 1>&2 '%s\n' "Could not download $project from $DOWNLOAD_URL"
	return 1
}

sources() {
	local project=$1

	local url="$DOWNLOAD_URL/$SOURCES/$project/$project.$ARCHIVE"
	local path="$root/$SOURCES/$project/$project.$ARCHIVE"

	if wget --quiet --spider "$url"
	then
		mkdir -p "$( dirname "$path" )"
		wget -O "$path" "$url"
		wget -O "$path.$CHECKSUM" "$url.$CHECKSUM"
		wget -O "$path.$DSIG" "$url.$DSIG"

		printf '\n%s\n' "Downloaded $project sources"
	else
		printf 1>&2 '%s\n' "Could not download $project sources from $DOWNLOAD_URL"
		return 1
	fi

}

verify() {
	local project=$1

	local checksum_path
	local signature_path
	local ifs_save
	local prefix
	local directory
	local path

	for prefix in "$SYSTEMS/$MACHINE" "$IMAGES" "$TOOLS/$MACHINE"
	do
		ifs_save=$IFS
		IFS=$'-'

		directory=""

		for part in $project
		do
			if [ -z "$directory" ]
			then
				directory="$part"
			else
				directory="$directory-$part"
			fi

			path="$root/$prefix/$directory/$project.$ARCHIVE"

			if ! [ -f "$path" ]
			then
				continue
			fi

			checksum_path="$path.$CHECKSUM"
			signature_path="$path.$DSIG"

			if [ -f "$checksum_path" ]
			then
				(
					cd "$( dirname "$path" )"
					sha256sum -c "$project.$ARCHIVE.$CHECKSUM"
				)
			else
				printf 1>&2 '%s\n' "Could not verify $project checksum!"
			fi

			if [ -f "$signature_path" ]
			then
				gpg --armor --verify "$signature_path" "$path"
			else
				printf 1>&2 '%s\n' "Could not verify $project signature!"
			fi

			printf '\n%s\n' "Verified $project"

			return 0
		done

		IFS=$ifs_save
	done

	printf 1>&2 '%s\n' "Could not verify $project"
	return 1
}

extract() {
	local project=$1

	local extract_path
	local ifs_save
	local prefix
	local directory
	local path

	for prefix in "$SYSTEMS/$MACHINE" "$IMAGES" "$TOOLS/$MACHINE"
	do
		ifs_save=$IFS
		IFS=$'-'

		directory=""

		for part in $project
		do
			if [ -z "$directory" ]
			then
				directory="$part"
			else
				directory="$directory-$part"
			fi

			path="$root/$prefix/$directory/$project.$ARCHIVE"

			if ! [ -f "$path" ]
			then
				continue
			fi

			if [ "$prefix" = "$SYSTEMS/$MACHINE" ]
			then
				printf '%s\n' "Skiping $project extract"
				return 0
			fi

			extract_path=$( dirname "$path" )

			tar -xf "$path" -ps -C "$extract_path"

			printf '%s\n' "Extracted $project"

			return 0
		done

		IFS=$ifs_save
	done

	printf 1>&2 '%s\n' "Could not extract $project"
	return 1
}

requirements() {
	local requirement
	local requirement_path

	for requirement in "$@"
	do
		requirement_path=$( which "$requirement" || true )

		if [ -z "$requirement_path" ]
		then
			printf 1>&2 '%s\n' "Missing requirement: $requirement"
			exit 1
		fi
	done
}

setup() {
	root=$(readlink -f "$( dirname "$0" )" )
	executable=$( basename "$0" )

	if [ -z "$MACHINE" ]
	then
		MACHINE=$( uname -m )
	fi

	if [ -z "$DOWNLOAD_URL" ]
	then
		printf 1>&2 '%s\n' 'Missing download URL'
		exit 1
	fi
}

libreboot_release() {
	local action=$1
	shift

	set -e

	setup "$@"

	if [ -z "$action" ]
	then
		usage
		exit 1
	fi

	requirements "tar" "sha256sum" "gpg"

	case $action in
		"download")
			for project in "$@"
			do
				download "$project"
			done
			;;
		"sources")
			for project in "$@"
			do
				sources "$project"
			done
			;;
		"verify")
			for project in "$@"
			do
				verify "$project"
			done
			;;
		"extract")
			for project in "$@"
			do
				extract "$project"
			done
			;;
		"prepare")
			for project in "$@"
			do
				download "$project"
				verify "$project"
				extract "$project"
			done
			;;
	esac
}

libreboot_release "$@"


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

install() {
	local install_path=$(project_install_path "$project" "$@")

	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	project_release_install "$project" "$TOOLS" "$@"
}

release_check() {
	project_release_install_check "$project" "$TOOLS" "$@"
}

clean() {
	project_clean "$project" "$@"
}


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

BUILD_SYSTEM="libreboot"

SOURCES="sources"
ARCHIVE="tar.xz"

usage() {
	printf 1>&2 '%s\n' "$executable [action] [sources path] (extract path)"

	printf 1>&2 '\n%s\n' 'Actions:'
	printf 1>&2 '%s\n' '  extract - Extract build system sources'
	printf 1>&2 '%s\n' '  copy - Copy projects sources'
	printf 1>&2 '%s\n' '  prepare - Extract and copy sources'

	printf '\n%s\n' '  When no extract path is provided, sources are extracted in the current'
	printf '%s\n' '  directory.'
}

extract() {
	local sources_path=$1
	local extract_path=$2

	local build_system_path
	local archive

	build_system_path="$extract_path/$BUILD_SYSTEM"

	if [ -d "$build_system_path" ]
	then
		return
	fi

	archive=$( find $sources_path -name "$BUILD_SYSTEM-sources.$ARCHIVE" || true )
	if [ -z "$archive" ]
	then
		printf 1>&2 '%s\n' "Finding $BUILD_SYSTEM sources archive failed!"
		usage
		exit 1
	fi

	tar -xf "$archive" -ps -C "$extract_path"

	printf '\n%s\n' "Extracted $BUILD_SYSTEM sources from $sources_path to $extract_path"
}

copy() {
	local sources_path=$1
	local extract_path=$2

	local build_system_path
	local build_system_sources_path
	local archives
	local file

	build_system_path="$extract_path/$BUILD_SYSTEM"
	build_system_sources_path="$build_system_path/$SOURCES"

	if ! [ -d "$build_system_path" ]
	then
		return
	fi

	mkdir -p "$build_system_path/$SOURCES"

	( find "$sources_path" -type f -not -name "$BUILD_SYSTEM*" || true ) | while read file
	do
		cp "$file" "$build_system_sources_path"
	done

	printf '\n%s\n' "Copied $BUILD_SYSTEM sources from $sources_path to $extract_path"
}

requirements() {
	local requirement
	local requirement_path

	for requirement in "$@"
	do
		requirement_path=$( which "$requirement" || true )

		if [ -z "$requirement_path" ]
		then
			printf 1>&2 '%s\n' "Missing requirement: $requirement"
			exit 1
		fi
	done
}

setup() {
	root=$(readlink -f "$( dirname "$0" )" )
	executable=$( basename "$0" )
}

libreboot_sources() {
	local action=$1
	local sources_path=$2
	local extract_path=$3

	set -e

	setup "$@"

	if [ -z "$sources_path" ]
	then
		usage
		exit 1
	fi

	if [ -z "$extract_path" ]
	then
		extract_path=$root
	fi

	requirements "tar" "sha256sum" "gpg"

	case $action in
		"extract")
			extract "$sources_path" "$extract_path"
			;;
		"copy")
			copy "$sources_path" "$extract_path"
			;;
		"prepare")
			extract "$sources_path" "$extract_path"
			copy "$sources_path" "$extract_path"
			;;
	esac
}

libreboot_sources "$@"


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

update() {
	local repository_path=$root

	git_fetch "$repository_path"
	git_merge "$repository_path" "$ORIGIN_HEAD"
}

install() {
	local install_path=$(project_install_path "$project" "$@")

	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local archive_path=$(project_release_archive_path "$project" "$SOURCES" "$@")
	local sources_path=$root

	project_release_install "$project" "$TOOLS" "$@"

	printf '%s\n' "$VERSION" > "$sources_path/$DOTVERSION"
	printf '%s\n' "$SOURCE_DATE_EPOCH" > "$sources_path/$DOTEPOCH"

	if git_check "$sources_path"
	then
		git_revision "$sources_path" > "$sources_path/$DOTREVISION"
	fi

	archive_create "$archive_path" "$sources_path" "$BUILD_SYSTEM"
	file_verification_create "$archive_path"
}

release_check() {
	local archive_path=$(project_release_archive_path "$project" "$SOURCES" "$@")

	project_release_install_check "$project" "$TOOLS" "$@"

	file_exists_check "$archive_path"
}

clean() {
	project_clean "$project" "$@"
}


code:
coreboot
cbfstool
cbmem
nvramtool
cros-tools


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

arguments() {
	project_arguments_targets "$project" "$@"
}

usage() {
	project_usage_actions "$project"
	project_usage_arguments "$project" "$@"
}

download() {
	local repository="$project"

	project_download_git "$project" "$repository" 'https://review.coreboot.org/memtest86plus.git' "$@"
}

download_check() {
	local repository="$project"

	project_download_check_git "$project" "$repository" "$@"
}

extract() {
	local repository="$project"

	project_extract "$project" "$@"
}

extract_check() {
	local repository="$project"

	project_extract_check "$project" "$@"
}

update() {
	local repository="$project"

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository="$project"

	project_update_check_git "$project" "$repository" "$@"
}

build() {
	local repository="$project"

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	if git_project_check "$repository"; then
		git_project_checkout "$project" "$repository" "$@"
	fi

	local sources_path="$(project_sources_path "$project" "$repository" "$@")"

	local build_path="$(project_build_path "$project" "$@")"

	mkdir -p "$build_path"
	make -C "$sources_path" -j"$TASKS"
	cp "$sources_path/memtest" "$build_path"
	make -C "$sources_path" 'clean'
}

build_check() {
	project_build_check "$project" "$@"
}

install() {
	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local repository="$project"

	project_release_install_archive "$project" "$TOOLS" "$@"
	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository="memtest86plus"

	project_release_install_archive_check "$project" "$TOOLS" "$@"
	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}


code:
From f8e0c94b546cdba083f33efd062334822240a12b Mon Sep 17 00:00:00 2001
From: Andrew Robbins <contact@andrewrobbins.info>
Date: Fri, 30 Jun 2017 01:42:23 -0400
Subject: [PATCH] turn on beep mode

---
 config.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.h b/config.h
index 102250d..8a36fd2 100644
--- a/config.h
+++ b/config.h
@@ -20,7 +20,7 @@

 /* BEEP_MODE - Beep on error. Default off, Change to 1 to enable */
 #ifndef BEEP_MODE
-#define BEEP_MODE 0
+#define BEEP_MODE 1
 #endif

 /* BEEP_END_NO_ERROR - Beep at end of each pass without error. Default off, Change to 1 to enable */
--
1.9.1


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

download() {
	local repository=$project

	project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/platform/mosys" "$@"
}

download_check() {
	local repository=$project

	project_download_check_git "$project" "$repository" "$@"
}

extract() {
	local repository=$project

	project_extract "$project" "$@"
}

extract_check() {
	local repository=$project

	project_extract_check "$project" "$@"
}

update() {
	local repository=$project

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository=$project

	project_update_check_git "$project" "$repository" "$@"
}

build() {
	local repository=$project

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	local sources_path=$(project_sources_path "$project" "$repository" "$@")
	local build_path=$(project_build_path "$project" "$@")

	local flashmap_build_path=$(project_build_path "flashmap" "$@")

	if git_project_check "$repository"
	then
		git_project_checkout "$project" "$repository" "$@"
	fi

	mkdir -p "$build_path"

	make -C "$sources_path" objtree="$build_path" "defconfig"
	make -C "$sources_path" objtree="$build_path" EXTRA_CFLAGS="-I $flashmap_build_path/lib" FMAP_LINKOPT="-I $flashmap_build_path/lib -L $flashmap_build_path/lib -lfmap" -j$TASKS

	cp "$sources_path/mosys" "$build_path"

	make -C "$sources_path" "clean"
}

build_check() {
	project_build_check "$project" "$@"
}

install() {
	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local repository=$project

	project_release_install_archive "$project" "$TOOLS" "$@"

	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository=$project

	project_release_install_archive_check "$project" "$TOOLS" "$@"

	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/mosys/mosys


code:
From f8aa6a0eeaa6ae3fd4dfe2d60118a47a3867c906 Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Wed, 10 Feb 2016 20:44:09 +0100
Subject: [PATCH] Force the definition of build tools

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 Makefile | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index c4cd006..5244242 100644
--- a/Makefile
+++ b/Makefile
@@ -264,16 +264,16 @@ include $(srctree)/scripts/Kbuild.include

 # Make variables (CC, etc...)

-AR		?= $(CROSS_COMPILE)ar
-AS		?= $(CROSS_COMPILE)as
-CC		?= $(CROSS_COMPILE)gcc
-CPP		?= $(CC) -E
-LD		?= $(CROSS_COMPILE)ld
-NM		?= $(CROSS_COMPILE)nm
-STRIP		?= $(CROSS_COMPILE)strip
-OBJCOPY		?= $(CROSS_COMPILE)objcopy
-OBJDUMP		?= $(CROSS_COMPILE)objdump
-INSTALL		?= install
+AR		:= $(CROSS_COMPILE)ar
+AS		:= $(CROSS_COMPILE)as
+CC		:= $(CROSS_COMPILE)gcc
+CPP		:= $(CC) -E
+LD		:= $(CROSS_COMPILE)ld
+NM		:= $(CROSS_COMPILE)nm
+STRIP		:= $(CROSS_COMPILE)strip
+OBJCOPY		:= $(CROSS_COMPILE)objcopy
+OBJDUMP		:= $(CROSS_COMPILE)objdump
+INSTALL		:= install
 AWK		= awk
 DEPMOD		= /sbin/depmod
 CHECK		= sparse
--
1.9.1


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

download() {
	local repository="coreboot"

	git_project_prepare "$project" "$repository" "$@"
}

download_check() {
	local repository="coreboot"

	git_project_prepare_check "$project" "$repository" "$@"
}

extract() {
	local repository="coreboot"

	project_extract "$project" "$@"
}

extract_check() {
	local repository="coreboot"

	project_extract_check "$project" "$@"
}

update() {
	local repository="coreboot"

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository="coreboot"

	project_update_check_git "$project" "$repository" "$@"
}

build() {
	local repository="coreboot"

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	local coreboot_sources_path=$(project_sources_path "$project" "$repository" "$@")
	local sources_path="$coreboot_sources_path/util/nvramtool/"
	local build_path=$(project_build_path "$project" "$@")

	if git_project_check "$repository"
	then
		git_project_checkout "$project" "$repository" "$@"
	fi

	mkdir -p "$build_path"

	make -C "$sources_path" -j$TASKS

	cp "$sources_path/nvramtool" "$build_path"

	make -C "$sources_path" "clean"
}

build_check() {
	project_build_check "$project" "$@"
}

install() {
	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local repository="coreboot"

	project_release_install_archive "$project" "$TOOLS" "$@"

	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository="coreboot"

	project_release_install_archive_check "$project" "$TOOLS" "$@"

	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/nvramtool/nvramtool


code:
#
# Automatically generated file; DO NOT EDIT.
# SeaBIOS Configuration
#

#
# General Features
#
CONFIG_COREBOOT=y
# CONFIG_QEMU is not set
# CONFIG_CSM is not set
# CONFIG_QEMU_HARDWARE is not set
CONFIG_THREADS=y
CONFIG_RELOCATE_INIT=y
CONFIG_BOOTMENU=y
CONFIG_BOOTSPLASH=y
CONFIG_BOOTORDER=y
CONFIG_COREBOOT_FLASH=y
CONFIG_LZMA=y
CONFIG_CBFS_LOCATION=0
CONFIG_MULTIBOOT=y
CONFIG_ENTRY_EXTRASTACK=y
CONFIG_MALLOC_UPPERMEMORY=y
CONFIG_ROM_SIZE=0

#
# Hardware support
#
CONFIG_ATA=y
# CONFIG_ATA_DMA is not set
# CONFIG_ATA_PIO32 is not set
CONFIG_AHCI=y
CONFIG_SDCARD=y
CONFIG_MEGASAS=y
CONFIG_FLOPPY=y
CONFIG_FLASH_FLOPPY=y
CONFIG_PS2PORT=y
CONFIG_USB=y
CONFIG_USB_UHCI=y
CONFIG_USB_OHCI=y
CONFIG_USB_EHCI=y
CONFIG_USB_XHCI=y
CONFIG_USB_MSC=y
CONFIG_USB_UAS=y
CONFIG_USB_HUB=y
CONFIG_USB_KEYBOARD=y
CONFIG_USB_MOUSE=y
CONFIG_SERIAL=y
CONFIG_LPT=y
CONFIG_RTC_TIMER=y
CONFIG_HARDWARE_IRQ=y
CONFIG_PMTIMER=y
CONFIG_TSC_TIMER=y

#
# BIOS interfaces
#
CONFIG_DRIVES=y
CONFIG_CDROM_BOOT=y
CONFIG_CDROM_EMU=y
CONFIG_PCIBIOS=y
CONFIG_APMBIOS=y
CONFIG_PNPBIOS=y
CONFIG_OPTIONROMS=y
CONFIG_PMM=y
CONFIG_BOOT=y
CONFIG_KEYBOARD=y
CONFIG_KBD_CALL_INT15_4F=y
CONFIG_MOUSE=y
CONFIG_S3_RESUME=y
CONFIG_VGAHOOKS=y
# CONFIG_DISABLE_A20 is not set
CONFIG_TCGBIOS=y

#
# VGA ROM
#
CONFIG_NO_VGABIOS=y
# CONFIG_VGA_GEODEGX2 is not set
# CONFIG_VGA_GEODELX is not set
# CONFIG_VGA_COREBOOT is not set
# CONFIG_BUILD_VGABIOS is not set
CONFIG_VGA_EXTRA_STACK_SIZE=512

#
# Debugging
#
CONFIG_DEBUG_LEVEL=1
# CONFIG_DEBUG_SERIAL is not set
# CONFIG_DEBUG_SERIAL_MMIO is not set
CONFIG_DEBUG_COREBOOT=y

path: projects/seabios/configs/bios/config


path: projects/seabios/configs/bios/install


code:
bios
vgabios

path: projects/seabios/configs/targets


code:
#
# Automatically generated file; DO NOT EDIT.
# SeaBIOS Configuration
#

#
# General Features
#
CONFIG_COREBOOT=y
# CONFIG_QEMU is not set
# CONFIG_CSM is not set
# CONFIG_QEMU_HARDWARE is not set
CONFIG_THREADS=y
CONFIG_RELOCATE_INIT=y
CONFIG_BOOTMENU=y
CONFIG_BOOTSPLASH=y
CONFIG_BOOTORDER=y
CONFIG_COREBOOT_FLASH=y
CONFIG_LZMA=y
CONFIG_CBFS_LOCATION=0
CONFIG_MULTIBOOT=y
CONFIG_ENTRY_EXTRASTACK=y
CONFIG_MALLOC_UPPERMEMORY=y
CONFIG_ROM_SIZE=0

#
# Hardware support
#
CONFIG_ATA=y
# CONFIG_ATA_DMA is not set
# CONFIG_ATA_PIO32 is not set
CONFIG_AHCI=y
CONFIG_SDCARD=y
CONFIG_MEGASAS=y
CONFIG_FLOPPY=y
CONFIG_FLASH_FLOPPY=y
CONFIG_PS2PORT=y
CONFIG_USB=y
CONFIG_USB_UHCI=y
CONFIG_USB_OHCI=y
CONFIG_USB_EHCI=y
CONFIG_USB_XHCI=y
CONFIG_USB_MSC=y
CONFIG_USB_UAS=y
CONFIG_USB_HUB=y
CONFIG_USB_KEYBOARD=y
CONFIG_USB_MOUSE=y
CONFIG_SERIAL=y
CONFIG_LPT=y
CONFIG_RTC_TIMER=y
CONFIG_HARDWARE_IRQ=y
CONFIG_PMTIMER=y
CONFIG_TSC_TIMER=y

#
# BIOS interfaces
#
CONFIG_DRIVES=y
CONFIG_CDROM_BOOT=y
CONFIG_CDROM_EMU=y
CONFIG_PCIBIOS=y
CONFIG_APMBIOS=y
CONFIG_PNPBIOS=y
CONFIG_OPTIONROMS=y
CONFIG_PMM=y
CONFIG_BOOT=y
CONFIG_KEYBOARD=y
CONFIG_KBD_CALL_INT15_4F=y
CONFIG_MOUSE=y
CONFIG_S3_RESUME=y
CONFIG_VGAHOOKS=y
# CONFIG_DISABLE_A20 is not set
CONFIG_TCGBIOS=y

#
# VGA ROM
#
# CONFIG_NO_VGABIOS is not set
# CONFIG_VGA_GEODEGX2 is not set
# CONFIG_VGA_GEODELX is not set
CONFIG_VGA_COREBOOT=y
CONFIG_BUILD_VGABIOS=y
CONFIG_VGA_EMULATE_TEXT=y
CONFIG_VGA_FIXUP_ASM=y
CONFIG_VGA_ALLOCATE_EXTRA_STACK=y
CONFIG_VGA_EXTRA_STACK_SIZE=512
CONFIG_VGA_VBE=y

#
# Debugging
#
CONFIG_DEBUG_LEVEL=1
# CONFIG_DEBUG_SERIAL is not set
# CONFIG_DEBUG_SERIAL_MMIO is not set
CONFIG_DEBUG_COREBOOT=y

path: projects/seabios/configs/vgabios/config


code:
#!/usr/bin/env bash

# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
# 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 3 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.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

arguments() {
	project_arguments_targets "$project" "$@"
}

usage() {
	project_usage_actions "$project"
	project_usage_arguments "$project" "$@"
}

download() {
	local repository="$project"

	project_download_git "$project" "$repository" 'https://review.coreboot.org/seabios.git' "$@"
}

download_check() {
	local repository="$project"

	project_download_check_git "$project" "$repository" "$@"
}

extract() {
	project_extract "$project" "$@"
}

extract_check() {
	project_extract_check "$project" "$@"
}

update() {
	local repository="$project"

	project_update_git "$project" "$repository" "$@"
}

update_check() {
	local repository="$project"

	project_update_check_git "$project" "$repository" "$@"
}

build() {
	local target="$1"
	local repository="$project"

	project_sources_directory_missing_empty_error "$project" "$repository" "$@"

	if git_project_check "$repository"; then
		git_project_checkout "$project" "$repository" "$@"
	fi

	local project_path="$(project_path "$project")"
	local seabios_config_path="$(project_file_path "$project" "$CONFIGS" 'config' "$@")"
	local sources_path="$(project_sources_path "$project" "$repository" "$@")"
	local build_path="$(project_build_path "$project" "$@")"

	mkdir -p "$build_path"
	cp "$seabios_config_path" "$sources_path/.config"

	make -C "$sources_path" -j"$TASKS"

	if [[ "$target" == 'bios' ]]; then
		cp "$sources_path/out/bios.bin.elf" "$build_path"
	elif [[ "$target" == 'vgabios' ]]; then
		cp "$sources_path/out/vgabios.bin" "$build_path"
	fi

	make -C "$sources_path" distclean

	rm -f "$sources_path/.config"
}

build_check() {
	project_build_check "$project" "$@"
}

install() {
	project_install "$project" "$@"
}

install_check() {
	project_install_check "$project" "$@"
}

release() {
	local repository="$project"

	project_release_install_archive "$project" "$IMAGES" "$@"
	project_release_sources_git "$project" "$repository" "$@"
}

release_check() {
	local repository="$project"

	project_release_install_archive_check "$project" "$IMAGES" "$@"
	project_release_check_sources_git "$project" "$repository" "$@"
}

clean() {
	project_clean "$project" "$@"
}

path: projects/seabios/seabios


code:
tests/devkeys/firmware_bmpfv.bin
tests/devkeys-pkc/firmware_bmpfv.bin
tests/futility/data/bios_link_mp.bin
tests/futility/data/bios_mario_mp.bin
tests/futility/data/bios_peppy_mp.bin
tests/futility/data/bios_zgb_mp.bin
tests/futility/data/dingdong.signed
tests/futility/data/dingdong.unsigned
tests/futility/data/fw_gbb.bin
tests/futility/data/fw_vblock.bin
tests/futility/data/hoho.signed
tests/futility/data/hoho.unsigned
tests/futility/data/kern_preamble.bin
tests/futility/data/minimuffin.signed
tests/futility/data/minimuffin.unsigned
tests/futility/data/rec_kernel_part.bin
tests/futility/data/vmlinuz-amd64.bin
tests/futility/data/vmlinuz-arm.bin
tests/futility/data/zinger_mp_image.bin
tests/futility/data/zinger.signed
tests/futility/data/zinger.unsigned
tests/preamble_tests

path: projects/vboot/configs/blobs


code:
bdb/sha.c
bdb/bdb_create.c
cgpt/cgpt_wrapper.c
firmware/lib/tpm_lite/include/tlcl_structures.h
firmware/lib/cgptlib/crc32.c
firmware/lib/cryptolib/padding.c
firmware/2lib/2sha512.c
firmware/2lib/2sha256.c
firmware/bdb/secrets.c
futility/cmd_gbb_utility.c
scripts/image_signing/tag_image.sh
scripts/image_signing/strip_boot_from_image.sh
scripts/image_signing/make_dev_ssd.sh
scripts/image_signing/tofactory.sh
scripts/image_signing/sign_official_build.sh
scripts/image_signing/sign_nv_cbootimage.sh
tests/rsa_padding_test.h
tests/bdb_sprw_test.c
tests/crc32_test.c
tests/vb2_api_tests.c
tests/sha_test_vectors.h
tests/gen_preamble_testdata.sh
tests/load_kernel_tests.sh
tests/vb21_host_misc_tests.c
tests/run_vbutil_kernel_arg_tests.sh
tests/cgptlib_test.c
tests/vb2_sha_tests.c
tests/futility/test_file_types.c
tests/futility/test_file_types.sh
tests/futility/test_dump_fmap.sh
tests/testcases/padding_test_vectors.inc
utility/bmpblk_font.c
utility/vbutil_what_keys

path: projects/vboot/configs/blobs-ignore


code:
./3rdparty/vboot/tests/testcases/padding_test_vectors.inc
It's not a blob, see tests/rsa_padding_test.h for explanation.

The text in this file is CC-BY-SA 4.0 or higher. All contributions to it must
be made under the same license.


code:
devices
tools

path: projects/vboot/configs/targets


code:
cgpt/cgpt:cgpt
futility/futility:futility
utility/crossystem:crossystem
utility/tpmc:tpmc
devkeys:devkeys

path: projects/vboot/configs/tools/install


code:
From 0e8e89b19a4e47802ed6ea64a35da77665cc3d3f Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Mon, 10 Aug 2015 20:33:23 +0200
Subject: [PATCH 1/7] firmware: Developer mode timeout delay shortening (down
 to 3 seconds)

A timeout delay of 3 seconds, with no bip, is much more appreciable for users.

Change-Id: If4bc879f350a4a0297395077e4f55e89f4fa764d
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 firmware/lib/vboot_audio.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/firmware/lib/vboot_audio.c b/firmware/lib/vboot_audio.c
index 8f31171..7e92dc7 100644
--- a/firmware/lib/vboot_audio.c
+++ b/firmware/lib/vboot_audio.c
@@ -30,11 +30,7 @@
 #define MAX_CUSTOM_DELAY      300000

 /* These are visible externally only to make testing easier */
-VbDevMusicNote default_notes_[] = { {20000, 0}, /* 20 seconds */
-                                    {250, 400}, /* two beeps */
-                                    {250, 0},
-                                    {250, 400},
-                                    {9250, 0} }; /* total 30 seconds */
+VbDevMusicNote default_notes_[] = { {3000, 0} }; /* three seconds */
 uint32_t default_count_ = sizeof(default_notes_) / sizeof(VbDevMusicNote);

 VbDevMusicNote short_notes_[] = { {2000, 0} }; /* two seconds */
--
2.10.2


code:
From 5f402b9d365dbc17ea68803aeb9a95da01708b9f Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Mon, 10 Aug 2015 22:44:50 +0200
Subject: [PATCH 2/7] firmware: Text-based screen display in priority

This allows showing text-based screen displays before looking at the GBB bitmaps
since those encourage the use of non-free software (Chrome OS) and don't display
enough information to the user.

Change-Id: I1dc454cd5de1cf096a15957832a8114d4f758eac
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 firmware/lib/vboot_display.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index 1abed92..50a2e54 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -335,20 +335,18 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen,
 	/* If the screen is blank, turn off the backlight; else turn it on. */
 	VbExDisplayBacklight(VB_SCREEN_BLANK == screen ? 0 : 1);

-	/* Look in the GBB first */
-	if (VBERROR_SUCCESS == VbDisplayScreenFromGBB(cparams, screen,
-						      vncptr, locale))
+	/* Display default first */
+	if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale))
 		return VBERROR_SUCCESS;

-	/* If screen wasn't in the GBB bitmaps, fall back to a default */
-	return VbExDisplayScreen(screen, locale);
+	/* If default doesn't have anything to show, fall back to GBB bitmaps */
+	return VbDisplayScreenFromGBB(cparams, screen, vncptr, locale);
 }

 VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
 			  int force, VbNvContext *vncptr)
 {
 	uint32_t locale;
-	GoogleBinaryBlockHeader *gbb = cparams->gbb;
 	VbError_t rv;

 	/* If requested screen is the same as the current one, we're done. */
@@ -358,11 +356,8 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
 	/* Read the locale last saved */
 	VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale);

-	if (gbb->bmpfv_size == 0)
-		rv = VbExDisplayScreen(screen, locale);
-	else
-		rv = VbDisplayScreenLegacy(cparams, screen, force, vncptr,
-					   locale);
+	rv = VbDisplayScreenLegacy(cparams, screen, force, vncptr,
+				   locale);

 	if (rv == VBERROR_SUCCESS)
 		/* Keep track of the currently displayed screen */
--
2.10.2


code:
From 78297c1fa4a158047e7bfa8bf0b3435fe498811d Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Mon, 10 Aug 2015 22:59:50 +0200
Subject: [PATCH 3/7] firmware: Hold key combination in developer mode

This binds the Ctrl + H key combination to hold the developer mode screen.

Change-Id: Ia76080eacd2e5e78b35b83d0f3783bfa5137794a
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 firmware/lib/vboot_api_kernel.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index e465fc3..2e31f08 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -308,6 +308,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
 	uint32_t use_legacy = 0;
 	uint32_t default_boot = 0;
 	uint32_t ctrl_d_pressed = 0;
+	uint32_t hold = 0;

 	VbAudioContext *audio = 0;

@@ -473,6 +474,12 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
 			ctrl_d_pressed = 1;
 			goto fallout;
 			break;
+		case 0x08:
+			/* Ctrl+H = hold */
+			VBDEBUG(("VbBootDeveloper() - "
+				 "hold developer mode screen\n"));
+			hold = 1;
+			break;
 		case 0x0c:
 			VBDEBUG(("VbBootDeveloper() - "
 				 "user pressed Ctrl+L; Try legacy boot\n"));
@@ -523,7 +530,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
 			VbCheckDisplayKey(cparams, key, &vnc);
 			break;
 		}
-	} while(VbAudioLooping(audio));
+	} while(hold || VbAudioLooping(audio));

  fallout:

--
2.10.2


code:
From 4560df9f84e342ef51cf071dccd01e3fb5838a37 Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Mon, 10 Aug 2015 23:13:49 +0200
Subject: [PATCH 4/7] firmware: Screen blank and wait at disabled USB boot
 warning

This blanks the screen before showing the disabled USB boot warning.
It also waits for the user to press any key to come back to the developer mode
screen.

Change-Id: Ic23f1e0f8d269242a9b7af6941806951016e6eb4
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 firmware/lib/vboot_api_kernel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 2e31f08..5cf45ec 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -376,6 +376,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
 		}
 	}

+developer_mode_screen:
 	/* Show the dev mode warning screen */
 	VbDisplayScreen(cparams, VB_SCREEN_DEVELOPER_WARNING, 0, &vnc);

@@ -498,14 +499,23 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
 			if (!allow_usb) {
 				VBDEBUG(("VbBootDeveloper() - "
 					 "USB booting is disabled\n"));
+
+				VbDisplayScreen(cparams, VB_SCREEN_BLANK, 1,
+						&vnc);
+
 				VbExDisplayDebugInfo(
 					"WARNING: Booting from external media "
 					"(USB/SD) has not been enabled. Refer "
 					"to the developer-mode documentation "
-					"for details.\n");
+					"for details.\n\n"
+					"Press any key to continue.\n\n");
 				VbExBeep(120, 400);
 				VbExSleepMs(120);
 				VbExBeep(120, 400);
+
+				while (!VbExKeyboardRead()) ;
+
+				goto developer_mode_screen;
 			} else {
 				/*
 				 * Clear the screen to show we get the Ctrl+U
--
2.10.2