* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
@ 2023-05-28 9:41 Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader Efraim Flashner
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Efraim Flashner @ 2023-05-28 9:41 UTC (permalink / raw)
To: 63766; +Cc: Efraim Flashner
I've gotten an image built for the HiFive Unmatched board and it's
currently the image I'm running for that machine. The unformatted
partition and the specific UUID for the first two partitions in the
unmatched.scm are apparently necessary for the bring-up of the board,
and likely will be necessary for other riscv64 boards in the future.
Efraim Flashner (4):
gnu: bootloader: Add u-boot-sifive-unmatched-bootloader.
gnu: image: Add support for unformatted partitions.
system: images: Add unmatched module.
gnu: glibc-2.33: Fix building for riscv64-linux.
gnu/bootloader/u-boot.scm | 17 ++++
gnu/build/image.scm | 8 ++
gnu/local.mk | 2 +
gnu/packages/base.scm | 16 ++--
.../glibc-2.33-rawmemchr-miscompilation.patch | 57 +++++++++++
gnu/system/image.scm | 10 +-
gnu/system/images/unmatched.scm | 94 +++++++++++++++++++
7 files changed, 197 insertions(+), 7 deletions(-)
create mode 100644 gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch
create mode 100644 gnu/system/images/unmatched.scm
base-commit: b96b82bcd4bc24529941ff74a91432481f1a71b5
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader.
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
@ 2023-05-28 9:44 ` Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions Efraim Flashner
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Efraim Flashner @ 2023-05-28 9:44 UTC (permalink / raw)
To: 63766; +Cc: Efraim Flashner
* gnu/bootloader/u-boot.scm (install-sifive-unmatched-u-boot,
u-boot-sifive-unmatched-bootloader): New variables.
---
gnu/bootloader/u-boot.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 65d7923465..712db15b02 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -43,6 +44,7 @@ (define-module (gnu bootloader u-boot)
u-boot-puma-rk3399-bootloader
u-boot-rock64-rk3328-bootloader
u-boot-rockpro64-rk3399-bootloader
+ u-boot-sifive-unmatched-bootloader
u-boot-ts7970-q-2g-1000mhz-c-bootloader
u-boot-wandboard-bootloader))
@@ -135,6 +137,15 @@ (define install-u-boot-ts7970-q-2g-1000mhz-c-u-boot
(install-dir (string-append mount-point "/boot")))
(install-file u-boot.imx install-dir))))
+(define install-sifive-unmatched-u-boot
+ #~(lambda (bootloader root-index image)
+ (let ((spl (string-append bootloader "/libexec/spl/u-boot-spl.bin"))
+ (u-boot (string-append bootloader "/libexec/u-boot.itb")))
+ (write-file-on-device spl (stat:size (stat spl))
+ image (* 34 512))
+ (write-file-on-device u-boot (stat:size (stat u-boot))
+ image (* 2082 512)))))
+
\f
;;;
@@ -273,3 +284,9 @@ (define u-boot-ts7970-q-2g-1000mhz-c-bootloader
(package u-boot-ts7970-q-2g-1000mhz-c)
(installer install-u-boot-ts7970-q-2g-1000mhz-c-u-boot)
(disk-image-installer #f)))
+
+(define u-boot-sifive-unmatched-bootloader
+ (bootloader
+ (inherit u-boot-bootloader)
+ (package u-boot-sifive-unmatched)
+ (disk-image-installer install-sifive-unmatched-u-boot)))
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions.
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader Efraim Flashner
@ 2023-05-28 9:44 ` Efraim Flashner
2023-06-09 20:42 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-05-28 9:44 ` [bug#63766] [PATCH 3/4] system: images: Add unmatched module Efraim Flashner
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Efraim Flashner @ 2023-05-28 9:44 UTC (permalink / raw)
To: 63766; +Cc: Efraim Flashner
* gnu/build/image.scm (make-unformatted-image): New procedure.
(make-partition-image): Add support for unformatted partition.
* gnu/system/image.scm (system-disk-image)[partition->gpt-type]: Add
case for using unformatted partition uuid.
[partition-image]: Add coreutils to image-builder closure.
---
gnu/build/image.scm | 8 ++++++++
gnu/system/image.scm | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 65a0373980..d47cb31aa0 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -122,6 +123,11 @@ (define* (make-vfat-image partition target root fs-bits)
(string-append "::" file))))
(scandir root))))
+(define* (make-unformatted-image partition target)
+ "Make an unformatted partition of a certain size."
+ (let ((size (partition-size partition)))
+ (invoke "truncate" "--size" (number->string size) target)))
+
(define* (make-partition-image partition-sexp target root)
"Create and return the image of PARTITION-SEXP as TARGET. Use the given
ROOT directory to populate the image."
@@ -134,6 +140,8 @@ (define* (make-partition-image partition-sexp target root)
(make-vfat-image partition target root 16))
((string=? type "fat32")
(make-vfat-image partition target root 32))
+ ((string=? type "unformatted")
+ (make-unformatted-image partition target))
(else
(raise (condition
(&message
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..3fe813f096 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2022 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -390,6 +391,9 @@ (define* (system-disk-image image
((or (string=? file-system "vfat")
(string=? file-system "fat16")
(string=? file-system "fat32")) "F")
+ ((and (string=? file-system "unformatted")
+ (partition-uuid partition))
+ (uuid->string (partition-uuid partition)))
(else
(raise (condition
(&message
@@ -414,7 +418,11 @@ (define* (system-disk-image image
(with-imported-modules*
(let ((initializer (or #$(partition-initializer partition)
initialize-root-partition))
- (inputs '#+(list e2fsprogs fakeroot dosfstools mtools))
+ (inputs '#+(list e2fsprogs ; ext2/3/4
+ fakeroot
+ dosfstools ; vfat
+ mtools ; vfat
+ coreutils)) ; truncate
(image-root "tmp-root"))
(sql-schema #$schema)
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 3/4] system: images: Add unmatched module.
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions Efraim Flashner
@ 2023-05-28 9:44 ` Efraim Flashner
2023-06-09 20:46 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-05-28 9:44 ` [bug#63766] [PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux Efraim Flashner
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Efraim Flashner @ 2023-05-28 9:44 UTC (permalink / raw)
To: 63766; +Cc: Efraim Flashner
* gnu/system/images/unmatched.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
gnu/local.mk | 1 +
gnu/system/images/unmatched.scm | 94 +++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+)
create mode 100644 gnu/system/images/unmatched.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index 18e8235140..50d65a3dba 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -741,6 +741,7 @@ GNU_SYSTEM_MODULES = \
%D%/system/images/pine64.scm \
%D%/system/images/pinebook-pro.scm \
%D%/system/images/rock64.scm \
+ %D%/system/images/unmatched.scm \
%D%/system/images/wsl2.scm \
\
%D%/machine.scm \
diff --git a/gnu/system/images/unmatched.scm b/gnu/system/images/unmatched.scm
new file mode 100644
index 0000000000..06d8d876d1
--- /dev/null
+++ b/gnu/system/images/unmatched.scm
@@ -0,0 +1,94 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix 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.
+;;;
+;;; GNU Guix 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 (gnu system images unmatched)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu bootloader u-boot)
+ #:use-module (gnu image)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu services)
+ #:use-module (gnu services base)
+ #:use-module (gnu services networking)
+ #:use-module (gnu system)
+ #:use-module (gnu system file-systems)
+ #:use-module (gnu system image)
+ #:use-module (guix platforms riscv)
+ #:use-module (srfi srfi-26)
+ #:export (unmatched-barebones-os
+ unmatched-image-type
+ unmatched-barebones-raw-image))
+
+(define unmatched-barebones-os
+ (operating-system
+ (host-name "unmatched")
+ (timezone "Asia/Jerusalem")
+ (locale "en_US.utf8")
+ (bootloader (bootloader-configuration
+ (bootloader u-boot-sifive-unmatched-bootloader)
+ (targets '("/dev/vda"))))
+ (initrd-modules '())
+ (kernel linux-libre-riscv64-generic)
+ (file-systems (cons (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems))
+ (services
+ (append (list (service agetty-service-type
+ (agetty-configuration
+ (extra-options '("-L")) ; no carrier detect
+ (baud-rate "115200")
+ (term "vt100")
+ (tty "ttySIF0")))
+ (service dhcp-client-service-type))
+ %base-services))))
+
+(define unmatched-disk-image
+ (image-without-os
+ (format 'disk-image)
+ (partition-table-type 'gpt)
+ ;; https://source.denx.de/u-boot/u-boot/-/blob/master/doc/board/sifive/unmatched.rst
+ (partitions (list
+ (partition
+ (size (* 1 (expt 2 20)))
+ (label "spl")
+ (offset (* 34 512))
+ (file-system "unformatted")
+ (uuid (uuid "5b193300-fc78-40cd-8002-e86c45580b47"))) ; HiFive FSBL
+ (partition
+ (size (* 4 (expt 2 20)))
+ (label "uboot")
+ (offset (* 2082 512))
+ (file-system "unformatted")
+ (uuid (uuid "2e54b353-1271-4842-806f-e436d6af6985"))) ; HiFive BBL
+ root-partition))))
+
+(define unmatched-image-type
+ (image-type
+ (name 'unmatched-raw)
+ (constructor (cut image-with-os unmatched-disk-image <>))))
+
+(define unmatched-barebones-raw-image
+ (image
+ (inherit
+ (os+platform->image unmatched-barebones-os riscv64-linux
+ #:type unmatched-image-type))
+ (name 'unmatched-barebones-raw-image)))
+
+;; Return the default image.
+unmatched-barebones-raw-image
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux.
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
` (2 preceding siblings ...)
2023-05-28 9:44 ` [bug#63766] [PATCH 3/4] system: images: Add unmatched module Efraim Flashner
@ 2023-05-28 9:44 ` Efraim Flashner
2023-06-09 20:49 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-06-09 20:50 ` Ludovic Courtès
2023-06-14 11:59 ` bug#63766: " Efraim Flashner
5 siblings, 1 reply; 12+ messages in thread
From: Efraim Flashner @ 2023-05-28 9:44 UTC (permalink / raw)
To: 63766; +Cc: Efraim Flashner
* gnu/packages/base.scm (glibc-2.33)[source]: Add patch.
* gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Register it.
---
gnu/local.mk | 1 +
gnu/packages/base.scm | 16 ++++--
.../glibc-2.33-rawmemchr-miscompilation.patch | 57 +++++++++++++++++++
3 files changed, 68 insertions(+), 6 deletions(-)
create mode 100644 gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 50d65a3dba..e8770a3f2a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1235,6 +1235,7 @@ dist_patch_DATA = \
%D%/packages/patches/glib-appinfo-watch.patch \
%D%/packages/patches/glib-networking-gnutls-binding.patch \
%D%/packages/patches/glib-skip-failing-test.patch \
+ %D%/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch \
%D%/packages/patches/glibc-CVE-2019-7309.patch \
%D%/packages/patches/glibc-CVE-2019-9169.patch \
%D%/packages/patches/glibc-CVE-2019-19126.patch \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index d2f276c447..dbf1b0edcb 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1066,12 +1066,13 @@ (define-public glibc-2.33
(base32
"1zvp0qdfbdyqrzydz18d9zg3n5ygy8ps7cmny1bvsp8h1q05c99f"))
(patches
- ;; Remove a patch that's become irrelevant and that does not
- ;; apply to this version.
- (remove (lambda (patch)
- (string=? (basename patch)
- "glibc-hurd-clock_gettime_monotonic.patch"))
- (origin-patches (package-source glibc))))))
+ (cons* (search-patch "glibc-2.33-rawmemchr-miscompilation.patch")
+ ;; Remove a patch that's become irrelevant and that does not
+ ;; apply to this version.
+ (remove (lambda (patch)
+ (string=? (basename patch)
+ "glibc-hurd-clock_gettime_monotonic.patch"))
+ (origin-patches (package-source glibc)))))))
(arguments
(substitute-keyword-arguments (package-arguments glibc)
((#:configure-flags flags ''())
@@ -1379,6 +1380,9 @@ (define-public glibc-utf8-locales
(make-glibc-utf8-locales glibc)))
;; Packages provided to ease use of binaries linked against the previous libc.
+(define-public glibc-locales-2.33
+ (package (inherit (make-glibc-locales glibc-2.33))
+ (name "glibc-locales-2.33")))
(define-public glibc-locales-2.32
(package (inherit (make-glibc-locales glibc-2.32))
(name "glibc-locales-2.32")))
diff --git a/gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch b/gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch
new file mode 100644
index 0000000000..bcf297be94
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch
@@ -0,0 +1,57 @@
+This patch is from upstream glibc after 2.33 and is needed in Guix to
+fix glibc-2.33 compilation for riscv64-linux.
+
+From 044e603b698093cf48f6e6229e0b66acf05227e4 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Fri, 19 Feb 2021 13:29:00 +0100
+Subject: [PATCH] string: Work around GCC PR 98512 in rawmemchr
+
+---
+ string/rawmemchr.c | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/string/rawmemchr.c b/string/rawmemchr.c
+index 59bbeeaa42..b8523118e5 100644
+--- a/string/rawmemchr.c
++++ b/string/rawmemchr.c
+@@ -22,24 +22,28 @@
+ # define RAWMEMCHR __rawmemchr
+ #endif
+
++/* The pragmata should be nested inside RAWMEMCHR below, but that
++ triggers GCC PR 98512. */
++DIAG_PUSH_NEEDS_COMMENT;
++#if __GNUC_PREREQ (7, 0)
++/* GCC 8 warns about the size passed to memchr being larger than
++ PTRDIFF_MAX; the use of SIZE_MAX is deliberate here. */
++DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow=");
++#endif
++#if __GNUC_PREREQ (11, 0)
++/* Likewise GCC 11, with a different warning option. */
++DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
++#endif
++
+ /* Find the first occurrence of C in S. */
+ void *
+ RAWMEMCHR (const void *s, int c)
+ {
+- DIAG_PUSH_NEEDS_COMMENT;
+-#if __GNUC_PREREQ (7, 0)
+- /* GCC 8 warns about the size passed to memchr being larger than
+- PTRDIFF_MAX; the use of SIZE_MAX is deliberate here. */
+- DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow=");
+-#endif
+-#if __GNUC_PREREQ (11, 0)
+- /* Likewise GCC 11, with a different warning option. */
+- DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
+-#endif
+ if (c != '\0')
+ return memchr (s, c, (size_t)-1);
+- DIAG_POP_NEEDS_COMMENT;
+ return (char *)s + strlen (s);
+ }
+ libc_hidden_def (__rawmemchr)
+ weak_alias (__rawmemchr, rawmemchr)
++
++DIAG_POP_NEEDS_COMMENT;
+--
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
2023-05-28 9:44 ` [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions Efraim Flashner
@ 2023-06-09 20:42 ` Ludovic Courtès
2023-06-13 9:53 ` Efraim Flashner
0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2023-06-09 20:42 UTC (permalink / raw)
To: Efraim Flashner
Cc: Tobias Geerinckx-Rice, Simon Tournier, paren, Christopher Baines,
63766, Ricardo Wurmus, Raghav Gururajan, jgart, Mathieu Othacehe
Efraim Flashner <efraim@flashner.co.il> skribis:
> * gnu/build/image.scm (make-unformatted-image): New procedure.
> (make-partition-image): Add support for unformatted partition.
> * gnu/system/image.scm (system-disk-image)[partition->gpt-type]: Add
> case for using unformatted partition uuid.
> [partition-image]: Add coreutils to image-builder closure.
[...]
> +(define* (make-unformatted-image partition target)
> + "Make an unformatted partition of a certain size."
> + (let ((size (partition-size partition)))
> + (invoke "truncate" "--size" (number->string size) target)))
Simply: (truncate-file target size).
> - (inputs '#+(list e2fsprogs fakeroot dosfstools mtools))
> + (inputs '#+(list e2fsprogs ; ext2/3/4
> + fakeroot
> + dosfstools ; vfat
> + mtools ; vfat
> + coreutils)) ; truncate
And this can be dropped.
Ludo’.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
2023-05-28 9:44 ` [bug#63766] [PATCH 3/4] system: images: Add unmatched module Efraim Flashner
@ 2023-06-09 20:46 ` Ludovic Courtès
0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2023-06-09 20:46 UTC (permalink / raw)
To: Efraim Flashner
Cc: Tobias Geerinckx-Rice, Simon Tournier, paren, Christopher Baines,
63766, Ricardo Wurmus, Raghav Gururajan, jgart, Mathieu Othacehe
Efraim Flashner <efraim@flashner.co.il> skribis:
> * gnu/system/images/unmatched.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
[...]
> +(define unmatched-disk-image
> + (image-without-os
> + (format 'disk-image)
> + (partition-table-type 'gpt)
> + ;; https://source.denx.de/u-boot/u-boot/-/blob/master/doc/board/sifive/unmatched.rst
> + (partitions (list
> + (partition
> + (size (* 1 (expt 2 20)))
> + (label "spl")
> + (offset (* 34 512))
> + (file-system "unformatted")
> + (uuid (uuid "5b193300-fc78-40cd-8002-e86c45580b47"))) ; HiFive FSBL
> + (partition
> + (size (* 4 (expt 2 20)))
> + (label "uboot")
> + (offset (* 2082 512))
> + (file-system "unformatted")
> + (uuid (uuid "2e54b353-1271-4842-806f-e436d6af6985"))) ; HiFive BBL
> + root-partition))))
Could you add a comment explaining what these two “unformatted”
partitions are, and what FSBL and BBL mean? It looks odd to the
untrained eye. :-)
Ludo’.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
2023-05-28 9:44 ` [bug#63766] [PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux Efraim Flashner
@ 2023-06-09 20:49 ` Ludovic Courtès
0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2023-06-09 20:49 UTC (permalink / raw)
To: Efraim Flashner
Cc: Tobias Geerinckx-Rice, Simon Tournier, paren, Christopher Baines,
63766, Ricardo Wurmus, Raghav Gururajan, jgart, Mathieu Othacehe
Efraim Flashner <efraim@flashner.co.il> skribis:
> * gnu/packages/base.scm (glibc-2.33)[source]: Add patch.
> * gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch: New
> file.
> * gnu/local.mk (dist_patch_DATA): Register it.
[...]
> + (cons* (search-patch "glibc-2.33-rawmemchr-miscompilation.patch")
> + ;; Remove a patch that's become irrelevant and that does not
> + ;; apply to this version.
> + (remove (lambda (patch)
> + (string=? (basename patch)
> + "glibc-hurd-clock_gettime_monotonic.patch"))
> + (origin-patches (package-source glibc)))))))
The indentation is off. You can use ‘cons’ rather than ‘cons*’.
> +++ b/gnu/packages/patches/glibc-2.33-rawmemchr-miscompilation.patch
> @@ -0,0 +1,57 @@
> +This patch is from upstream glibc after 2.33 and is needed in Guix to
> +fix glibc-2.33 compilation for riscv64-linux.
Maybe rename it ‘glibc-2.33-riscv-compilation.patch’ to make the goal
clearer?
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
` (3 preceding siblings ...)
2023-05-28 9:44 ` [bug#63766] [PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux Efraim Flashner
@ 2023-06-09 20:50 ` Ludovic Courtès
2023-06-14 11:59 ` bug#63766: " Efraim Flashner
5 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2023-06-09 20:50 UTC (permalink / raw)
To: Efraim Flashner; +Cc: 63766
Efraim Flashner <efraim@flashner.co.il> skribis:
> I've gotten an image built for the HiFive Unmatched board and it's
> currently the image I'm running for that machine. The unformatted
> partition and the specific UUID for the first two partitions in the
> unmatched.scm are apparently necessary for the bring-up of the board,
> and likely will be necessary for other riscv64 boards in the future.
Nice patch series! It’s exciting to know that this thing runs on actual
HiFive boards. :-)
Ludo’.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
2023-06-09 20:42 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
@ 2023-06-13 9:53 ` Efraim Flashner
2023-06-21 22:08 ` Ludovic Courtès
0 siblings, 1 reply; 12+ messages in thread
From: Efraim Flashner @ 2023-06-13 9:53 UTC (permalink / raw)
To: Ludovic Courtès
Cc: Tobias Geerinckx-Rice, Simon Tournier, paren, Christopher Baines,
63766, Ricardo Wurmus, Raghav Gururajan, jgart, Mathieu Othacehe
[-- Attachment #1: Type: text/plain, Size: 2305 bytes --]
On Fri, Jun 09, 2023 at 10:42:37PM +0200, Ludovic Courtès wrote:
> Efraim Flashner <efraim@flashner.co.il> skribis:
>
> > * gnu/build/image.scm (make-unformatted-image): New procedure.
> > (make-partition-image): Add support for unformatted partition.
> > * gnu/system/image.scm (system-disk-image)[partition->gpt-type]: Add
> > case for using unformatted partition uuid.
> > [partition-image]: Add coreutils to image-builder closure.
>
> [...]
>
> > +(define* (make-unformatted-image partition target)
> > + "Make an unformatted partition of a certain size."
> > + (let ((size (partition-size partition)))
> > + (invoke "truncate" "--size" (number->string size) target)))
>
> Simply: (truncate-file target size).
Almost.
Backtrace:
1 (primitive-load "/gnu/store/v9kg0qwyws5s5m07klzkfqc9dmf…")
0 (truncate-file "/gnu/store/rcillf8ni077l9fi2cy2gdzzpqv…" …)
ERROR: In procedure truncate-file:
In procedure truncate-file: No such file or directory
I changed it to:
(let ((size (partition-size partition)))
;; Create the file and then truncate it to the desired size.
(with-output-to-file target
(lambda _ (display "")))
(truncate-file target size)))
And that got me the empty partition/block device as needed.
> > - (inputs '#+(list e2fsprogs fakeroot dosfstools mtools))
> > + (inputs '#+(list e2fsprogs ; ext2/3/4
> > + fakeroot
> > + dosfstools ; vfat
> > + mtools ; vfat
> > + coreutils)) ; truncate
>
> And this can be dropped.
Not for this review, but I'd like to make the inputs dependant on which
partition type is being made. There's no need to have dosfstools and
mtools when making an ext4 partition. And if we add a btrfs partition
option there's a large possibility that someone using that won't need
e2fsprogs at all while creating their image.
> Ludo’.
Thanks
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#63766: [PATCH 0/4] Image for HiFive Unmatched
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
` (4 preceding siblings ...)
2023-06-09 20:50 ` Ludovic Courtès
@ 2023-06-14 11:59 ` Efraim Flashner
5 siblings, 0 replies; 12+ messages in thread
From: Efraim Flashner @ 2023-06-14 11:59 UTC (permalink / raw)
To: 63766-done
[-- Attachment #1: Type: text/plain, Size: 230 bytes --]
Patches pushed!
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#63766] [PATCH 0/4] Image for HiFive Unmatched
2023-06-13 9:53 ` Efraim Flashner
@ 2023-06-21 22:08 ` Ludovic Courtès
0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2023-06-21 22:08 UTC (permalink / raw)
To: Efraim Flashner
Cc: Tobias Geerinckx-Rice, Simon Tournier, paren, Christopher Baines,
63766, Ricardo Wurmus, Raghav Gururajan, jgart, Mathieu Othacehe
Hi,
Efraim Flashner <efraim@flashner.co.il> skribis:
> I changed it to:
>
> (let ((size (partition-size partition)))
> ;; Create the file and then truncate it to the desired size.
> (with-output-to-file target
> (lambda _ (display "")))
> (truncate-file target size)))
>
> And that got me the empty partition/block device as needed.
A slight improvement would be:
(catch 'system-error
(lambda ()
(truncate-file target size))
(lambda args
(if (= ENOENT (system-error-errno args))
(call-with-output-file target (const #t))
(apply throw args))))
It’s more verbose but makes the intent clearer.
Ludo’.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-06-21 22:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-28 9:41 [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader Efraim Flashner
2023-05-28 9:44 ` [bug#63766] [PATCH 2/4] gnu: image: Add support for unformatted partitions Efraim Flashner
2023-06-09 20:42 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-06-13 9:53 ` Efraim Flashner
2023-06-21 22:08 ` Ludovic Courtès
2023-05-28 9:44 ` [bug#63766] [PATCH 3/4] system: images: Add unmatched module Efraim Flashner
2023-06-09 20:46 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-05-28 9:44 ` [bug#63766] [PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux Efraim Flashner
2023-06-09 20:49 ` [bug#63766] [PATCH 0/4] Image for HiFive Unmatched Ludovic Courtès
2023-06-09 20:50 ` Ludovic Courtès
2023-06-14 11:59 ` bug#63766: " Efraim Flashner
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.