Re: guix system vm-image --target=i586-pc-gnu Hurd'le

2020-05-04 Thread Jan Nieuwenhuizen
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 ...make a hurd variant, or add
hurd'ish fields.

Greetings,
janneke

-- 
Jan Nieuwenhuizen  | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



Re: guix system vm-image --target=i586-pc-gnu Hurd'le

2020-05-04 Thread Mathieu Othacehe


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



guix system vm-image --target=i586-pc-gnu Hurd'le

2020-05-04 Thread Jan Nieuwenhuizen
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")
;;; (" => " #)
;;; ("implicit mlet-lowering target=" "i586-pc-gnu")
;;; (" => " (# # sys-object" #)
;;; ("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 .

-- 
Jan Nieuwenhuizen  | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com