diff mbox series

[bug#67403,2/8] gnu: Add bucts.

Message ID e8b2125d9d33943e30f377aae4092ca00968d8f8.1700752093.git.GNUtoo@cyberdimension.org
State New
Headers show
Series Coreboot related patches. | expand

Commit Message

Denis 'GNUtoo' Carikli Nov. 23, 2023, 3:27 p.m. UTC
* gnu/packages/flashing-tools.scm (bucts): New variable
(ifdtool): Use coreboot-source and coreboot-version.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Change-Id: I5964f138c3947298f047afb16dd30b54c396018b
---
 gnu/packages/flashing-tools.scm | 73 ++++++++++++++++++++++++++++-----
 1 file changed, 63 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/flashing-tools.scm b/gnu/packages/flashing-tools.scm
index be9a48898e..4fe78ce783 100644
--- a/gnu/packages/flashing-tools.scm
+++ b/gnu/packages/flashing-tools.scm
@@ -378,19 +378,72 @@  (define-public heimdall
 referred to as the \"Odin 3 protocol\".")
     (license license:expat)))
 
+(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 ifdtool
   (package
     (name "ifdtool")
-    (version "4.22")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/coreboot/coreboot")
-                    (commit version)))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "125qw98f8zfhq0d5rpawxsjghqxwmg6yha1r1dqmwbxd7i12bj8f"))))
+    (version coreboot-version)
+    (source coreboot-source)
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags