gnuboot-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 14/14] Build bucts and patched flashrom for I945 ThinkPads


From: Adrien 'neox' Bourmault
Subject: Re: [PATCH v1 14/14] Build bucts and patched flashrom for I945 ThinkPads with Guix.
Date: Mon, 29 Apr 2024 16:58:38 +0200
User-agent: Evolution 3.48.4

GNU Boot can be installed on some I945 ThinkPads without disassembling
them. To do that it requires both a patched flashrom and bucts.

This build them and also integrate Guix in GNU Boot as a dependency to
build them.

This will enable us to later on ship these utilities and then update
the installation instructions to use them somehow.

It also makes sure that we have proper authorship of the patch used
for flashrom and also unify the two flashrom patches not to require
two different flashrom binaries.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
neox: acking, provided
        - a valid copyright notice is added to 
          resources/guix/gnuboot/packages/i945-thinkpads-install-utilities.scm
        - the duplicated .PHONY is removed in 
          resources/packages/i945-thinkpads-install-utilities/Makefile.am
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
---
 .gitignore                                    |   1 -
 Makefile.am                                   |   4 +-
 build                                         |   4 +-
 configure.ac                                  |  31 +++-
 download                                      |   4 +-
 .../i945-thinkpads-install-utilities.scm      | 166 ++++++++++++++++++
 .../guix/gnuboot/patches/flashrom-1.2.patch   |  64 +++++++
 resources/packages/flashrom/clean             |  35 ----
 resources/packages/flashrom/download          |  68 -------
 resources/packages/flashrom/module            |  40 -----
 .../Makefile.am                               |  95 ++++++++++
 .../i945-thinkpads-install-utilities/clean    |  19 ++
 .../distclean                                 |  12 +-
 .../i945-thinkpads-install-utilities/download |  19 ++
 .../i945-thinkpads-install-utilities/module   |  19 ++
 resources/packages/src/release                |   2 +-
 .../misc/generate-configure-makefiles.sh      |   2 +-
 site/contrib.md                               |   4 +-
 site/docs/build/index.md                      |  54 +++++-
 site/docs/install/x60flashscript.patch        |  27 ---
 site/tasks/index.md                           |   6 -
 tests/lint                                    |   5 +-
 22 files changed, 480 insertions(+), 201 deletions(-)
 create mode 100644 
resources/guix/gnuboot/packages/i945-thinkpads-install-utilities.scm
 create mode 100644 resources/guix/gnuboot/patches/flashrom-1.2.patch
 delete mode 100755 resources/packages/flashrom/clean
 delete mode 100755 resources/packages/flashrom/download
 delete mode 100755 resources/packages/flashrom/module
 create mode 100644 
resources/packages/i945-thinkpads-install-utilities/Makefile.am
 create mode 100755 resources/packages/i945-thinkpads-install-utilities/clean
 rename resources/packages/{flashrom => 
i945-thinkpads-install-utilities}/distclean (76%)
 create mode 100755 resources/packages/i945-thinkpads-install-utilities/download
 create mode 100755 resources/packages/i945-thinkpads-install-utilities/module
 delete mode 100644 site/docs/install/x60flashscript.patch

diff --git a/.gitignore b/.gitignore
index b5f6a39..e33e179 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,6 @@
 /depthcharge/
 /descriptors/
 /docs/version
-/flashrom/
 /grub/
 /ich9utils/
 /me_cleaner/
diff --git a/Makefile.am b/Makefile.am
index c5af88f..6cae417 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -67,7 +67,7 @@ release:
 
 clean:
        ./build clean cbutils
-       ./build clean flashrom
+       ./build clean i945-thinkpads-install-utilities
        ./build clean ich9utils
        ./build clean payloads
        ./build clean seabios
@@ -108,6 +108,8 @@ check:
        set -o pipefail ; ./tests/targets  2>&1 | tee -a $(LOG)
        @echo "[ OK ] Makefile: $@ target. See $(LOG) for the log."
 
+include resources/packages/i945-thinkpads-install-utilities/Makefile.am
+
 help:
        @printf "Available commands:\n"
        @printf "\tsudo make install-dependencies-ubuntu    # %s\n" \
diff --git a/build b/build
index a952f07..e4a5451 100755
--- a/build
+++ b/build
@@ -29,7 +29,7 @@ projectname="$(cat projectname)"
 
 . resources/scripts/misc/sysexits.sh
 
-# Some scripts like the ones in resources/packages/flashrom need
+# Some scripts like the ones in 
resources/packages/i945-thinkpads-install-utilities need
 # Makefiles to be generated
 . resources/scripts/misc/generate-configure-makefiles.sh
 
@@ -83,7 +83,7 @@ help() {
        $(list_tasks)
 
        Example:        ./build module all
-       Example:        ./build module flashrom [static]
+       Example:        ./build module i945-thinkpads-install-utilities
        Example:        ./build roms withgrub
        Example:        ./build clean all
 
diff --git a/configure.ac b/configure.ac
index a2f61f0..2d08102 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,5 +15,34 @@
 
 AC_INIT([gnuboot],[0.1],[gnuboot@gnu.org])
 AM_INIT_AUTOMAKE([foreign])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([
+    Makefile
+    resources/packages/i945-thinkpads-install-utilities/Makefile
+])
+
+AC_SUBST([GUIX_BUILD_CORES], [])
+
+# --with-guix-build-cores
+AC_ARG_WITH([guix-build-cores],
+    [AS_HELP_STRING([--with-guix-build-cores=N],
+                  [Force guix build the use of up to N CPU cores for the build.
+                   Lowering the number of cores used can help when there is not
+                   enough RAM per core.])],
+    [GUIX_BUILD_CORES=$withval],
+    [GUIX_BUILD_CORES=0])
+
+AC_CHECK_PROG([FOUND_GUIX], [guix], [guix])
+AS_IF([test x"$FOUND_GUIX" = x""],
+      [AC_MSG_ERROR(
+      [guix was not found in PATH ($PATH)])])
+
+AC_CHECK_PROG([FOUND_GUIX], [guix], [guix])
+AS_IF([test x"$FOUND_GUIX" = x""],
+      [AC_MSG_ERROR(
+      [guix was not found in PATH ($PATH)])])
+
 AC_OUTPUT
+
+AS_ECHO(["Configuration options:"])
+
+AS_ECHO(["    GUIX_BUILD_CORES: $GUIX_BUILD_CORES"])
diff --git a/download b/download
index b271f43..f5d086b 100755
--- a/download
+++ b/download
@@ -31,7 +31,7 @@ set -u -e
 
 . resources/scripts/misc/sysexits.sh
 
-# Some scripts like the ones in resources/packages/flashrom need
+# Some scripts like the ones in 
resources/packages/i945-thinkpads-install-utilities need
 # Makefiles to be generated
 . resources/scripts/misc/generate-configure-makefiles.sh
 
@@ -66,7 +66,7 @@ help() {
        possible values for 'package':
        $(list_packages)
 
-       Example:        ./download flashrom
+       Example:        ./download i945-thinkpads-install-utilities
        Example:        ./download coreboot
 
        Some package options allow for additional parameters:
diff --git 
a/resources/guix/gnuboot/packages/i945-thinkpads-install-utilities.scm 
b/resources/guix/gnuboot/packages/i945-thinkpads-install-utilities.scm
new file mode 100644
index 0000000..048ba8f
--- /dev/null
+++ b/resources/guix/gnuboot/packages/i945-thinkpads-install-utilities.scm
@@ -0,0 +1,166 @@
+;; This file is part of GNU Boot.
+;;
+;; This file 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 file 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 GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnuboot packages i945-thinkpads-install-utilities)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages admin)
+  #:use-module (gnu packages libftdi)
+  #:use-module (gnu packages libusb)
+  #:use-module (gnu packages pciutils)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module ((guix licenses)
+                #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix utils))
+
+(define-public coreboot-version "4.22")
+
+(define-public coreboot-source
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+          (url "https://github.com/coreboot/coreboot";)
+          (commit coreboot-version)))
+    (file-name (git-file-name "coreboot" coreboot-version))
+    (sha256
+     (base32
+      "125qw98f8zfhq0d5rpawxsjghqxwmg6yha1r1dqmwbxd7i12bj8f"))))
+
+(define-public bucts
+  (package
+    (name "bucts")
+    (version coreboot-version)
+    (source coreboot-source)
+    (inputs (list pciutils))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:tests? #f ;no tests
+      #:make-flags #~(list (string-append "CC="
+                                          #$(cc-for-target))
+                           (string-append "DESTDIR="
+                                          #$output) "INSTALL=install"
+                           "PREFIX=/")
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'configure) ;no configure script
+                   (add-after 'unpack 'enter-source
+                     (lambda _
+                       (chdir "util/bucts")))
+                   (add-after 'enter-source 'fixup-version
+                     (lambda _
+                       (substitute* "Makefile"
+                         (("^VERSION:=*")
+                          #$(string-append "VERSION:=" version)))))
+                   ;; no install target
+                   (replace 'install
+                     (lambda _
+                       (let ((bin (string-append #$output "/bin"))
+                             (doc (string-append #$output "/share/doc/bucts/"))
+                             (licenses (string-append #$output
+                                        "/share/licenses/bucts/")))
+                         (install-file "bucts" bin)
+                         (install-file "readme.md" doc)
+                         (install-file "../../COPYING" licenses)))))))
+    (home-page "https://coreboot.org";)
+    (synopsis "Tool to manipulate swap boot firmware bootblocks on the Intel
+ I945 chipsets")
+    (description
+     "This package provides @command{bucts}.  That command can flip a
+ bit in the BUC.TS register of the Intel I945 chipsets and show the
+register status.  When the bit is set, it swaps the bootblock
+location.  Because the bootblock region is often set read-only by the
+default BIOS, this enables to bypass that restriction and is used as
+part of a procedure to replace the nonfree BIOS with free software on
+various computers (Lenovo X60, X60s, X60T, T60, probably more).")
+    (license license:gpl2)))
+
+(define-public flashrom-bucts
+  (package
+    (name "flashrom-bucts")
+    (version "1.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://download.flashrom.org/releases/flashrom-v";
+                    version ".tar.bz2"))
+              (sha256
+               (base32
+                "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71"))
+              (patches (search-patches "flashrom-1.2.patch"))))
+    (build-system gnu-build-system)
+    (inputs (list dmidecode pciutils))
+    (native-inputs (list pkg-config))
+    (arguments
+     (list
+      #:make-flags
+      #~(list "CC=gcc"
+              (string-append "PREFIX=" #$output)
+              (string-append "VERSION=" #$version " with patch for bucts")
+              "CONFIG_NOTHING=yes"
+              "CONFIG_INTERNAL=yes"
+              "CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_INTERNAL")
+      #:tests? #f                      ; no 'check' target
+      #:phases
+      #~(modify-phases
+         %standard-phases
+         (delete 'configure)            ; no configure script
+         (add-before
+          'build 'patch-exec-paths
+          (lambda*
+           (#:key inputs #:allow-other-keys)
+           (substitute*
+            "dmi.c"
+            (("\"dmidecode\"")
+             (format #f "~S"
+                     (search-input-file inputs "/sbin/dmidecode"))))))
+         (add-before
+          'build 'patch-type-error
+          (lambda _
+            ;; See https://github.com/flashrom/flashrom/pull/133
+            (substitute*
+             "libflashrom.c"
+             (("supported_boards\\[i\\].working = binfo\\[i\\].working")
+              "supported_boards[i].working = (enum 
flashrom_test_state)binfo[i].working")
+             (("supported_chipsets\\[i\\].status = chipset\\[i\\].status")
+              "supported_chipsets[i].status = (enum 
flashrom_test_state)chipset[i].status"))))
+         (add-after
+          'patch-type-error 'rename-flashrom
+          (lambda _
+            (substitute*
+             "Makefile"
+             (("PROGRAM = flashrom")
+              "PROGRAM = flashrom-bucts")
+             (("\\$\\(PROGRAM\\)\\.8\\.tmpl")
+              "flashrom.8.tmpl")))))))
+    (home-page "https://flashrom.org/";)
+    (synopsis "Identify, read, write, erase, and verify ROM/flash chips on I945
+Thinkpads with the stock BIOS and the bucts utility.")
+    (description
+     "It is possible to install GNU Boot on I945 Thinkpads without opening
+the computer even if the nonfree bios sets the bootblock region (the
+last 64K of the flash chip) read-only.  To bypass that read-only
+restriction we use an utility (bucts) that tells the hardware to swap
+the primary bootblock with the secondary one for the next boot.
+After that we need a patched version of flashrom (provided by this
+package) to rewrite all the flash chip but the last 64K. Then after
+rebooting we have to disable that swap and reflash again.")
+    (license license:gpl2)))
+
+(list bucts
+      flashrom-bucts)
diff --git a/resources/guix/gnuboot/patches/flashrom-1.2.patch 
b/resources/guix/gnuboot/patches/flashrom-1.2.patch
new file mode 100644
index 0000000..e4fae0d
--- /dev/null
+++ b/resources/guix/gnuboot/patches/flashrom-1.2.patch
@@ -0,0 +1,64 @@
+Author: Stefanct
+Description: Add support for Macronix MX25L1605 and SST SST25VF016B with the 
Lenovo Thinkpad T60/X60/X60s/X60T BIOS.
+  Upstream is not against supporting this use case but even if the two
+  flash chip description would be added instead of modifying existing
+  ones, this patch break regular flashing and so it would likely
+  require to detect the use case at runtime and switch to a different
+  set of flash chip descriptions.
+Forwarded: not-needed
+Origin: 
https://www.coreboot.org/index.php?title=Board:lenovo/x60/Installation&diff=prev&oldid=11158
+---
+diff --git a/flashchips.c b/flashchips.c
+index 58dd4f30..d9af0096 100644
+--- a/flashchips.c
++++ b/flashchips.c
+@@ -8052,12 +8052,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  =
+               {
+@@ -8076,8 +8076,8 @@ const struct flashchip flashchips[] = {
+                       },
+               },
+               .printlock      = spi_prettyprint_status_register_bp3_srwd, /* 
bit6: Continuously Program (CP) mode, for 73E is quad enable */
+-              .unlock         = spi_disable_blockprotect_bp3_srwd,
+-              .write          = spi_chip_write_256,
++              .unlock         = spi_disable_blockprotect,
++              .write          = spi_chip_write_1,
+               .read           = spi_chip_read, /* Fast read (0x0B), dual I/O 
supported */
+               .voltage        = {2700, 3600},
+       },
+@@ -12719,12 +12719,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  =
+               {
+@@ -12747,7 +12747,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},
+       },
diff --git a/resources/packages/flashrom/clean 
b/resources/packages/flashrom/clean
deleted file mode 100755
index b6e45cd..0000000
--- a/resources/packages/flashrom/clean
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-
-#  helper script: clean the dependencies that were built in flashrom
-#
-#      Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
-#       Copyright (C) 2015 Klemens Nanni <contact@autoboot.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/>.
-#
-
-# This script assumes that the current working directory is the root
-# of git or release archive
-
-[ "x${DEBUG+set}" = 'xset' ] && set -v
-set -u -e
-
-printf "Cleaning the previous build of flashrom\n"
-
-[ ! -d "flashrom/" ] && exit 0
-
-# clean flashrom
-make -C flashrom clean
-
-printf "\n\n"
diff --git a/resources/packages/flashrom/download 
b/resources/packages/flashrom/download
deleted file mode 100755
index c297247..0000000
--- a/resources/packages/flashrom/download
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env bash
-
-#  helper script: downloads flashrom and patches it
-#
-#      Copyright (C) 2014, 2015, 2020, 2021 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/>.
-#
-
-[ "x${DEBUG+set}" = 'xset' ] && set -v
-set -u -e
-
-usage()
-{
-       progname="./download flashrom"
-       printf "Usage:\n"
-       printf "\t%s         # %s\n" \
-              "${progname}" \
-              "Download flashrom"
-       printf "\t%s --help  # %s\n" \
-              "${progname}" \
-              "Prints this help"
-}
-
-if [ $# -ne 0 ] ; then
-       usage
-       exit 0
-fi
-
-# Get flashrom at the last previously tested revision
-
-# Remove the old version that may still exist:
-# 
------------------------------------------------------------------------------
-
-printf "Downloading flashrom\n"
-
-rm -Rf "flashrom/"
-
-# Get flashrom
-# 
------------------------------------------------------------------------------
-
-# download it using git
-git clone https://review.coreboot.org/flashrom.git
-
-if [ ! -d "flashrom" ]; then
-    printf "flashrom not downloaded; check network connection?\n\n"
-    exit 1
-fi
-
-(
-cd "flashrom/"
-
-# reset to known revision
-git reset --hard 11680db4e1251eb842bee11e53b6d1f0ae67767b
-)
-
-printf "\n\n"
diff --git a/resources/packages/flashrom/module 
b/resources/packages/flashrom/module
deleted file mode 100755
index c1641d9..0000000
--- a/resources/packages/flashrom/module
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-
-#  helper script: builds flashrom source code
-#
-#      Copyright (C) 2014, 2015 <info@minifree.org>
-#      Copyright (C) 2015 Klemens Nanni <contact@autoboot.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/>.
-#
-
-# This script assumes that the working directory is the root
-# of git or release archive
-
-[ "x${DEBUG+set}" = 'xset' ] && set -v
-set -u -e
-
-# Build "flashrom" (utility for flashing/dumping ROMs)
-# --------------------------------------------------------------------
-
-if [ ! -d "flashrom/" ]; then
-    ./download flashrom
-fi
-
-printf "Building flashrom\n"
-(
-cd "flashrom/"
-make clean
-make WARNERROR=no -j$(nproc)
-)
diff --git a/resources/packages/i945-thinkpads-install-utilities/Makefile.am 
b/resources/packages/i945-thinkpads-install-utilities/Makefile.am
new file mode 100644
index 0000000..ba71430
--- /dev/null
+++ b/resources/packages/i945-thinkpads-install-utilities/Makefile.am
@@ -0,0 +1,95 @@
+# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.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 <https://www.gnu.org/licenses/>.
+
+# This Makefile makes it easier to cache the builds than with shell
+# scripts: The make program compares the timestamps of the source code
+# and the binaries and if the source is more recent, rebuilds the
+# binaries.
+
+TOPDIR = .
+
+DESTDIR ?= $(TOPDIR)/release
+
+PACK_NAME = i945-thinkpads-install-utilities
+
+GUIX_PACKAGE_NAMES ?= bucts flashrom-bucts
+RELEASE_DIR = $(DESTDIR)/i945-thinkpads-install
+
+# We enable caching by not making this configurable and so when the
+# Makefile isn't updated, the Guix revision doesn't change, so we
+# don't need to rebuild anything.
+GUIX_REVISION = v1.4.0
+
+GUIX_PACK_COMMAND = \
+       source resources/scripts/misc/guix.sh && \
+       source_guix_profile && \
+       guix time-machine \
+       --commit=$(GUIX_REVISION) -- \
+       pack \
+       -L $(TOPDIR)/resources/guix/ \
+       -L $(TOPDIR)/resources/guix/gnuboot/patches/ \
+       -RR \
+       --save-provenance \
+       --system=i686-linux \
+       --symlink=/usr/local/bin/bucts=bin/bucts \
+       --symlink=/usr/local/bin/flashrom-bucts=sbin/flashrom-bucts
+
+.PHONY: $(PACK_NAME) $(PACK_NAME)-clean $(PACK_NAME)-distclean 
$(PACK_NAME)-download $(PACK_NAME)-module
+
+$(PACK_NAME): \
+       $(RELEASE_DIR)/$(PACK_NAME)-deb-pack.deb \
+       $(RELEASE_DIR)/$(PACK_NAME)-tarball-pack.tar.gz \
+       $(RELEASE_DIR)/packages_src.tar \
+       $(RELEASE_DIR)/gnuboot_src.tar
+
+# To better fit in the current package structure
+$(PACK_NAME)-download: $(PACK_NAME)
+$(PACK_NAME)-module: $(PACK_NAME)
+
+# TODO: Make sure the tarball is reproducible
+$(RELEASE_DIR)/gnuboot_src.tar:  Makefile
+       install -d $(RELEASE_DIR)
+       git -C $(TOPDIR) archive HEAD > $@
+
+# TODO: Use Guix to produce a source package to make it reproducible
+$(RELEASE_DIR)/packages_src.tar:  Makefile
+       install -d $(RELEASE_DIR)
+       tar cf $@ \
+               `source resources/scripts/misc/guix.sh && \
+               source_guix_profile && \
+               guix time-machine --commit=$(GUIX_REVISION) -- \
+               build \
+               -c $(GUIX_BUILD_CORES) \
+               -L $(TOPDIR)/resources/guix/ \
+               -L $(TOPDIR)/resources/guix/gnuboot/patches \
+               --sources=transitive \
+               $(GUIX_PACKAGE_NAMES) | sort -u`
+
+$(RELEASE_DIR)/$(PACK_NAME)-deb-pack.deb: Makefile
+       install -d $(RELEASE_DIR)
+       install \
+       `$(GUIX_PACK_COMMAND) --format="deb" $(GUIX_PACKAGE_NAMES)` \
+       $@
+
+$(RELEASE_DIR)/$(PACK_NAME)-tarball-pack.tar.gz: Makefile
+       install -d $(RELEASE_DIR)
+       install \
+       `$(GUIX_PACK_COMMAND) --format="tarball" $(GUIX_PACKAGE_NAMES)` \
+       $@
+
+$(PACK_NAME)-clean:
+       rm -rf $(RELEASE_DIR)
+
+$(PACK_NAME)-distclean: $(PACK_NAME)-clean
diff --git a/resources/packages/i945-thinkpads-install-utilities/clean 
b/resources/packages/i945-thinkpads-install-utilities/clean
new file mode 100755
index 0000000..5932220
--- /dev/null
+++ b/resources/packages/i945-thinkpads-install-utilities/clean
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.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 <https://www.gnu.org/licenses/>.
+set -x
+
+make i945-thinkpads-install-utilities-clean
diff --git a/resources/packages/flashrom/distclean 
b/resources/packages/i945-thinkpads-install-utilities/distclean
similarity index 76%
rename from resources/packages/flashrom/distclean
rename to resources/packages/i945-thinkpads-install-utilities/distclean
index a103b1d..5932220 100755
--- a/resources/packages/flashrom/distclean
+++ b/resources/packages/i945-thinkpads-install-utilities/distclean
@@ -14,14 +14,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
+set -x
 
-# shellcheck source=resources/scripts/tasks/distclean.sh
-. "$(dirname "$0")"/../../scripts/tasks/distclean.sh
-
-distclean_flashrom()
-{
-    rm -rf flashrom
-}
-
-# shellcheck disable=SC2068
-distclean_main distclean_flashrom $@
+make i945-thinkpads-install-utilities-clean
diff --git a/resources/packages/i945-thinkpads-install-utilities/download 
b/resources/packages/i945-thinkpads-install-utilities/download
new file mode 100755
index 0000000..f68a660
--- /dev/null
+++ b/resources/packages/i945-thinkpads-install-utilities/download
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.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 <https://www.gnu.org/licenses/>.
+set -x
+
+make i945-thinkpads-install-utilities-download
diff --git a/resources/packages/i945-thinkpads-install-utilities/module 
b/resources/packages/i945-thinkpads-install-utilities/module
new file mode 100755
index 0000000..14c85ca
--- /dev/null
+++ b/resources/packages/i945-thinkpads-install-utilities/module
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.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 <https://www.gnu.org/licenses/>.
+set -x
+
+make i945-thinkpads-install-utilities-module
diff --git a/resources/packages/src/release b/resources/packages/src/release
index 7a8168b..1906976 100755
--- a/resources/packages/src/release
+++ b/resources/packages/src/release
@@ -53,7 +53,7 @@ mkdir -p "${srcdir}/"
 
 printf "%s" "${version}" > "${srcdir}"/version
 
-modlist="coreboot flashrom grub memtest86plus seabios ich9utils"
+modlist="coreboot grub i945-thinkpads-install-utilities memtest86plus seabios 
ich9utils"
 dirlist="resources"
 filelist="download build README.md COPYING Makefile update version versiondate 
projectname .gitcheck"
 
diff --git a/resources/scripts/misc/generate-configure-makefiles.sh 
b/resources/scripts/misc/generate-configure-makefiles.sh
index aadc674..2d21234 100755
--- a/resources/scripts/misc/generate-configure-makefiles.sh
+++ b/resources/scripts/misc/generate-configure-makefiles.sh
@@ -17,7 +17,7 @@
 
 if [ ! -f configure ] || \
        [ ! -f Makefile ] || \
-       [ ! -f resources/packages/flashrom/Makefile ] ; then
+       [ ! -f resources/packages/i945-thinkpads-install-utilities/Makefile ] ; 
then
     ./autogen.sh
     ./configure
 fi
diff --git a/site/contrib.md b/site/contrib.md
index 82eb5c3..388955b 100644
--- a/site/contrib.md
+++ b/site/contrib.md
@@ -293,9 +293,7 @@ with Lenovo BIOS present, it's possible to flash everything 
except the main
 bootblock, but Intel platforms have 2 bootblocks, and you specify which one is
 to be used by setting the TS bit. You then boot with only one bootblock flashed
 (by the coreboot project's bootblock on that machine), and afterwards you reset
-bucts before flashing the ROM again, to flash the main bootblock. Libreboot
-hosts a copy of his work, because his website hosting bucts is no longer
-responsive.
+bucts before flashing the ROM again, to flash the main bootblock.
 
 Steve Shenton
 -------------
diff --git a/site/docs/build/index.md b/site/docs/build/index.md
index 66d59f8..83610f0 100644
--- a/site/docs/build/index.md
+++ b/site/docs/build/index.md
@@ -104,6 +104,56 @@ Change the name and email address to whatever you want, 
when doing this.
 You may also want to follow more of the steps here:
 <https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup>
 
+Guix
+====
+While GNU Boot doesn't build yet on top of Guix, it started using some
+Guix packages to build part of GNU Boot. While this provides many
+benefits, you will need to install Guix on top of a supported
+distribution to build GNU Boot binaries.
+
+There are many ways to install Guix, and they are well documented in
+the [Guix manual](https://guix.gnu.org/en/manual/) especially in the
+[Installation](https://guix.gnu.org/en/manual/en/html_node/Installation.html)
+chapter.
+
+It is also a good idea to "enable substitutes" not to have to build
+every packages and dependencies from source. If the installation
+instructions you followed don't mention that, you can still find
+documentation on it in the [Substitutes
+chapter](https://guix.gnu.org/en/manual/en/guix.html#Substitutes) in
+the Guix manual.
+
+Once Guix is installed, users are advised to update it with guix pull
+as explained in the [Invoking guix
+pull](https://guix.gnu.org/en/manual/en/html_node/Invoking-guix-pull.html)
+manual section to avoid any potential security issues.
+
+In some cases (especially if you don't enable substitutes, and that
+you have many CPU cores and not enough RAM per cores), building with
+Guix can fail.
+
+At the time of writing, Guix can use about 2GiB per core for
+updates. Building packages can also use some RAM but the types of
+packages that GNU Boot will build are unlikely to require that much
+RAM per core.
+
+If even with substitutes enabled the build still fails due to the lack
+of RAM, or if you don't want to enable substitutes, it is also
+possible to limit the amount of RAM used by limiting the number of
+cores used by Guix by passing --with-guix-build-cores=1 to the GNU
+boot ./configure script. This will pass the '-c 1' and '-M 1' options
+to guix build.
+
+Finally Guix keeps the files it downloads or builds (in /gnu/store) in
+order to speed up things, but if you use Guix extensively, at some
+point it might use too much storage space.
+
+Guix users are able to to decide when to free up space by running the
+'guix gc' command manually, but they can also control what to remove
+with various criteria. The [Invoking guix gc Guix manual
+section](https://guix.gnu.org/en/manual/devel/en/html_node/Invoking-guix-gc.html)
+has more details on how to do that.
+
 Building GNU Boot binaries
 ==========================
 
@@ -265,7 +315,7 @@ Example of downloading an individual module:
 
     ./download grub
 
-    ./download flashrom
+    ./download i945-thinkpads-install-utilities
 
 Third, build all of the modules:
 --------------------------------
@@ -291,7 +341,7 @@ Example of building specific modules:
 
     ./build module seabios
 
-    ./build module flashrom
+    ./build module i945-thinkpads-install-utilities
 
 Commands are available to *clean* a module, which basically runs make-clean.
 You can list these commands:
diff --git a/site/docs/install/x60flashscript.patch 
b/site/docs/install/x60flashscript.patch
deleted file mode 100644
index 7f4c830..0000000
--- a/site/docs/install/x60flashscript.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 34270811fce1ecf0bcf3b1363b0dc3dbf284ab09 Mon Sep 17 00:00:00 2001
-From: Leah Rowe <info@minifree.org>
-Date: Wed, 10 Jun 2015 22:53:28 +0000
-Subject: flash script: fix a really really really dumb mistake
-
----
-diff --git a/flash b/flash
-index c96b915..04fd274 100755
---- a/flash
-+++ b/flash
-@@ -95,12 +95,12 @@ if [ "$mode" = "i945lenovo_firstflash" ] || [ "$mode" = 
"i945lenovo_secondflash"
-               # git or libreboot_src
-               bucts="./bucts/bucts"
-               flashrom_lenovobios_sst="./flashrom/flashrom_lenovobios_sst"
--              
flashrom_lenovobios_macronix="./flashrom/flashrom_lenovobios_sst"
-+              
flashrom_lenovobios_macronix="./flashrom/flashrom_lenovobios_macronix"
-       else
-               # libreboot_util
-               bucts="./bucts/$arch/bucts"
-               
flashrom_lenovobios_sst="./flashrom/$arch/flashrom_lenovobios_sst"
--              
flashrom_lenovobios_macronix="./flashrom/$arch/flashrom_lenovobios_sst"
-+              
flashrom_lenovobios_macronix="./flashrom/$arch/flashrom_lenovobios_macronix"
-       fi
-       
-       # anti-bricking precaution
---
-cgit v0.9.0.2
diff --git a/site/tasks/index.md b/site/tasks/index.md
index 9082550..c7873f5 100644
--- a/site/tasks/index.md
+++ b/site/tasks/index.md
@@ -599,12 +599,6 @@ default is 500ms. setting it higher like 1000s might make 
USB drives work in
 SeaBIOS on KFSN4-DRE. see notes
 on <https://www.seabios.org/Runtime_config#Option_ROMs>
 
-SST+macronix patches for flashrom on X60/T60
-------------------------------------------------------
-
-These binaries are referenced in the documentation currently not actually
-available and the build system (lbmk) does not produce them.
-
 Warnings about option ROMs
 --------------------------
 
diff --git a/tests/lint b/tests/lint
index 04fa281..bbf85ef 100755
--- a/tests/lint
+++ b/tests/lint
@@ -48,7 +48,10 @@ run_shellcheck \
     update \
     resources/packages/coreboot/distclean \
     resources/packages/descriptors/distclean \
-    resources/packages/flashrom/distclean \
+    resources/packages/i945-thinkpads-install-utilities/clean \
+    resources/packages/i945-thinkpads-install-utilities/distclean \
+    resources/packages/i945-thinkpads-install-utilities/download \
+    resources/packages/i945-thinkpads-install-utilities/module \
     resources/packages/grub/distclean \
     resources/packages/ich9utils/distclean \
     resources/packages/memtest86plus/distclean \
--
2.41.0

reply via email to

[Prev in Thread] Current Thread [Next in Thread]