~amjoseph/ownerboot

466764c82ae5fc135494a95d80ed151f79504f31 — Adam Joseph 9 months ago c0b97fc
flashrom: patch chromebook fork to not expect crossystem in $PATH

Google's fork of flashrom, which is the only one that can write to
the EC, expects to find a binary called `crossystem` in the $PATH at
runtime.  If not found, it still works, but prints a weird message
to the console.

This patch circumvents the code which tries to execute crossystem so
the weird message will not appear.
A src/util/flashrom/0003-layout.c-do-not-attempt-to-invoke-crossystem.patch => src/util/flashrom/0003-layout.c-do-not-attempt-to-invoke-crossystem.patch +33 -0
@@ 0,0 1,33 @@
From 31cf399d3aee937d52013ef69e6645160fc7f5a4 Mon Sep 17 00:00:00 2001
From: Adam Joseph <adam@westernsemico.com>
Date: Sun, 22 Oct 2023 19:52:14 -0700
Subject: [PATCH] layout.c: do not attempt to invoke crossystem

---
 layout.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/layout.c b/layout.c
index 346e90de..aefd526b 100644
--- a/layout.c
+++ b/layout.c
@@ -233,6 +233,8 @@ static int get_crossystem_fmap_base(struct search_info *search, off_t *offset)
 	unsigned long fmap_base;
 	unsigned long from_top;
 
+        return -1;
+#if 0
 	if (!(fp = popen(cmd, "r")))
 		return -1;
 	n = fread(buf, 1, sizeof(buf) - 1, fp);
@@ -295,6 +297,7 @@ static int get_crossystem_fmap_base(struct search_info *search, off_t *offset)
 
 	msg_gdbg("%s: ROM offset: %#jx\n", __func__, (intmax_t)*offset);
 	return 0;
+#endif
 }
 
 static int add_fmap_entries_from_buf(const uint8_t *buf)
-- 
2.41.0


M src/util/flashrom/default.nix => src/util/flashrom/default.nix +1 -0
@@ 44,6 44,7 @@ stdenv.mkDerivation {
    ./0001-implement-wp-enable-disable-for-gigadevice-flash-chi.patch
  ] ++ lib.optionals forChromebook [
    ../../platform/kevin/chromebook-flashrom-kludges.patch
    ./0003-layout.c-do-not-attempt-to-invoke-crossystem.patch
  ] ++ lib.optionals overlappingFmapRegionSupport [
    ./0002-layout.c-allow-nested-regions.patch
  ];