[PATCH 0/4] Image for HiFive Unmatched

  • Done
  • quality assurance status badge
Details
2 participants
  • Efraim Flashner
  • Ludovic Courtès
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 28 May 2023 11:41
(address . guix-patches@gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
cover.1685266344.git.efraim@flashner.co.il
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
E
E
Efraim Flashner wrote on 28 May 2023 11:44
[PATCH 1/4] gnu: bootloader: Add u-boot-sifive-unmatched-bootloader.
(address . 63766@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
5085b2db36a14af32131e5024a0952d9f3e700ed.1685266344.git.efraim@flashner.co.il
* 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(+)

Toggle diff (50 lines)
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)))))
+
;;;
@@ -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
E
E
Efraim Flashner wrote on 28 May 2023 11:44
[PATCH 2/4] gnu: image: Add support for unformatted partitions.
(address . 63766@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
b25689c92bc381c8019e239a540a7175f5efc2fe.1685266344.git.efraim@flashner.co.il
* 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(-)

Toggle diff (72 lines)
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
E
E
Efraim Flashner wrote on 28 May 2023 11:44
[PATCH 3/4] system: images: Add unmatched module.
(address . 63766@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
eb161ee699094146458089cbcf60a9ff331f031d.1685266344.git.efraim@flashner.co.il
* 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

Toggle diff (116 lines)
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
E
E
Efraim Flashner wrote on 28 May 2023 11:44
[PATCH 4/4] gnu: glibc-2.33: Fix building for riscv64-linux.
(address . 63766@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
a6f86073098eae5dcd6a4bac7bb6eb1c88adbb04.1685266344.git.efraim@flashner.co.il
* 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

Toggle diff (113 lines)
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
L
L
Ludovic Courtès wrote on 9 Jun 2023 22:42
Re: bug#63766: [PATCH 0/4] Image for HiFive Unmatched
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87jzwcv03m.fsf_-_@gnu.org
Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (6 lines)
> * 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.

[...]

Toggle quote (5 lines)
> +(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).

Toggle quote (7 lines)
> - (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’.
L
L
Ludovic Courtès wrote on 9 Jun 2023 22:46
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87fs70uzxa.fsf_-_@gnu.org
Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (3 lines)
> * gnu/system/images/unmatched.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.

[...]

Toggle quote (20 lines)
> +(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’.
L
L
Ludovic Courtès wrote on 9 Jun 2023 22:49
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87bkhouzs5.fsf_-_@gnu.org
Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (5 lines)
> * 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.

[...]

Toggle quote (8 lines)
> + (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*’.

Toggle quote (5 lines)
> +++ 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’.
L
L
Ludovic Courtès wrote on 9 Jun 2023 22:50
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 63766@debbugs.gnu.org)
877cscuzqr.fsf@gnu.org
Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (6 lines)
> 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’.
E
E
Efraim Flashner wrote on 13 Jun 2023 11:53
(name . Ludovic Courtès)(address . ludo@gnu.org)
ZIg8q3XKUriocOkv@3900XT
On Fri, Jun 09, 2023 at 10:42:37PM +0200, Ludovic Courtès wrote:
Toggle quote (17 lines)
> 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.

Toggle quote (9 lines)
> > - (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.

Toggle quote (2 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmSIPKgACgkQQarn3Mo9
g1EnPA//R4QAVCVFQrf99SBW4S/GH7MuN9mWPdsPxEbscqEy6621W9T+3i3yev//
WjJ4EZKfvvqyojSMJmIgdN3TpA0UzYzzr56eab/RbjC9zAw33JWiwvigySEug8xo
0uvAdq3D7TSLCYGsM7pH5Y4ECXlNNH6rl7Nb2u+5NJWEtrVsxDDzSlKYCNTA/D2M
6HOsdajedUrTgAjNRfKoeLkIw9bKpWAkJ4HjK43P1T662PbC+WmYzUVcJcsw8BN3
a063VM9Q7NI/GS2f0/F6EJrY5CVfCkpriAmCl7UuHyrB6xt7rL6ADJkmN4fPU28o
YX97U2l4wrVt3iZYdRp8/WACS+91Z08bJwRi2/f6/qQLFTgjS6lWdu++UszyKxSF
KX3DjwC7p19vdHLHquhq1v4CAa6eP1dIATgGCMeO37mrCJpvW/mLWPLkiq9GRv6A
LSnj73aa+F5VxHDNrSQSIrQwBMV2PT/MSRLYcipuKqbrG3nJ8K6LCrBqZE98/lff
oR9J1imJgQl2a4JPhvm7cVHUOrpA7/QFJ0rHoPGeWGrTZ3wINKJKagpwnREj+HO2
ub0Fambz0jYSDNwFPXRvTQd82zkbkscSS+81shXtP3U+5JaXrRmnE1gJzAdVq5Ac
1Qm625kuPcw0DrSITbfbb0Ms0wOBVAVYIWK3TFnWsGHbtCkjuU4=
=Vxnu
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 14 Jun 2023 13:59
Re: [PATCH 0/4] Image for HiFive Unmatched
(address . 63766-done@debbugs.gnu.org)
ZImrmDrSbg_TEIR8@3900XT
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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmSJq5gACgkQQarn3Mo9
g1GPdxAAtGgpLBToD5T6jCnfxTEb0kxwRtFqvayCgPyfW07VZr5gmiFmxGki0mqV
oPphG4XU/H+xixgzqabpWbNpOXpZXsT9w2EzW4nlLPHvVTGps5/afSW28ZxaBS/j
hKTgeJRMyUW4KOWhoazdiqWKh2kj/6U1gNeY1bRYjBhvWbmPU4VCz+254W2A03Q9
STprWpAXlZzIIR/Ld4se0mJLzWsEpXYOiA8P9cuUXAiSg1X5PjhjdwvAul7uj1ME
OfbQOH4GMisj4fDJjywLmRJiZjhvzbZBAPtpwX0bVAqBUtfxPBfpkB1SO3/pcvdl
kA5DBdTsBdyE9Q7cbuB5MpkI90SRKiykk4+xMwNO9Re+wJJarvtQLdj9a4pN+qMh
vSVb+2qzDbCl5XriyWq5U/0abGsPse0taZ0tccGMtCDBEJv0vMZK1c4631FOcCZo
QF04/n1OOAjijP64r1OlmbPgj8GuMKW2KCk8mA21diwMaaSfspeYmwYYrPcCBKg2
yWVHYRj3W9cM8vbwdqW6UokeGgz2vgHWIEOkh5iOfZ2cBBY9zFSsDMTkTJo8SouB
NSCLUxQABKlsLzEtmY1C4gtIUl3Yl5RwBjHcoY7SyKLcEO1DID0EtjaRLRxpnerk
QLsxc7vuNvR27iBj5rusiUyNOO4Yxbda+2agsW4rLR84bPG4LgE=
=L1MF
-----END PGP SIGNATURE-----


Closed
L
L
Ludovic Courtès wrote on 22 Jun 2023 00:08
Re: bug#63766: [PATCH 0/4] Image for HiFive Unmatched
(name . Efraim Flashner)(address . efraim@flashner.co.il)
878rcc5uzz.fsf@gnu.org
Hi,

Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (10 lines)
> 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’.
?