* bug#41120: uvesafb service is unsupported on aarch64 @ 2020-05-07 5:40 Efraim Flashner 2020-05-07 7:06 ` Mathieu Othacehe ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Efraim Flashner @ 2020-05-07 5:40 UTC (permalink / raw) To: 41120 [-- Attachment #1: Type: text/plain, Size: 398 bytes --] the uvesafb-service which was added to the installation image isn't supported on aarch64 (or probably any non-x86 system) and causes the creation of an installation image to fail. -- 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] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 5:40 bug#41120: uvesafb service is unsupported on aarch64 Efraim Flashner @ 2020-05-07 7:06 ` Mathieu Othacehe 2020-05-07 8:05 ` Efraim Flashner 2020-05-07 8:12 ` Efraim Flashner 2021-12-29 2:30 ` Leo Famulari 2022-08-04 23:03 ` Pavel Shlyak 2 siblings, 2 replies; 16+ messages in thread From: Mathieu Othacehe @ 2020-05-07 7:06 UTC (permalink / raw) To: Efraim Flashner; +Cc: 41120 Hello Efraim, > the uvesafb-service which was added to the installation image isn't > supported on aarch64 (or probably any non-x86 system) and causes the > creation of an installation image to fail. Thanks for reporting. There's this small snippet in uvesafb-service: --8<---------------cut here---------------start------------->8--- (or (not (and (string-suffix? "linux-gnu" %host-type) (or (string-prefix? "x86_64" %host-type) (string-prefix? "i686" %host-type)))) --8<---------------cut here---------------end--------------->8--- which must then fail? Do you have a specific error message? Thanks, Mathieu ^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 7:06 ` Mathieu Othacehe @ 2020-05-07 8:05 ` Efraim Flashner 2020-05-07 8:12 ` Efraim Flashner 1 sibling, 0 replies; 16+ messages in thread From: Efraim Flashner @ 2020-05-07 8:05 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: 41120 [-- Attachment #1: Type: text/plain, Size: 1471 bytes --] On Thu, May 07, 2020 at 09:06:21AM +0200, Mathieu Othacehe wrote: > > Hello Efraim, > > > the uvesafb-service which was added to the installation image isn't > > supported on aarch64 (or probably any non-x86 system) and causes the > > creation of an installation image to fail. > > Thanks for reporting. There's this small snippet in uvesafb-service: > > --8<---------------cut here---------------start------------->8--- > (or (not (and (string-suffix? "linux-gnu" %host-type) > (or (string-prefix? "x86_64" %host-type) > (string-prefix? "i686" %host-type)))) > --8<---------------cut here---------------end--------------->8--- > > which must then fail? Do you have a specific error message? > It fails while building v86d. Looking at the or statement, it should probably close after (file-exists? "/dev/fb0") and then the whole thing wrapped in a when or an if. I checked and /dev/fb0 doesn't exist on my machine. Actually that didn't make a difference, it still tried to build v86d. Even changing the '(or (not' to '(if (and (and' it still tries to build v86d. My guess is that it's not evaluating the conditionals until it's time to run the service so it makes sure v86d is there. -- 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] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 7:06 ` Mathieu Othacehe 2020-05-07 8:05 ` Efraim Flashner @ 2020-05-07 8:12 ` Efraim Flashner 2020-05-07 14:55 ` pelzflorian (Florian Pelz) 1 sibling, 1 reply; 16+ messages in thread From: Efraim Flashner @ 2020-05-07 8:12 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: 41120 [-- Attachment #1: Type: text/plain, Size: 1682 bytes --] On Thu, May 07, 2020 at 09:06:21AM +0200, Mathieu Othacehe wrote: > > Hello Efraim, > > > the uvesafb-service which was added to the installation image isn't > > supported on aarch64 (or probably any non-x86 system) and causes the > > creation of an installation image to fail. > > Thanks for reporting. There's this small snippet in uvesafb-service: > > --8<---------------cut here---------------start------------->8--- > (or (not (and (string-suffix? "linux-gnu" %host-type) > (or (string-prefix? "x86_64" %host-type) > (string-prefix? "i686" %host-type)))) > --8<---------------cut here---------------end--------------->8--- > > which must then fail? Do you have a specific error message? > I haven't tested the produced image, but the following builds without trying to also build v86d (start (if (and (and (string-suffix? "linux-gnu" %host-type) (or (string-prefix? "x86_64" %host-type) (string-prefix? "i686" %host-type))) (file-exists? "/dev/fb0")) #~(lambda () ;; uvesafb is only supported on x86 and x86_64. (invoke #+(file-append kmod "/bin/modprobe") "uvesafb" (string-append "v86d=" #$v86d "/sbin/v86d") "mode_option=1024x768")) #~(lambda () #t))) -- 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] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 8:12 ` Efraim Flashner @ 2020-05-07 14:55 ` pelzflorian (Florian Pelz) 2020-05-07 14:58 ` pelzflorian (Florian Pelz) 0 siblings, 1 reply; 16+ messages in thread From: pelzflorian (Florian Pelz) @ 2020-05-07 14:55 UTC (permalink / raw) To: Efraim Flashner; +Cc: 41120 [-- Attachment #1: Type: text/plain, Size: 1479 bytes --] On Thu, May 07, 2020 at 11:12:34AM +0300, Efraim Flashner wrote: > I haven't tested the produced image, but the following builds without > trying to also build v86d > > (start > (if (and (and (string-suffix? "linux-gnu" %host-type) > (or (string-prefix? "x86_64" %host-type) > (string-prefix? "i686" %host-type))) > (file-exists? "/dev/fb0")) > #~(lambda () > ;; uvesafb is only supported on x86 and x86_64. > (invoke #+(file-append kmod "/bin/modprobe") > "uvesafb" > (string-append "v86d=" #$v86d "/sbin/v86d") > "mode_option=1024x768")) > #~(lambda () #t))) This way uvesafb is started unconditionally on x86_64, even when it is not needed, leading to video corruption on some boots in QEMU. I have more success with moving the file-exists check into the #~(lambda …) like the attached patch. But I’m not sure it really fixes ARM builds. I tested via qemu-system-x86_64 -m 1024 -smp 1 -enable-kvm -nic user,model=virtio-net-pci -boot menu=on,order=d -drive media=cdrom,file=/gnu/store/0cgbp4y7awk4spg49ajw077xyzk24fi0-iso9660-image and on hardware. With QEMU, uvesafb is needed if and only if nomodeset is passed as a kernel parameter. Now how to build an ARM image for QEMU? Sorry I left such a mess with uvesafb. Regards, Florian [-- Attachment #2: 0001-installer-Do-not-load-uvesafb-on-non-x86-install-ima.patch --] [-- Type: text/plain, Size: 2301 bytes --] From 13fd2b590e37095ed4213d7bb85422b48deab9c6 Mon Sep 17 00:00:00 2001 From: Florian Pelz <pelzflorian@pelzflorian.de> Date: Thu, 7 May 2020 13:26:19 +0200 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [PATCH] installer: Do not load uvesafb on non-x86 install images. Fixes <https://bugs.gnu.org/41120>. Suggested by Efraim Flashner <efraim@flashner.co.il>. * gnu/system/install.scm (uvesafb-shepherd-service): Do not build x86-only v86d helper unconditionally. --- gnu/system/install.scm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 6435c1bff4..ad8a84091c 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -299,16 +299,18 @@ the user's target storage device rather than on the RAM disk." (documentation "Load the uvesafb kernel module if needed.") (provision '(maybe-uvesafb)) (requirement '(file-systems)) - (start #~(lambda () - ;; uvesafb is only supported on x86 and x86_64. - (or (not (and (string-suffix? "linux-gnu" %host-type) - (or (string-prefix? "x86_64" %host-type) - (string-prefix? "i686" %host-type)))) - (file-exists? "/dev/fb0") - (invoke #+(file-append kmod "/bin/modprobe") - "uvesafb" - (string-append "v86d=" #$v86d "/sbin/v86d") - "mode_option=1024x768")))) + (start + (if (and (and (string-suffix? "linux-gnu" %host-type) + (or (string-prefix? "x86_64" %host-type) + (string-prefix? "i686" %host-type))) + (file-exists? "/dev/fb0")) + #~(lambda () + ;; uvesafb is only supported on x86 and x86_64. + (invoke #+(file-append kmod "/bin/modprobe") + "uvesafb" + (string-append "v86d=" #$v86d "/sbin/v86d") + "mode_option=1024x768")) + #~(lambda () #t))) (respawn? #f) (one-shot? #t)))) -- 2.26.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 14:55 ` pelzflorian (Florian Pelz) @ 2020-05-07 14:58 ` pelzflorian (Florian Pelz) 2020-05-08 9:09 ` Mathieu Othacehe 0 siblings, 1 reply; 16+ messages in thread From: pelzflorian (Florian Pelz) @ 2020-05-07 14:58 UTC (permalink / raw) To: Efraim Flashner; +Cc: 41120 [-- Attachment #1: Type: text/plain, Size: 231 bytes --] On Thu, May 07, 2020 at 04:55:13PM +0200, pelzflorian (Florian Pelz) wrote: > I have more success with moving the file-exists check into the > #~(lambda …) like the attached patch. Sorry I forgot to git add. This is the patch. [-- Attachment #2: 0001-installer-Do-not-load-uvesafb-on-non-x86-install-ima.patch --] [-- Type: text/plain, Size: 2319 bytes --] From f88b1b487d48c959a7ed00d6032ccfe05aa81f0e Mon Sep 17 00:00:00 2001 From: Florian Pelz <pelzflorian@pelzflorian.de> Date: Thu, 7 May 2020 13:26:19 +0200 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [PATCH] installer: Do not load uvesafb on non-x86 install images. Fixes <https://bugs.gnu.org/41120>. Suggested by Efraim Flashner <efraim@flashner.co.il>. * gnu/system/install.scm (uvesafb-shepherd-service): Do not build x86-only v86d helper unconditionally. --- gnu/system/install.scm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 6435c1bff4..952dee464f 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -299,16 +299,18 @@ the user's target storage device rather than on the RAM disk." (documentation "Load the uvesafb kernel module if needed.") (provision '(maybe-uvesafb)) (requirement '(file-systems)) - (start #~(lambda () - ;; uvesafb is only supported on x86 and x86_64. - (or (not (and (string-suffix? "linux-gnu" %host-type) - (or (string-prefix? "x86_64" %host-type) - (string-prefix? "i686" %host-type)))) - (file-exists? "/dev/fb0") - (invoke #+(file-append kmod "/bin/modprobe") - "uvesafb" - (string-append "v86d=" #$v86d "/sbin/v86d") - "mode_option=1024x768")))) + (start + (if (and (string-suffix? "linux-gnu" %host-type) + (or (string-prefix? "x86_64" %host-type) + (string-prefix? "i686" %host-type))) + #~(lambda () + ;; uvesafb is only supported on x86 and x86_64. + (or (file-exists? "/dev/fb0") + (invoke #+(file-append kmod "/bin/modprobe") + "uvesafb" + (string-append "v86d=" #$v86d "/sbin/v86d") + "mode_option=1024x768"))) + #~(lambda () #t))) (respawn? #f) (one-shot? #t)))) -- 2.26.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 14:58 ` pelzflorian (Florian Pelz) @ 2020-05-08 9:09 ` Mathieu Othacehe 2020-05-13 12:50 ` Mathieu Othacehe 0 siblings, 1 reply; 16+ messages in thread From: Mathieu Othacehe @ 2020-05-08 9:09 UTC (permalink / raw) To: pelzflorian (Florian Pelz); +Cc: 41120 Hello, Thanks for working on that Florian & Efraim. > + (if (and (string-suffix? "linux-gnu" %host-type) > + (or (string-prefix? "x86_64" %host-type) > + (string-prefix? "i686" %host-type))) > + #~(lambda () > + ;; uvesafb is only supported on x86 and x86_64. > + (or (file-exists? "/dev/fb0") > + (invoke #+(file-append kmod "/bin/modprobe") > + "uvesafb" > + (string-append "v86d=" #$v86d "/sbin/v86d") > + "mode_option=1024x768"))) > + #~(lambda () #t))) > (respawn? #f) > (one-shot? #t)))) The issue with using %host-type at build time is that it won't support system build with --system and --target. For instance if cross-compiling for aarch64-linux-gnu on a x86_64 system, %host-type will be "x86_64-..." and we will try to build v86d for aarch64. We could maybe do something like that: --8<---------------cut here---------------start------------->8--- (define (operating-system-hardware-specific-services) #~(let-system (system target) (cond ((target-arm? system target) '()) ((target-intel? system target) (list uvesafb-shepherd-service))))) (define (operating-system-kernel-specific-services) #~(let-system (system target) (cond ((target-linux? system target) linux-specific-services) ((target-hurd? system target) hurd-specific-services)))) --8<---------------cut here---------------end--------------->8--- This way, uvesafb-shepherd-service would be built and installed only when producing a system targeting an Intel CPU. We could also extend this mechanism to have kernel specific services. That would mean, we need to dig out Ludo patch introducing let-system[1], but I think it was almost ready. Adding janneke, Danny and Ludo to the discussion. WDYT? Thanks, Mathieu [1]: https://lists.gnu.org/archive/html/guix-patches/2017-11/msg00274.html ^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-08 9:09 ` Mathieu Othacehe @ 2020-05-13 12:50 ` Mathieu Othacehe 2020-05-14 8:16 ` Ludovic Courtès 2020-05-15 22:43 ` Ludovic Courtès 0 siblings, 2 replies; 16+ messages in thread From: Mathieu Othacehe @ 2020-05-13 12:50 UTC (permalink / raw) To: pelzflorian (Florian Pelz); +Cc: 41120 [-- Attachment #1: Type: text/plain, Size: 1141 bytes --] Hello, > We could maybe do something like that: > > (define (operating-system-hardware-specific-services) > #~(let-system (system target) > (cond > ((target-arm? system target) > '()) > ((target-intel? system target) > (list uvesafb-shepherd-service))))) > > (define (operating-system-kernel-specific-services) > #~(let-system (system target) > (cond > ((target-linux? system target) > linux-specific-services) > ((target-hurd? system target) > hurd-specific-services)))) > > This way, uvesafb-shepherd-service would be built and installed only > when producing a system targeting an Intel CPU. We could also extend > this mechanism to have kernel specific services. > > That would mean, we need to dig out Ludo patch introducing > let-system[1], but I think it was almost ready. Here's a rebased version of Ludo's patch. I'm not sure about the merge resolution in "lower-object", but otherwise it works fine! Ludo, would it be of to push it? Thanks, Mathieu [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-gexp-Compilers-can-now-return-lowerable-objects.patch --] [-- Type: text/x-diff, Size: 5049 bytes --] From dde0a1ca499a4ef0592d10158a00add16386bebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org> Date: Wed, 13 May 2020 14:34:17 +0200 Subject: [PATCH 1/2] gexp: Compilers can now return lowerable objects. * guix/gexp.scm (lower-object): Iterate if LOWERED is a struct. (lower+expand-object): New procedure. (gexp->sexp): Use it. (define-gexp-compiler): Adjust docstring. --- guix/gexp.scm | 71 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/guix/gexp.scm b/guix/gexp.scm index 2a4b36519c..a9a4b89ab4 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -226,32 +226,59 @@ procedure to expand it; otherwise return #f." corresponding to OBJ for SYSTEM, cross-compiling for TARGET if TARGET is true. OBJ must be an object that has an associated gexp compiler, such as a <package>." - (match (lookup-compiler obj) - (#f - (raise (condition (&gexp-input-error (input obj))))) - (lower - ;; Cache in STORE the result of lowering OBJ. - (mlet %store-monad ((target (if (eq? target 'current) - (current-target-system) - (return target))) - (graft? (grafting?))) - (mcached (let ((lower (lookup-compiler obj))) - (lower obj system target)) - obj - system target graft?))))) + (let loop ((obj obj)) + (match (lookup-compiler obj) + (#f + (raise (condition (&gexp-input-error (input obj))))) + (lower + ;; Cache in STORE the result of lowering OBJ. + (mlet* %store-monad + ((target (if (eq? target 'current) + (current-target-system) + (return target))) + (graft? (grafting?)) + (lowered (mcached (let ((lower (lookup-compiler obj))) + (lower obj system target)) + obj + system target graft?))) + (if (and (struct? lowered) (not (eq? lowered obj))) + (loop lowered) + (return lowered))))))) + +(define* (lower+expand-object obj + #:optional (system (%current-system)) + #:key target (output "out")) + "Return as a value in %STORE-MONAD the output of object OBJ expands to for +SYSTEM and TARGET. Object such as <package>, <file-append>, or <plain-file> +expand to file names, but it's possible to expand to a plain data type." + (let loop ((obj obj) + (expand (and (struct? obj) (lookup-expander obj)))) + (match (lookup-compiler obj) + (#f + (raise (condition (&gexp-input-error (input obj))))) + (lower + (mlet %store-monad ((lowered (lower obj system target))) + ;; LOWER might return something that needs to be further lowered. + (if (struct? lowered) + ;; If we lack an expander, delegate to that of LOWERED. + (if (not expand) + (loop lowered (lookup-expander lowered)) + (return (expand obj lowered output))) + (return lowered))))))) ;lists, vectors, etc. (define-syntax define-gexp-compiler (syntax-rules (=> compiler expander) "Define NAME as a compiler for objects matching PREDICATE encountered in gexps. -In the simplest form of the macro, BODY must return a derivation for PARAM, an -object that matches PREDICATE, for SYSTEM and TARGET (the latter of which is -#f except when cross-compiling.) +In the simplest form of the macro, BODY must return (1) a derivation for +a record of the specified type, for SYSTEM and TARGET (the latter of which is +#f except when cross-compiling), (2) another record that can itself be +compiled down to a derivation, or (3) an object of a primitive data type. The more elaborate form allows you to specify an expander: - (define-gexp-compiler something something? + (define-gexp-compiler something-compiler <something> compiler => (lambda (param system target) ...) expander => (lambda (param drv output) ...)) @@ -1148,12 +1175,10 @@ and in the current monad setting (system type, etc.)" (or n? native?))) refs)) (($ <gexp-input> (? struct? thing) output n?) - (let ((target (if (or n? native?) #f target)) - (expand (lookup-expander thing))) - (mlet %store-monad ((obj (lower-object thing system - #:target target))) - ;; OBJ must be either a derivation or a store file name. - (return (expand thing obj output))))) + (let ((target (if (or n? native?) #f target))) + (lower+expand-object thing system + #:target target + #:output output))) (($ <gexp-input> (? self-quoting? x)) (return x)) (($ <gexp-input> x) -- 2.26.2 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #3: 0002-gexp-Add-let-system.patch --] [-- Type: text/x-diff, Size: 6932 bytes --] From 8fe7504a0935de7f0c8cba1236f3114d4e368093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org> Date: Wed, 13 May 2020 14:35:20 +0200 Subject: [PATCH 2/2] gexp: Add 'let-system'. * guix/gexp.scm (<system-binding>): New record type. (let-system): New macro. (system-binding-compiler): New procedure. (default-expander): Add catch-all case. * tests/gexp.scm ("let-system", "let-system, target") ("let-system, ungexp-native, target") ("let-system, nested"): New tests. * doc/guix.texi (G-Expressions): Document it. --- doc/guix.texi | 26 +++++++++++++++++++++++++ guix/gexp.scm | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- tests/gexp.scm | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index d6fbd85fde..0281a4be45 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7811,6 +7811,32 @@ are also added to the load path of the gexp returned by Return @code{#t} if @var{obj} is a G-expression. @end deffn +@deffn {Scheme Syntax} let-system @var{system} +@deffnx {Scheme Syntax} let-system (@var{system} @var{target}) +Bind @var{system} to the currently targeted system---e.g., +@code{"x86_64-linux"}---within @var{body}. + +In the second case, additionally bind @var{target} to the current +cross-compilation target---a GNU triplet such as +@code{"arm-linux-gnueabihf"}---or @code{#f} if we are not +cross-compiling. + +@code{let-system} is useful in the occasional case where the object +spliced into the gexp depends on the target system, as in this example: + +@example +#~(system* + #+(let-system system + (cond ((string-prefix? "armhf-" system) + (file-append qemu "/bin/qemu-system-arm")) + ((string-prefix? "x86_64-" system) + (file-append qemu "/bin/qemu-system-x86_64")) + (else + (error "dunno!")))) + "-net" "user" #$image) +@end example +@end deffn + G-expressions are meant to be written to disk, either as code building some derivation, or as plain files in the store. The monadic procedures below allow you to do that (@pxref{The Store Monad}, for more diff --git a/guix/gexp.scm b/guix/gexp.scm index a9a4b89ab4..a70b723e57 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -112,6 +112,7 @@ gexp-compiler? file-like? lower-object + let-system lower-inputs @@ -195,7 +196,9 @@ returns its output file name of OBJ's OUTPUT." ((? derivation? drv) (derivation->output-path drv output)) ((? string? file) - file))) + file) + (obj ;lists, vectors, etc. + obj))) (define (register-compiler! compiler) "Register COMPILER as a gexp compiler." @@ -324,6 +327,52 @@ The expander specifies how an object is converted to its sexp representation." (derivation-file-name lowered) lowered))) +\f +;;; +;;; System dependencies. +;;; + +;; Binding form for the current system and cross-compilation target. +(define-record-type <system-binding> + (system-binding proc) + system-binding? + (proc system-binding-proc)) + +(define-syntax let-system + (syntax-rules () + "Introduce a system binding in a gexp. The simplest form is: + + (let-system system + (cond ((string=? system \"x86_64-linux\") ...) + (else ...))) + +which binds SYSTEM to the currently targeted system. The second form is +similar, but it also shows the cross-compilation target: + + (let-system (system target) + ...) + +Here TARGET is bound to the cross-compilation triplet or #f." + ((_ (system target) exp0 exp ...) + (system-binding (lambda (system target) + exp0 exp ...))) + ((_ system exp0 exp ...) + (system-binding (lambda (system target) + exp0 exp ...))))) + +(define-gexp-compiler system-binding-compiler <system-binding> + compiler => (lambda (binding system target) + (match binding + (($ <system-binding> proc) + (with-monad %store-monad + ;; PROC is expected to return a lowerable object. + ;; 'lower-object' takes care of residualizing it to a + ;; derivation or similar. + (return (proc system target)))))) + + ;; Delegate to the expander of the object returned by PROC. + expander => #f) + \f ;;; ;;; File declarations. diff --git a/tests/gexp.scm b/tests/gexp.scm index 6a42d3eb57..c1d65b2c4e 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -322,6 +322,56 @@ (string-append (derivation->output-path drv) "/bin/touch")))))) +(test-equal "let-system" + (list `(begin ,(%current-system) #t) '(system-binding) '()) + (let ((exp #~(begin + #$(let-system system system) + #t))) + (list (gexp->sexp* exp) + (match (gexp-inputs exp) + (((($ (@@ (guix gexp) <system-binding>)) "out")) + '(system-binding)) + (x x)) + (gexp-native-inputs exp)))) + +(test-equal "let-system, target" + (list `(list ,(%current-system) #f) + `(list ,(%current-system) "aarch64-linux-gnu")) + (let ((exp #~(list #$@(let-system (system target) + (list system target))))) + (list (gexp->sexp* exp) + (gexp->sexp* exp "aarch64-linux-gnu")))) + +(test-equal "let-system, ungexp-native, target" + `(here it is: ,(%current-system) #f) + (let ((exp #~(here it is: #+@(let-system (system target) + (list system target))))) + (gexp->sexp* exp "aarch64-linux-gnu"))) + +(test-equal "let-system, nested" + (list `(system* ,(string-append "qemu-system-" (%current-system)) + "-m" "256") + '() + '(system-binding)) + (let ((exp #~(system* + #+(let-system (system target) + (file-append (@@ (gnu packages virtualization) + qemu) + "/bin/qemu-system-" + system)) + "-m" "256"))) + (list (match (gexp->sexp* exp) + (('system* command rest ...) + `(system* ,(and (string-prefix? (%store-prefix) command) + (basename command)) + ,@rest)) + (x x)) + (gexp-inputs exp) + (match (gexp-native-inputs exp) + (((($ (@@ (guix gexp) <system-binding>)) "out")) + '(system-binding)) + (x x))))) + (test-assert "ungexp + ungexp-native" (let* ((exp (gexp (list (ungexp-native %bootstrap-guile) (ungexp coreutils) -- 2.26.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-13 12:50 ` Mathieu Othacehe @ 2020-05-14 8:16 ` Ludovic Courtès 2020-05-15 22:43 ` Ludovic Courtès 1 sibling, 0 replies; 16+ messages in thread From: Ludovic Courtès @ 2020-05-14 8:16 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: 41120 Hi, Mathieu Othacehe <othacehe@gnu.org> skribis: > Here's a rebased version of Ludo's patch. I'm not sure about the merge > resolution in "lower-object", but otherwise it works fine! > > Ludo, would it be of to push it? I’d like to think a bit more about it. In particular, ‘let-system’ is not great because we’d also want to know the target in many cases. Sorry for the delay, I need to swap that in! Ludo’. ^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-13 12:50 ` Mathieu Othacehe 2020-05-14 8:16 ` Ludovic Courtès @ 2020-05-15 22:43 ` Ludovic Courtès 2020-05-18 12:16 ` [bug#29296] " Mathieu Othacehe 1 sibling, 1 reply; 16+ messages in thread From: Ludovic Courtès @ 2020-05-15 22:43 UTC (permalink / raw) To: Mathieu Othacehe; +Cc: 41120, 29296-done Hi Mathieu, Mathieu Othacehe <othacehe@gnu.org> skribis: > Here's a rebased version of Ludo's patch. I'm not sure about the merge > resolution in "lower-object", but otherwise it works fine! I took another look, and you’re right, it does the job. There were a couple of issues: returning a self-quoting value as in (let-system s s) wouldn’t work, and also caching wasn’t quite right (could be seen by comparing GUIX_PROFILING="add-data-to-store-cache object-cache" before and after). Anyway, it took me much more time than I thought, but it’s here now: 502f609d05 vm: Use 'let-system'. 300a54bb98 utils: 'target-arm32?' & co. take an optional parameter. 644cb40cd8 gexp: Add 'let-system'. d03001a31a gexp: Compilers can now return lowerable objects. Let me know how it goes! Ludo’. ^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#29296] bug#41120: uvesafb service is unsupported on aarch64 2020-05-15 22:43 ` Ludovic Courtès @ 2020-05-18 12:16 ` Mathieu Othacehe 0 siblings, 0 replies; 16+ messages in thread From: Mathieu Othacehe @ 2020-05-18 12:16 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 29296-done, 41120 Hey Ludo, > Anyway, it took me much more time than I thought, but it’s here now: > > 502f609d05 vm: Use 'let-system'. > 300a54bb98 utils: 'target-arm32?' & co. take an optional parameter. > 644cb40cd8 gexp: Add 'let-system'. > d03001a31a gexp: Compilers can now return lowerable objects. > > Let me know how it goes! Thanks a lot, it's a great addition. I plan to use it soon to have kernel/architecture specific services, as I proposed earlier in this thread. Mathieu ^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 5:40 bug#41120: uvesafb service is unsupported on aarch64 Efraim Flashner 2020-05-07 7:06 ` Mathieu Othacehe @ 2021-12-29 2:30 ` Leo Famulari 2021-12-29 8:20 ` Efraim Flashner 2022-08-04 23:03 ` Pavel Shlyak 2 siblings, 1 reply; 16+ messages in thread From: Leo Famulari @ 2021-12-29 2:30 UTC (permalink / raw) To: Efraim Flashner; +Cc: 41120 On Thu, May 07, 2020 at 08:40:15AM +0300, Efraim Flashner wrote: > the uvesafb-service which was added to the installation image isn't > supported on aarch64 (or probably any non-x86 system) and causes the > creation of an installation image to fail. This is still an issue, right? ^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2021-12-29 2:30 ` Leo Famulari @ 2021-12-29 8:20 ` Efraim Flashner 2021-12-29 22:03 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix 0 siblings, 1 reply; 16+ messages in thread From: Efraim Flashner @ 2021-12-29 8:20 UTC (permalink / raw) To: Leo Famulari; +Cc: 41120 [-- Attachment #1: Type: text/plain, Size: 853 bytes --] On Tue, Dec 28, 2021 at 09:30:27PM -0500, Leo Famulari wrote: > On Thu, May 07, 2020 at 08:40:15AM +0300, Efraim Flashner wrote: > > the uvesafb-service which was added to the installation image isn't > > supported on aarch64 (or probably any non-x86 system) and causes the > > creation of an installation image to fail. > > This is still an issue, right? I believe so. Borrowing from the manual I tried the following command and it showed that it was going to build v86d. guix system image --system=armhf-linux -e '((@ (gnu system install) os-with-u-boot) (@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")' -n -- 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] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2021-12-29 8:20 ` Efraim Flashner @ 2021-12-29 22:03 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix 0 siblings, 0 replies; 16+ messages in thread From: Tobias Geerinckx-Rice via Bug reports for GNU Guix @ 2021-12-29 22:03 UTC (permalink / raw) To: Efraim Flashner; +Cc: 41120, leo [-- Attachment #1.1: Type: text/plain, Size: 205 bytes --] I wrote the attached quick fix, then noticed that this bug is paired with #29296 which seems to propose a whole 'nother mechanism? I'm not sure I grok the latter's advantage yet. Kind regards, T G-R [-- Attachment #1.2: 0001-install-Add-uvesafb-service-only-on-x86.patch --] [-- Type: text/x-patch, Size: 3764 bytes --] From 29d6ce59a0f3953de627d110adaa7978051ca077 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice <me@tobias.gr> Date: Wed, 29 Dec 2021 23:01:11 +0100 Subject: [PATCH] install: Add uvesafb service only on x86. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/system/install.scm (%installation-services): Turn into… (installation-services): …this procedure. Adjust sole user. Add the uvesafb-service-type only when targetting x86. --- gnu/system/install.scm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 073d7df1db..36c24992bd 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> -;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr> +;;; Copyright © 2017, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; @@ -33,6 +33,7 @@ (define-module (gnu system install) #:use-module (guix modules) #:use-module ((guix packages) #:select (package-version)) #:use-module ((guix store) #:select (%store-prefix)) + #:use-module (guix utils) #:use-module (gnu installer) #:use-module (gnu system locale) #:use-module (gnu services avahi) @@ -303,7 +304,7 @@ (define uvesafb-service-type "Load the @code{uvesafb} kernel module with the right options.") (default-value #t))) -(define %installation-services +(define (installation-services) ;; List of services of the installation system. (let ((motd (plain-file "motd" " \x1b[1;37mWelcome to the installation of GNU Guix!\x1b[0m @@ -320,7 +321,9 @@ (define (normal-tty tty) (define bare-bones-os (load "examples/bare-bones.tmpl")) - (list (service virtual-terminal-service-type) + (append + (list + (service virtual-terminal-service-type) (service kmscon-service-type (kmscon-configuration @@ -426,13 +429,15 @@ (define bare-bones-os glibc-utf8-locales texinfo guile-3.0) - %default-locale-libcs)) + %default-locale-libcs))) - ;; Machines without Kernel Mode Setting (those with many old and - ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI - ;; installer. Some may also need a kernel parameter like nomodeset - ;; or vga=793, but we leave that for the user to specify in GRUB. - (service uvesafb-service-type)))) + (if (or (target-x86-32?) (target-x86-64?)) + ;; x86 machines without Kernel Mode Setting (those with many old and + ;; current AMD GPUs, SiS GPUs, ...) need uvesafb to show the GUI + ;; installer. Some may also need a kernel parameter like nomodeset + ;; or vga=793, but we leave that for the user to specify in GRUB. + (list (service uvesafb-service-type)) + '())))) (define %issue ;; Greeting. @@ -496,7 +501,7 @@ (define installation-os (comment "Guest of GNU")))) (issue %issue) - (services %installation-services) + (services (installation-services)) ;; We don't need setuid programs, except for 'passwd', which can be handy ;; if one is to allow remote SSH login to the machine being installed. -- 2.34.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --] ^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2020-05-07 5:40 bug#41120: uvesafb service is unsupported on aarch64 Efraim Flashner 2020-05-07 7:06 ` Mathieu Othacehe 2021-12-29 2:30 ` Leo Famulari @ 2022-08-04 23:03 ` Pavel Shlyak 2022-08-05 12:59 ` pelzflorian (Florian Pelz) 2 siblings, 1 reply; 16+ messages in thread From: Pavel Shlyak @ 2022-08-04 23:03 UTC (permalink / raw) To: 41120 This one is done with https://issues.guix.gnu.org/55806. I suggest closing it as resolved. ^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#41120: uvesafb service is unsupported on aarch64 2022-08-04 23:03 ` Pavel Shlyak @ 2022-08-05 12:59 ` pelzflorian (Florian Pelz) 0 siblings, 0 replies; 16+ messages in thread From: pelzflorian (Florian Pelz) @ 2022-08-05 12:59 UTC (permalink / raw) To: 41120-done; +Cc: Pavel Shlyak Pavel Shlyak <p.shlyak@pantherx.org> writes: > This one is done with https://issues.guix.gnu.org/55806. I suggest closing it as resolved. Indeed. With 55806, the uvesafb is added if (supported-package? v86d system), avoiding the need to check the system. I’m Closing by sending a mail to 41120-done@debbugs.gnu.org. Regards, Florian ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-08-05 13:00 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-05-07 5:40 bug#41120: uvesafb service is unsupported on aarch64 Efraim Flashner 2020-05-07 7:06 ` Mathieu Othacehe 2020-05-07 8:05 ` Efraim Flashner 2020-05-07 8:12 ` Efraim Flashner 2020-05-07 14:55 ` pelzflorian (Florian Pelz) 2020-05-07 14:58 ` pelzflorian (Florian Pelz) 2020-05-08 9:09 ` Mathieu Othacehe 2020-05-13 12:50 ` Mathieu Othacehe 2020-05-14 8:16 ` Ludovic Courtès 2020-05-15 22:43 ` Ludovic Courtès 2020-05-18 12:16 ` [bug#29296] " Mathieu Othacehe 2021-12-29 2:30 ` Leo Famulari 2021-12-29 8:20 ` Efraim Flashner 2021-12-29 22:03 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix 2022-08-04 23:03 ` Pavel Shlyak 2022-08-05 12:59 ` pelzflorian (Florian Pelz)
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.