unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* guix system vm-image --target=i586-pc-gnu Hurd'le
@ 2020-05-04 13:02 Jan Nieuwenhuizen
  2020-05-04 15:29 ` Mathieu Othacehe
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Nieuwenhuizen @ 2020-05-04 13:02 UTC (permalink / raw)
  To: guix-devel

Hi!

We have made some great progress on "guix system vm-image" for the Hurd.

The "wip-hurd-vm" branch has been reset, and there now is only this one
cross-build puzzle that we need to solve (until we hit the next problem ;-).

Running

    ./pre-inst-env guix system vm-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl --verbosity=1

to cross build a VM-image for the Hurd on current "wip-hurd-vm"

    9b25e0e4aa DRAFT services: hurd: Use activation-service, hurd-etc-service.

will attepmt to also build a native, non-cross-built Hurd (in my case
for x86_64), which fails.  It could be that I am something silly, or we
may not have noticed before because usually a native linux will already
be available, and else it will succeeed.

The diff below adds some debug printing, I get

--8<---------------cut here---------------start------------->8---
14:48:08 janneke@dundal:~/src/guix/wip-hurd-vm [env]
$ ./pre-inst-env guix system vm-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl --verbosity=1
;;; ("perform-action: getting packages")
;;; (" => " #<procedure 7fd69296e940 at guix/scripts/system.scm:803:42 (state)>)
;;; ("implicit mlet-lowering target=" "i586-pc-gnu")
;;; (" => " (#<package hurd@0.9-1.91a5167 gnu/packages/hurd.scm:376 7fd68b6406e0> #<package bash@5.0.16 ...))
;;; ("calling system-derivation-for-action")
;;; ("hurd-etc-services: target=" "i586-pc-gnu")
;;; ("hurd-etc-services: target=" "i586-pc-gnu")
;;; (" => sys-object" #<procedure 7fd69223d800 at guix/gexp.scm:961:2 (state)>)
;;; ("implicit mlet-lower" "i586-pc-gnu")
;;; ("hurd-etc-services: target=" #f)
;;; ("hurd-etc-services: target=" #f)
The following derivation will be built:
   /gnu/store/9s621nadr6xcj74n1dl4c7gkvn8x0179-hurd-0.9-1.91a5167.drv
process 2740 acquired build slot '/var/guix/offload/kluit.dezyne.org:22/0'
load on machine 'kluit.dezyne.org' is 0.0 (normalized: 0.0)
building /gnu/store/9s621nadr6xcj74n1dl4c7gkvn8x0179-hurd-0.9-1.91a5167.drv...
|offloading build of /gnu/store/9s621nadr6xcj74n1dl4c7gkvn8x0179-hurd-0.9-1.91a5167.drv to 'kluit.dezyne.org'
build of /gnu/store/9s621nadr6xcj74n1dl4c7gkvn8x0179-hurd-0.9-1.91a5167.drv failed
View build log at '/var/log/guix/drvs/9s/621nadr6xcj74n1dl4c7gkvn8x0179-hurd-0.9-1.91a5167.drv.bz2'.
guix system: error: build of `/gnu/store/9s621nadr6xcj74n1dl4c7gkvn8x0179-hurd-0.9-1.91a5167.drv' failed
[1]14:48:17 janneke@dundal:~/src/guix/wip-hurd-vm [env]
--8<---------------cut here---------------end--------------->8---

Any help/ideas greatly appreciated.

I can add something like

         (target (pk "target" (%current-target-system)))
         (hurd (operating-system-hurd os))
         (hurd (if target (with-parameters ((%current-target-system target)) hurd) hurd)))

but that does not help; as (%current-target-system) migh be #f.
Hardcoding TARGET to "i586-pc-gnu"..."works", but is not a solution:
we certainly cannot do that for generic services.

Greetings,
janneke


diff --git a/gnu/services/hurd.scm b/gnu/services/hurd.scm
index b3c71e69bd..9d2b94280b 100644
--- a/gnu/services/hurd.scm
+++ b/gnu/services/hurd.scm
@@ -22,6 +22,7 @@
   #:use-module (gnu system)
   #:use-module (guix gexp)
   #:use-module (guix records)
+  #:use-module (guix utils)
   #:export (hurd-etc-service))
 
 ;;; Commentary:
@@ -50,6 +51,7 @@ if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
   . \"$GUIX_PROFILE/etc/profile\"
 fi\n"))
         (hurd (operating-system-hurd os)))
+    (pk "hurd-etc-services: target=" (%current-target-system))
     (etc-service
      `(("services" ,(file-append net-base "/etc/services"))
        ("protocols" ,(file-append net-base "/etc/protocols"))
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 2664c66a30..26c5208d9d 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -799,13 +799,24 @@ static checks."
       (check-initrd-modules os)))
 
   (mlet* %store-monad
-      ((sys       (system-derivation-for-action os action
+      ((foo -> (pk "perform-action: getting packages"))
+       (packages -> (mlet %store-monad () (return (operating-system-packages os))))
+       (foo -> (pk " => " packages))
+       (foo -> (pk "implicit mlet-lowering target=" (%current-target-system)))
+       (packages packages)
+       (foo -> (pk " => " packages))
+       (foo -> (pk "calling system-derivation-for-action"))
+       (sys-object ->   (system-derivation-for-action os action
                                                 #:file-system-type file-system-type
                                                 #:image-size image-size
                                                 #:full-boot? full-boot?
                                                 #:container-shared-network? container-shared-network?
                                                 #:mappings mappings))
 
+       (foo -> (pk " => sys-object" sys-object))
+       (foo -> (pk "implicit mlet-lower" (%current-target-system)))
+       (sys sys-object)
+       (foo -> (pk " => sys" sys))
        ;; For 'init' and 'reconfigure', always build BOOTCFG, even if
        ;; --no-bootloader is passed, because we then use it as a GC root.
        ;; See <http://bugs.gnu.org/21068>.

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


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

* Re: guix system vm-image --target=i586-pc-gnu Hurd'le
  2020-05-04 13:02 guix system vm-image --target=i586-pc-gnu Hurd'le Jan Nieuwenhuizen
@ 2020-05-04 15:29 ` Mathieu Othacehe
  2020-05-04 16:32   ` Jan Nieuwenhuizen
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Othacehe @ 2020-05-04 15:29 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel


Hello!

> (define* (hurd-grub-configuration-file config entries
>                                        #:key
>                                        (system (%current-target-system))
>                                        (old-entries '()))
>   (let ((hurd (if (equal? system (%current-system))
>                   hurd
>                   (with-parameters ((%current-target-system system))
>                     hurd)))

I'm not sure this is useful. When --target is set, you can use #$ to
refer to the cross-built package and #+ to refer to the native package
(built for host architecture).

>         (mach (with-parameters ((%current-system "i686-linux"))
>                 gnumach))
>         (libc (if (equal? system (%current-system))
>                   glibc
>                   (cross-libc system))))
>     (computed-file "grub.cfg"
>                    #~(call-with-output-file #$output
>                        (lambda (port)
>                          (format port "
> set timeout=2
> search.file ~a/boot/gnumach
> 
> menuentry \"GNU\" {
>   multiboot ~a/boot/gnumach root=device:hd0s1
>   module ~a/hurd/ext2fs.static ext2fs \\
>     --multiboot-command-line='${kernel-command-line}' \\
>     --host-priv-port='${host-port}' \\
>     --device-master-port='${device-port}' \\
>     --exec-server-task='${exec-task}' -T typed '${root}' \\
>     '$(task-create)' '$(task-resume)'
>   module ~a/lib/ld.so.1 exec ~a/hurd/exec '$(exec-task=task-create)'
> }\n"
>                                  #+mach #+mach #+hurd
>                                  #+libc #+hurd))))))

So here, I think you want to use #$hurd, which would refer to the
cross-compiled hurd package when cross-compiling and to the native hurd
when building from a hurd system (real, or emulated with --system).

In the future it would also be nice to have this stuff in (gnu
bootloader grub), but we'll discuss that later on :)

Thanks,

Mathieu


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

* Re: guix system vm-image --target=i586-pc-gnu Hurd'le
  2020-05-04 15:29 ` Mathieu Othacehe
@ 2020-05-04 16:32   ` Jan Nieuwenhuizen
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Nieuwenhuizen @ 2020-05-04 16:32 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: guix-devel

Mathieu Othacehe writes:

Hello Mathieu

>> (define* (hurd-grub-configuration-file config entries
>>                                        #:key
>>                                        (system (%current-target-system))
>>                                        (old-entries '()))
>>   (let ((hurd (if (equal? system (%current-system))
>>                   hurd
>>                   (with-parameters ((%current-target-system system))
>>                     hurd)))
>
> I'm not sure this is useful. When --target is set, you can use #$ to
> refer to the cross-built package and #+ to refer to the native package
> (built for host architecture).

Oh...it seems to be pretty convoluted way to type dead code.  Thanks!

>> menuentry \"GNU\" {
>>   multiboot ~a/boot/gnumach root=device:hd0s1
>>   module ~a/hurd/ext2fs.static ext2fs \\
>>     --multiboot-command-line='${kernel-command-line}' \\
>>     --host-priv-port='${host-port}' \\
>>     --device-master-port='${device-port}' \\
>>     --exec-server-task='${exec-task}' -T typed '${root}' \\
>>     '$(task-create)' '$(task-resume)'
>>   module ~a/lib/ld.so.1 exec ~a/hurd/exec '$(exec-task=task-create)'
>> }\n"
>>                                  #+mach #+mach #+hurd
>>                                  #+libc #+hurd))))))
>
> So here, I think you want to use #$hurd, which would refer to the
> cross-compiled hurd package when cross-compiling and to the native hurd
> when building from a hurd system (real, or emulated with --system).

Ah yes, this is a bug; thanks!

I have changed it to

(define* (hurd-grub-configuration-file config entries
                                       #:key
                                       (system (%current-system))
                                       (old-entries '()))
  ;; XXX Get from a hurd'ified config+entries
  (let ((mach gnumach)
        (hurd hurd)
        (libc glibc))
    (computed-file "grub.cfg"
                   #~(call-with-output-file #$output
                       (lambda (port)
                         (format port "
...
}\n"
                                 #$mach #$mach #$hurd
                                 #$libc #$hurd))))))

> In the future it would also be nice to have this stuff in (gnu
> bootloader grub), but we'll discuss that later on :)

Yes!  I found it still a bit too kludgy for that?

In particular, I haven't really dared to think what to do about the
linux-specific config <menu-entry>...make a hurd variant, or add
hurd'ish fields.

Greetings,
janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


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

end of thread, other threads:[~2020-05-04 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 13:02 guix system vm-image --target=i586-pc-gnu Hurd'le Jan Nieuwenhuizen
2020-05-04 15:29 ` Mathieu Othacehe
2020-05-04 16:32   ` Jan Nieuwenhuizen

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

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

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