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:
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);
 }

repo_name: ShalokShalom/libreboot

license: mit


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


path: projects/fontconfig/configs/revision


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


path: projects/grub/configs/bios/arch


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

path: projects/grub/configs/bios/config


path: projects/grub/configs/bios/format


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


path: projects/grub/configs/bios/size


path: projects/grub/configs/coreboot/arch


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


path: projects/grub/configs/install


path: projects/grub/configs/revision


code:
bios
coreboot
uefi

path: projects/grub/configs/targets


path: projects/grub/configs/uefi/arch


path: projects/grub/configs/uefi/config


path: projects/grub/configs/uefi/format


path: projects/grub/configs/uefi/install


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/grubenv


path: projects/grub/install/install


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


path: projects/hdctools/configs/revision


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:
ich9fdgbe_4m.bin:ich9fdgbe_4m.bin
ich9fdgbe_8m.bin:ich9fdgbe_8m.bin
ich9fdgbe_16m.bin:ich9fdgbe_16m.bin
ich9fdnogbe_4m.bin:ich9fdnogbe_4m.bin
ich9fdnogbe_8m.bin:ich9fdnogbe_8m.bin
ich9fdnogbe_16m.bin:ich9fdnogbe_16m.bin
ich9gen:ich9gen
mkgbe.c:mkgbe.c
mkgbe.h:mkgbe.h


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" "$@"
}

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" ich9gen

	(
		local macaddress="$(ich9gen_macaddress)"

		cd "$build_path"

		if [[ -n $macaddress ]]; then
			"$sources_path"/ich9gen --macaddress "$macaddress"
		else
			"$sources_path"/ich9gen
		fi
	)

	cp "$sources_path/ich9gen" "$build_path"
	make -C "$sources_path" clean
}

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

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

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

release() {
	project_release_install_archive "$project" "$TOOLS" "$@"
	project_release_sources_archive_create "$project" "$@"
}

release_check() {
	project_release_install_archive_check "$project" "$TOOLS" "$@"
	project_release_sources_archive_exists_check "$project" "$@"
}

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


code:
#!/usr/bin/env bash

# Copyright (C) 2018 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/>.

MACADDRESS='macaddress'

ich9gen_macaddress() {
	project_file_contents "$project" "$CONFIGS" "$MACADDRESS" "$@"
}


code:
#
# Makefile for ich9deblob utility from libreboot project
#
# Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 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/>.
#

CC=gcc
FORCEC99=-std=c99
CFLAGS=-I. -Wall -Wextra -g $(FORCEC99)
NOLINKER=-c

.PHONY: all clean

all: ich9deblob ich9gen demefactory

ich9deblob: obj/ich9deblob.o obj/common/descriptor_gbe.o \
		obj/descriptor/descriptor.o obj/gbe/gbe.o obj/common/x86compatibility.o

	$(CC) $(CFLAGS) obj/ich9deblob.o obj/common/descriptor_gbe.o \
		obj/common/x86compatibility.o obj/descriptor/descriptor.o obj/gbe/gbe.o \
		 -o ich9deblob

ich9gen: obj/ich9gen.o obj/ich9gen/mkdescriptor.o obj/ich9gen/mkgbe.o \
		obj/common/descriptor_gbe.o \
		obj/descriptor/descriptor.o obj/gbe/gbe.o obj/common/x86compatibility.o

	$(CC) $(CFLAGS) obj/ich9gen.o obj/ich9gen/mkdescriptor.o obj/ich9gen/mkgbe.o \
	 obj/common/descriptor_gbe.o \
		obj/common/x86compatibility.o obj/descriptor/descriptor.o obj/gbe/gbe.o \
		 -o ich9gen

demefactory: obj/demefactory.o obj/common/descriptor_gbe.o \
		obj/descriptor/descriptor.o obj/gbe/gbe.o obj/common/x86compatibility.o

	$(CC) $(CFLAGS) obj/demefactory.o obj/common/descriptor_gbe.o \
		obj/common/x86compatibility.o obj/descriptor/descriptor.o obj/gbe/gbe.o \
		 -o demefactory

# for demefactory
# ----------------------------------------------------------------------

obj/demefactory.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/demefactory.c -o obj/demefactory.o

# for ich9deblob
# ----------------------------------------------------------------------

obj/ich9deblob.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/ich9deblob.c -o obj/ich9deblob.o

# for ich9gen
# ----------------------------------------------------------------------

obj/ich9gen.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/ich9gen.c -o obj/ich9gen.o

obj/ich9gen/mkdescriptor.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/ich9gen/mkdescriptor.c -o obj/ich9gen/mkdescriptor.o

obj/ich9gen/mkgbe.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/ich9gen/mkgbe.c -o obj/ich9gen/mkgbe.o

# for demefactory, ich9deblob and ich9gen:
# ----------------------------------------------------------------------

obj/common/descriptor_gbe.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/common/descriptor_gbe.c -o obj/common/descriptor_gbe.o

obj/common/x86compatibility.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/common/x86compatibility.c -o obj/common/x86compatibility.o

obj/descriptor/descriptor.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/descriptor/descriptor.c -o obj/descriptor/descriptor.o

obj/gbe/gbe.o:
	$(CC) $(CFLAGS) $(NOLINKER) src/gbe/gbe.c -o obj/gbe/gbe.o

# make clean
# ----------------------------------------------------------------------
clean:
	rm -Rf ich9deblob ich9gen demefactory obj/*.o obj/*/*.o


code:
/*
 *  descriptor_gbe.c
 *  This file is part of the ich9deblob utility from the libreboot project
 *
 * Purpose: common descriptor/gbe functions used by ich9deblob
 *
 *  Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
 *  Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 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/>.
 */

#include "descriptor_gbe.h"

/*
 * create 12KiB file with descriptor, and then gbe immediately after.
 */
int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k, char* fileName)
{
	FILE* fileStream = NULL;

	/* delete old file before continuing */
	remove(fileName);

	/* open new file for writing the descriptor+gbe */
	fileStream = fopen(fileName, "ab");

	/* write the descriptor region into the first part */
	if (DESCRIPTORREGIONSIZE != fwrite((uint8_t*)&descriptorStruct, 1, sizeof(descriptorStruct), fileStream))
	{
		printf("\nerror: writing descriptor region failed\n");
		return 1;
	}

	/* add gbe to the end of the file */
	if (GBEREGIONSIZE_8K != fwrite((uint8_t*)&gbeStruct8k, 1, sizeof(gbeStruct8k), fileStream))
	{
		printf("\nerror: writing GBe region failed\n");
		return 1;
	}

	fclose(fileStream);

	printf("descriptor and gbe successfully written to the file: %s\n", fileName);
	printf("Now do: dd if=%s of=libreboot.rom bs=1 count=12k conv=notrunc\n", fileName);
	printf("(in other words, add the modified descriptor+gbe to your ROM image)\n\n");

	return 0;
}

/*
 * create 4KiB file with descriptor
 */
int notCreated4kDescriptorFile(struct DESCRIPTORREGIONRECORD descriptorStruct, char* fileName)
{
	FILE* fileStream = NULL;

	/* delete old file before continuing */
	remove(fileName);

	/* open new file for writing the descriptor+gbe */
	fileStream = fopen(fileName, "ab");

	/* write the descriptor region into the first part */
	if (DESCRIPTORREGIONSIZE != fwrite((uint8_t*)&descriptorStruct, 1, sizeof(descriptorStruct), fileStream))
	{
		printf("\nerror: writing descriptor region failed\n");
		return 1;
	}

	fclose(fileStream);

	printf("descriptor successfully written to the file: %s\n", fileName);
	printf("Now do: dd if=%s of=yourrom.rom bs=1 count=4k conv=notrunc\n", fileName);
	printf("(in other words, add the modified descriptor to your ROM image)\n\n");

	return 0;
}


code:
/*
 *  gbe_descriptor.h
 *  This file is part of the ich9deblob utility from the libreboot project
 *
 * Purpose: header file for descriptor_gbe.c
 *
 *  Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
 *  Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 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/>.
 */

#ifndef COMMON_DESCRIPTOR_GBE_H
#define COMMON_DESCRIPTOR_GBE_H

#include <stdio.h>
#include <string.h>
#include <stdint.h>

#include "../descriptor/descriptor.h" /* structs describing what's in the descriptor region */
#include "../gbe/gbe.h"               /* structs describing what's in the gbe region */

int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k, char* fileName);
int notCreated4kDescriptorFile(struct DESCRIPTORREGIONRECORD descriptorStruct, char* fileName);

#endif


code:
/*
 *  x86compatibility.c
 *  This file is part of the ich9deblob utility from the libreboot project
 *
 * Purpose: compiler/cpu compatibility checks. ich9deblob is not portable, yet.
 *
 *  Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
 *                     Leah Rowe <info@minifree.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 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/>.
 */

#include "x86compatibility.h"

/*
 * ---------------------------------------------------------------------
 * x86 compatibility checking:
 * ---------------------------------------------------------------------
 */

/* fail if struct size is incorrect */
int structSizesIncorrect(struct DESCRIPTORREGIONRECORD descriptorDummy, struct GBEREGIONRECORD_8K gbe8kDummy)
{
	unsigned int descriptorRegionStructSize = sizeof(descriptorDummy);
	unsigned int gbeRegion8kStructSize = sizeof(gbe8kDummy);

	/* check compiler bit-packs in a compatible way. basically, it is expected that this code will be used on x86 */
	if (DESCRIPTORREGIONSIZE != descriptorRegionStructSize){
		printf("\nerror: compiler incompatibility: descriptor struct length is %i bytes (should be %i)\n", descriptorRegionStructSize, DESCRIPTORREGIONSIZE);
		return 1;
	}
	if (GBEREGIONSIZE_8K != gbeRegion8kStructSize){
		printf("\nerror: compiler incompatibility: gbe struct length is %i bytes (should be %i)\n", gbeRegion8kStructSize, GBEREGIONSIZE_8K);
		return 1;
	}

	return 0;
}

/* fail if members are presented in the wrong order */
int structMembersWrongOrder()
{
	int i;
	struct DESCRIPTORREGIONRECORD descriptorDummy;
	uint8_t *meVsccTablePtr = (uint8_t*)&descriptorDummy.meVsccTable;

	/* These do not use bitfields.  */
	descriptorDummy.meVsccTable.jid0 = 0x01020304;  /* unsigned int 32-bit */
	descriptorDummy.meVsccTable.vscc0 = 0x10203040; /* unsigned int 32-bit */
	descriptorDummy.meVsccTable.jid1 = 0x11223344;  /* unsigned int 32-bit */
	descriptorDummy.meVsccTable.vscc1 = 0x05060708; /* unsigned int 32-bit */
	descriptorDummy.meVsccTable.jid2 = 0x50607080;  /* unsigned int 32-bit */
	descriptorDummy.meVsccTable.vscc2 = 0x55667788; /* unsigned int 32-bit */
	descriptorDummy.meVsccTable.padding[0] = 0xAA;  /* unsigned char 8-bit */
	descriptorDummy.meVsccTable.padding[1] = 0xBB;  /* unsigned char 8-bit */
	descriptorDummy.meVsccTable.padding[2] = 0xCC;  /* unsigned char 8-bit */
	descriptorDummy.meVsccTable.padding[3] = 0xDD;  /* unsigned char 8-bit */

	/*
	 * Look from the top down, and concatenate the unsigned ints but
	 * with each unsigned in little endian order.
	 * Then, concatenate the unsigned chars in big endian order. (in the padding array)
	 *
	 * combined, these should become:
	 * 01020304 10203040 11223344 05060708 50607080 55667788 AA BB CC DD (ignore this. big endian. just working it out manually:)
	 * 04030201 40302010 44332211 08070605 80706050 88776655 AA BB CC DD (ignore this. not byte-separated, just working it out:)
	 * 04 03 02 01 40 30 20 10 44 33 22 11 08 07 06 05 80 70 60 50 88 77 66 55 AA BB CC DD <-- it should match this
	 */

	if (
			!
			(
				*meVsccTablePtr      == 0x04 && *(meVsccTablePtr+1)  == 0x03 && *(meVsccTablePtr+2)  == 0x02 && *(meVsccTablePtr+3)  == 0x01
			&& *(meVsccTablePtr+4)  == 0x40 && *(meVsccTablePtr+5)  == 0x30 && *(meVsccTablePtr+6)  == 0x20 && *(meVsccTablePtr+7)  == 0x10
			&& *(meVsccTablePtr+8)  == 0x44 && *(meVsccTablePtr+9)  == 0x33 && *(meVsccTablePtr+10) == 0x22 && *(meVsccTablePtr+11) == 0x11
			&& *(meVsccTablePtr+12) == 0x08 && *(meVsccTablePtr+13) == 0x07 && *(meVsccTablePtr+14) == 0x06 && *(meVsccTablePtr+15) == 0x05
			&& *(meVsccTablePtr+16) == 0x80 && *(meVsccTablePtr+17) == 0x70 && *(meVsccTablePtr+18) == 0x60 && *(meVsccTablePtr+19) == 0x50
			&& *(meVsccTablePtr+20) == 0x88 && *(meVsccTablePtr+21) == 0x77 && *(meVsccTablePtr+22) == 0x66 && *(meVsccTablePtr+23) == 0x55
			&& *(meVsccTablePtr+24) == 0xAA && *(meVsccTablePtr+25) == 0xBB && *(meVsccTablePtr+26) == 0xCC && *(meVsccTablePtr+27) == 0xDD
	      )
	   ) {

		printf("\nStruct member order check (descriptorDummy.meVsccTable) with junk/dummy data:");
		printf("\nShould be: 04 03 02 01 40 30 20 10 44 33 22 11 08 07 06 05 80 70 60 50 88 77 66 55 aa bb cc dd ");
		printf("\nAnd it is: ");

		for (i = 0; i < 28; i++) {
			printf("%02x ", *(meVsccTablePtr + i));
		}
		printf("\nIncorrect order.\n");

		return 1;
	}

	return 0;
}

/* fail if bit fields are presented in the wrong order */
int structBitfieldWrongOrder()
{
	int i;
	struct DESCRIPTORREGIONRECORD descriptorDummy;
	uint8_t *flMap0Ptr = (uint8_t*)&descriptorDummy.flMaps.flMap0;

	descriptorDummy.flMaps.flMap0.FCBA = 0xA2;      /* :8 --> 10100010 */
	descriptorDummy.flMaps.flMap0.NC = 0x02;        /* :2 --> 10       */
	descriptorDummy.flMaps.flMap0.reserved1 = 0x38; /* :6 --> 111000   */
	descriptorDummy.flMaps.flMap0.FRBA = 0xD2;      /* :8 --> 11010010 */
	descriptorDummy.flMaps.flMap0.NR = 0x05;        /* :3 --> 101      */
	descriptorDummy.flMaps.flMap0.reserved2 = 0x1C; /* :5 --> 11100    */

	/*
	 * Look from the top bottom up, and concatenate the binary strings.
	 * Then, convert the 8-bit groups to hex and reverse the (8-bit)byte order
	 *
	 * combined, these should become (in memory), in binary:
	 * 10100010 11100010 11010010 11100101
	 * or in hex:
	 * A2 E2 D2 E5
	 */

	if (!(*flMap0Ptr == 0xA2 && *(flMap0Ptr+1) == 0xE2 && *(flMap0Ptr+2) == 0xD2 && *(flMap0Ptr+3) == 0xE5))
	{
		printf("\nBitfield order check (descriptorDummy.flMaps.flMaps0) with junk/dummy data:");
		printf("\nShould be: a2 e2 d2 e5 ");
		printf("\nAnd it is: ");

		for (i = 0; i < 4; i++) {
			printf("%02x ", *(flMap0Ptr + i));
		}
		printf("\nIncorrect order.\n");

		return 1;
	}

	return 0;
}

/* Compatibility checks. This version of ich9deblob is not yet porable. */
int systemOrCompilerIncompatible(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k)
{
	if (structSizesIncorrect(descriptorStruct, gbeStruct8k)) return 1;
	if (IS_BIG_ENDIAN) {
		printf("big endian not supported\n");
		return 1;
	}
	if (structBitfieldWrongOrder()) return 1;
	if (structMembersWrongOrder()) return 1;
	return 0;
}


code:
/*
 *  x86compatibility.h
 *  This file is part of the ich9deblob utility from the libreboot project
 *
 * Purpose: keep gcc/make happy. no actual code here, just function definitions.
 *
 *  Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
 *                     Leah Rowe <info@minifree.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 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/>.
 */

#ifndef X86COMPATIBILITY_H
#define X86COMPATIBILITY_H

#include <stdio.h>
#include <string.h>
#include <stdint.h>

/* http://esr.ibiblio.org/?p=5095 */
#define IS_BIG_ENDIAN (*(uint16_t *)"\0\xff" < 0x100)

#include "../descriptor/descriptor.h" /* structs describing what's in the descriptor region */
#include "../gbe/gbe.h"               /* structs describing what's in the gbe region */

int structSizesIncorrect(struct DESCRIPTORREGIONRECORD descriptorDummy, struct GBEREGIONRECORD_8K gbe8kDummy);
int structMembersWrongOrder();
int structBitfieldWrongOrder();
int systemOrCompilerIncompatible(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k);

#endif


code:
/*
 *  demefactory.c
 *  This file is part of the demefactory utility from the libreboot project
 *
 * Purpose: disable ME on GM45 factory firmware, but leave region intact
 * 			enable read-write on all regions
 *
 *	 Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
 *  Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 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/>.
 */

/*
 * demfactory utility - main
 */

#include "demefactory.h"

int main()
{
	struct DESCRIPTORREGIONRECORD descriptorStruct;
	uint8_t* descriptorBuffer = (uint8_t*)&descriptorStruct;

	struct GBEREGIONRECORD_8K gbeStruct8k; /* not needed, except for compatibility checking */

	char* romFilename = "factory.rom";
	char* descriptorFilename = "demefactory_4kdescriptor.bin";

	unsigned int bufferLength;
	unsigned int romSize;

	/*
	 * ------------------------------------------------------------------
	 * Compatibility checks. This version of ich9deblob is not yet portable.
	 * ------------------------------------------------------------------
	 */

	if (systemOrCompilerIncompatible(descriptorStruct, gbeStruct8k)) return 1;
	/* If true, fail with error message */

	/*
	 * ------------------------------------------------------------------
	 * Extract the descriptor region from the factory.rom dump
	 * ------------------------------------------------------------------
	 */
	FILE* fp = NULL;
	fp = fopen(romFilename, "rb"); /* open factory.rom */
	if (NULL == fp)
	{
		printf("\nerror: could not open %s\n", romFilename);
		fclose(fp);
		return 1;
	}
	printf("\n%s opened successfully\n", romFilename);

	/*
	 * Get the descriptor region dump from the factory.rom
	 * (goes in factoryDescriptorBuffer variable)
	 */
	bufferLength = fread(descriptorBuffer, 1, DESCRIPTORREGIONSIZE, fp);
	if (DESCRIPTORREGIONSIZE != bufferLength) //
	{
		printf("\nerror: could not read descriptor from %s (%i) bytes read\n", romFilename, bufferLength);
		fclose(fp);
		return 1;
	}
	printf("\ndescriptor region read successfully\n");

	/* ------------------------------------------------- */

	fseek(fp, 0L, SEEK_END);
	romSize = ftell(fp);
	printf("\n%s size: [%i] bytes\n", romFilename, romSize);

	/* -------------------------------------------------- */

	fclose(fp);

	/* Debugging (before modification) */
	printDescriptorRegionLocations(descriptorStruct, "Original");

	/*
	 * ------------------------------------------------------------------
	 * Modify the descriptor region, ready to go in the modified factory.rom
	 * ------------------------------------------------------------------
	 */

	// Disable the ME/TPM:
	descriptorStruct = descriptorDisableMe(descriptorStruct);
	descriptorStruct = descriptorDisableTpm(descriptorStruct);

	/* Host/CPU is allowed to read/write all regions. */
	descriptorStruct = descriptorHostRegionsUnlocked(descriptorStruct);
	/* The ME is disallowed read-write access to all regions
	 * (this is probably redundant, since the ME is already removed from libreboot) */
	descriptorStruct = descriptorMeRegionsForbidden(descriptorStruct);

	/* Debugging (after modifying the descriptor region) */
	printDescriptorRegionLocations(descriptorStruct, "Modified");

	/*
	 * ------------------------------------------------------------------
	 * Create the file with the modified descriptor inside
	 * ------------------------------------------------------------------
	 */

	printf("\n");
	if (notCreated4kDescriptorFile(descriptorStruct, descriptorFilename)) {
		return 1;
	}

	/*
	 * ------------------------------------------------------------------
	 * Generate ich9gen data (C code that will recreate the deactivatedME descriptor from scratch)
	 * ------------------------------------------------------------------
	 */
	/* Code for generating the Descriptor struct */
	/* mkdescriptor.h */
	if (notCreatedHFileForDescriptorCFile("mkdescriptor.h", "mkdescriptor.c")) {
		return 1;
	} /* and now mkdescriptor.c */
	if (notCreatedCFileFromDescriptorStruct(descriptorStruct, "mkdescriptor.c", "mkdescriptor.h")) {
		return 1;
	}

	printf("The modified descriptor region has also been dumped as src files: mkdescriptor.c, mkdescriptor.h\n\n");

	return 0;
}


code:
/*
 *  Copyright (C) 2015 Leah Rowe <info@minifree.org>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 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/>.
 */

/* Header file for demefactory.c */

#ifndef DEMEFACTORY_H
#define DEMEFACTORY_H

#include <stdio.h>
#include <string.h>
#include <stdint.h>

#include "common/descriptor_gbe.h"   /* common descriptor/gbe functions used by ich9deblob */
#include "common/x86compatibility.h" /* system/compiler compatibility checks. This code is not portable. */
#include "descriptor/descriptor.h"   /* structs describing what's in the descriptor region */
#include "gbe/gbe.h"                 /* structs describing what's in the gbe region */

int main();

#endif