unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#30013] [PATCH] gnu: Add vboot-reference.
@ 2018-01-07 13:05 Marius Bakke
  2018-01-08  8:51 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Bakke @ 2018-01-07 13:05 UTC (permalink / raw)
  To: 30013

* gnu/packages/bootloaders.scm (vboot-reference): New public variable.
---
 gnu/packages/bootloaders.scm | 65 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 613537a5d..353e2dcf0 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -41,9 +41,12 @@
   #:use-module (gnu packages mtools)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages virtualization)
+  #:use-module (gnu packages web)
   #:use-module (guix build-system gnu)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -396,6 +399,68 @@ also initializes the boards (RAM etc).")
 (define-public u-boot-odroid-c2
   (make-u-boot-package "odroid-c2" "aarch64-linux-gnu"))
 
+(define-public vboot-utils
+  (package
+    (name "vboot-utils")
+    (version "R63-10032.B")
+    (source (origin
+              ;; XXX: Snapshots are available but changes timestamps every download.
+              (method git-fetch)
+              (uri (git-reference
+                    (url (string-append "https://chromium.googlesource.com"
+                                        "/chromiumos/platform/vboot_reference"))
+                    (commit (string-append "release-" version))))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list "CC=gcc"
+                          (string-append "DESTDIR=" (assoc-ref %outputs "out")))
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'patch-hard-coded-paths
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (substitute* "futility/misc.c"
+                        (("/bin/cp") (which "cp")))
+                      (substitute* "tests/bitmaps/TestBmpBlock.py"
+                        (("/usr/bin/cmp") (which "cmp")))
+                      (substitute* "vboot_host.pc.in"
+                        (("prefix=/usr")
+                         (string-append "prefix=" (assoc-ref outputs "out"))))
+                      #t))
+                  (delete 'configure)
+                  (add-before 'check 'patch-tests
+                    (lambda _
+                      ;; These tests compare diffs against known-good values.
+                      ;; Patch the paths to match those in the build container.
+                      (substitute* (find-files "tests/futility/expect_output")
+                        (("/mnt/host/source/src/platform/vboot_reference")
+                         (string-append "/tmp/guix-build-" ,name "-" ,version
+                                        ".drv-0/source")))
+                      ;; Tests require write permissions to many of these files.
+                      (for-each make-file-writable (find-files "tests/futility"))
+                      #t)))
+       #:test-target "runtests"))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ;; For tests.
+       ("python@2" ,python-2)))
+    (inputs
+     `(("libyaml" ,libyaml)
+       ("openssl" ,openssl)
+       ("openssl:static" ,openssl "static")
+       ("util-linux" ,util-linux)))
+    (home-page
+     "https://dev.chromium.org/chromium-os/chromiumos-design-docs/verified-boot")
+    (synopsis "ChromiumOS verified boot utilities")
+    (description
+     "vboot-utils is a collection of tools to facilitate booting of
+Chrome-branded devices.  This includes the @command{cgpt} partitioning
+program, the @command{futility} and @command{crossystem} firmware management
+tools, and more.")
+    (license license:bsd-3)))
+
 (define-public os-prober
   (package
     (name "os-prober")
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#30013] [PATCH] gnu: Add vboot-reference.
  2018-01-07 13:05 [bug#30013] [PATCH] gnu: Add vboot-reference Marius Bakke
@ 2018-01-08  8:51 ` Ludovic Courtès
  2018-01-08 19:14   ` bug#30013: " Marius Bakke
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2018-01-08  8:51 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 30013

Hi!

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/bootloaders.scm (vboot-reference): New public variable.

“vboot-utils”

> +       #:phases (modify-phases %standard-phases
> +                  (add-after 'unpack 'patch-hard-coded-paths
> +                    (lambda* (#:key outputs #:allow-other-keys)
> +                      (substitute* "futility/misc.c"
> +                        (("/bin/cp") (which "cp")))
> +                      (substitute* "tests/bitmaps/TestBmpBlock.py"
> +                        (("/usr/bin/cmp") (which "cmp")))

It would be better (though more verbose) to use:

  (string-append (assoc-ref inputs "coreutils") "/bin/cmp")

to allow for cross-compilation, though we’d also need to add coreutils
to ‘inputs’.  Not sure if it’s worth it, your call!

Otherwise LGTM.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#30013: [PATCH] gnu: Add vboot-reference.
  2018-01-08  8:51 ` Ludovic Courtès
@ 2018-01-08 19:14   ` Marius Bakke
  0 siblings, 0 replies; 3+ messages in thread
From: Marius Bakke @ 2018-01-08 19:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30013-done

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi!
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> * gnu/packages/bootloaders.scm (vboot-reference): New public variable.
>
> “vboot-utils”

Whoops, good catch.

>> +       #:phases (modify-phases %standard-phases
>> +                  (add-after 'unpack 'patch-hard-coded-paths
>> +                    (lambda* (#:key outputs #:allow-other-keys)
>> +                      (substitute* "futility/misc.c"
>> +                        (("/bin/cp") (which "cp")))
>> +                      (substitute* "tests/bitmaps/TestBmpBlock.py"
>> +                        (("/usr/bin/cmp") (which "cmp")))
>
> It would be better (though more verbose) to use:
>
>   (string-append (assoc-ref inputs "coreutils") "/bin/cmp")
>
> to allow for cross-compilation, though we’d also need to add coreutils
> to ‘inputs’.  Not sure if it’s worth it, your call!

Thanks for this tip.  I packaged this for use with an ARM Chromebook, so
facilitating cross-compilation is good.  Updated!

Thanks for reviewing!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-08 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-07 13:05 [bug#30013] [PATCH] gnu: Add vboot-reference Marius Bakke
2018-01-08  8:51 ` Ludovic Courtès
2018-01-08 19:14   ` bug#30013: " Marius Bakke

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).