From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WEEFDNRW1l4bZwAA0tVLHw (envelope-from ) for ; Tue, 02 Jun 2020 13:40:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id eNPoB9RW1l6VSgAAB5/wlQ (envelope-from ) for ; Tue, 02 Jun 2020 13:40:36 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 23DBF940607 for ; Tue, 2 Jun 2020 13:40:35 +0000 (UTC) Received: from localhost ([::1]:55214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg79d-0003p7-Lc for larch@yhetil.org; Tue, 02 Jun 2020 09:40:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg798-0003Zv-4k for bug-guix@gnu.org; Tue, 02 Jun 2020 09:40:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jg797-0005wC-RI for bug-guix@gnu.org; Tue, 02 Jun 2020 09:40:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jg797-0004pe-OS for bug-guix@gnu.org; Tue, 02 Jun 2020 09:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#41541: merge wip-hurd-vm Resent-From: Jan Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 02 Jun 2020 13:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41541 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 41541-submit@debbugs.gnu.org id=B41541.159110516118505 (code B ref 41541); Tue, 02 Jun 2020 13:40:01 +0000 Received: (at 41541) by debbugs.gnu.org; 2 Jun 2020 13:39:21 +0000 Received: from localhost ([127.0.0.1]:38250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jg78O-0004oJ-Ni for submit@debbugs.gnu.org; Tue, 02 Jun 2020 09:39:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jg78J-0004nz-HR for 41541@debbugs.gnu.org; Tue, 02 Jun 2020 09:39:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44278) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg78E-0005qP-6k; Tue, 02 Jun 2020 09:39:06 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=38576 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jg78D-0004cf-83; Tue, 02 Jun 2020 09:39:05 -0400 From: Jan Nieuwenhuizen In-Reply-To: <87mu5lsksn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 02 Jun 2020 14:40:24 +0200") Organization: AvatarAcademy.nl References: <87o8qavktf.fsf@gnu.org> <87tv01vgqy.fsf@gnu.org> <87blm54hae.fsf@gnu.org> <874krtyhtg.fsf@gnu.org> <87h7vtzupa.fsf@gnu.org> <87r1uxwz5q.fsf@gnu.org> <87mu5ly7tx.fsf@gnu.org> <87mu5lsksn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) X-Url: http://AvatarAcademy.nl Date: Tue, 02 Jun 2020 15:39:00 +0200 Message-ID: <87y2p5vb7v.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 41541@debbugs.gnu.org, Mathieu Othacehe Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: /9aM3Fc/wwB9 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: Hello! > Jan Nieuwenhuizen skribis: > >>> Having an RC argument passed directly by the bootloader seems like a >>> good way to proceed for me. This is somehow remotely similar to what we >>> are doing with the "initrd" on Linux (pointing to some piece of code >>> that needs to be loaded before starting the init process). >>> >>> You would also need to store this RC argument in the >>> record, by adding a new field or stuffing it in the "initrd" >>> field. Then, we wouldn't need an extra service I guess. >> >> Hmm...I don't understand...probably I'm missing something. >> >> I was thinking to just extend boot-parameters with >> --rc-file=3D%hurd-rc-script, and then add %hurd-rc-script to the SYSTEM >> service...How would I get the RC script into SYSTEM without a service? > > Normally, if you have the system (as returned by =E2=80=98guix system bui= ld=E2=80=99), > that=E2=80=99s enough to derive any other kind of thing you might want. > > So for example, you could have a =E2=80=9Cstartup=E2=80=9D (or =E2=80=9Cr= c=E2=80=9D) entry in the > =E2=80=98system=E2=80=99 directory by extending =E2=80=98system-service-t= ype=E2=80=99. And since the > system is known from the boot command line, bingo. > > The guideline IMO should be to remain as close as possible to Guix > System on GNU/Linux. It=E2=80=99s OK to depart a bit from upstream Hurd = though > because those bits are not actually used (Debian does its own thing). Okay, that makes sense. Using --system=3DSYSTEM =3D> SYSTEM/rc now. >>> If we are going that way, the procedures in (gnu build hurd-boot) could >>> be passed the "hurd" package to install, and we could maybe get rig of >>> the "/hurd" symlink? >> >> Hehe, that would be nice...but IME /hurd isn't easy to get rid of. > > Some of the /hurd names are embedded in libc, via the Hurd=E2=80=99s path= s.h. > Some names are compared by string (!); for instance, symlink.c in libc > has: > > /* A symlink is a file whose translator is "/hurd/symlink\0target\0". = */ > > memcpy (buf, _HURD_SYMLINK, sizeof (_HURD_SYMLINK)); > memcpy (&buf[sizeof (_HURD_SYMLINK)], from, len); > > That makes it next to impossible to remove /hurd. > > I think it should be treated like /bin/sh and /run/current-system: set > up at activation time. Ah right...I think this is exactly what I found (and forgot). The file system embeds the full file-name...that's unfortunate. >> +(define %hurd-rc-script >> + ;; The RC script to be started upon boot. >> + (program-file "rc" >> + (with-imported-modules '((guix build utils) >> + (gnu build hurd-boot) >> + (guix build syscalls)) > > Probably use =E2=80=98source-module-closure=E2=80=99 to be on the safe si= de. Nice! >> +(define (hurd-rc-entry mrc) >> + "Return, as a monadic value, an entry for the RC script in the system >> +directory." >> + (mlet %store-monad ((rc mrc)) >> + (return `(("rc" ,rc))))) >> + >> +(define hurd-startup-service-type >> + ;; The service that creates the initial RC startup file. >> + (service-type (name 'startup) >> + (extensions >> + (list (service-extension system-service-type hurd-rc-e= ntry))) >> + (compose identity) >> + (extend (const (lower-object %hurd-rc-script))) >> + (description >> + "Produce the operating system's RC script, which is ex= ecuted >> +by RUNSYSTEM."))) > > Is this service really meant to be extensible? If not, we could just do: (no) > (service-type (name 'startup) > (extensions > (list (service-extension system-service-type hurd-rc-ent= ry))) > (default-value %hurd-rc-script)) > > where: > > (define (hurd-rc-entry rc) > (mlet %store-monad ((rc (lower-object rc))) > (return `(("rc" ,rc))))) Thanks, done! >> + (append >> + (if (hurd-target?) >> + (list #~(string-append "--rc-file=3D" #$%hurd-rc-script)) >> + '()) >> + (list (string-append "--root=3D" >> + ;; Note: Always use the DCE format because that= 's what >> + ;; (gnu build linux-boot) expects for the '--ro= ot' >> + ;; kernel command-line option. >> + (file-system-device->string root-device >> + #:uuid-type 'dce)) >> + #~(string-append "--system=3D" #$system) >> + #~(string-append "--load=3D" #$system "/boot")))) > > So my suggestion is to avoid --rc-file since you know that SYSTEM/rc > exists. Done! > Ludo=E2=80=99, who jumps in the middle of the discussion. :-) Very helpful indeed :-) -- attaching new version (and much tempted to push to wip-hurd-vm now). Any more wishes or ideas, things to be done before merging? Not all patches were reviewed in their current form, I think. Janneke --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-gnu-services-Add-hurd-startup-service.patch >From 37c2a57d72f5678ec21a48ed4a3b733a20b71ab1 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 30 Apr 2020 15:40:07 +0200 Subject: [PATCH v2] gnu: services: Add %hurd-startup-service. This decouples startup of the Hurd from the "hurd" package, moving the RC script into SYSTEM. * gnu/packages/hurd.scm (hurd)[inputs]: Remove hurd-rc-script. [arguments]: Do not substitute it. Update "runsystem.sh" to parse kernel arguments and exec into --system=SYSTEM/rc. (hurd-rc-script): Move to... * gnu/services.scm (%hurd-rc-file): ...this new variable. (hurd-rc-entry): New procedure. (%hurd-startup-service): Use it in new variable. * gnu/system.scm (hurd-default-essential-services): Use it. --- gnu/packages/hurd.scm | 52 ++++++++++--------------------------------- gnu/services.scm | 35 +++++++++++++++++++++++++++++ gnu/system.scm | 1 + 3 files changed, 48 insertions(+), 40 deletions(-) diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm index 5de4acb1c5..9dc03c6c9c 100644 --- a/gnu/packages/hurd.scm +++ b/gnu/packages/hurd.scm @@ -310,32 +310,6 @@ Hurd-minimal package which are needed for both glibc and GCC.") (base32 "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys")))) -(define (hurd-rc-script) - "Return a script to be installed as /libexec/rc in the 'hurd' package. The -script takes care of installing the relevant passive translators on the first -boot, since this cannot be done from GNU/Linux. Then, it runs system -activation; starting the Shepherd." - - (define rc - (with-imported-modules '((guix build utils) - (gnu build hurd-boot) - (guix build syscalls)) - #~(begin - (use-modules (guix build utils) - (gnu build hurd-boot) - (guix build syscalls) - (ice-9 match) - (system repl repl) - (srfi srfi-1) - (srfi srfi-26)) - - (boot-hurd-system)))) - - ;; FIXME: We want the program to use the cross-compiled Guile when - ;; cross-compiling. But why do we need to be explicit here? - (with-parameters ((%current-target-system "i586-pc-gnu")) - (program-file "rc" rc))) - (define dde-sources ;; This is the current tip of the dde branch (let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136")) @@ -417,11 +391,19 @@ PATH=@PATH@ fsck --yes --force / fsysopts / --writable settrans -c /servers/socket/1 /hurd/pflocal -echo Starting /libexec/rc ... -exec /libexec/rc \"$@\" -"))) - )) +# parse multiboot arguments +for i in \"$@\"; do + case $i in + (--system=*) + system=${i#--system=} + ;; + esac +done + +echo Starting ${system}/rc... +exec ${system}/rc \"$@\" +"))))) (add-before 'build 'set-file-names (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) @@ -483,15 +465,6 @@ exec /libexec/rc \"$@\" (mkdir-p datadir) (copy-file "unifont" (string-append datadir "/vga-system.bdf")) - #t))) - (add-after 'install 'install-rc-file - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (file (string-append out "/libexec/rc")) - (rc (assoc-ref inputs "hurd-rc")) - (coreutils (assoc-ref inputs "coreutils"))) - (delete-file file) - (copy-file rc file) #t)))) #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib") @@ -506,7 +479,6 @@ exec /libexec/rc \"$@\" (build-system gnu-build-system) (inputs `(("glibc-hurd-headers" ,glibc/hurd-headers) - ("hurd-rc" ,(hurd-rc-script)) ("libgcrypt" ,libgcrypt) ;for /hurd/random ("libdaemon" ,libdaemon) ;for /bin/console --daemonize diff --git a/gnu/services.scm b/gnu/services.scm index 4e0bbc0249..5a04964790 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -94,6 +94,8 @@ activation-service-type activation-service->script %linux-bare-metal-service + %hurd-rc-script + %hurd-startup-service special-files-service-type extra-special-file etc-service-type @@ -630,6 +632,39 @@ ACTIVATION-SCRIPT-TYPE." activation-service-type %linux-kernel-activation)) +(define %hurd-rc-script + ;; The RC script to be started upon boot. + (program-file "rc" + (with-imported-modules (source-module-closure + '((guix build utils) + (gnu build hurd-boot) + (guix build syscalls))) + #~(begin + (use-modules (guix build utils) + (gnu build hurd-boot) + (guix build syscalls) + (ice-9 match) + (system repl repl) + (srfi srfi-1) + (srfi srfi-26)) + (boot-hurd-system))))) + +(define (hurd-rc-entry rc) + "Return, as a monadic value, an entry for the RC script in the system +directory." + (mlet %store-monad ((rc (lower-object rc))) + (return `(("rc" ,rc))))) + +(define hurd-startup-service-type + ;; The service that creates the initial SYSTEM/rc startup file. + (service-type (name 'startup) + (extensions + (list (service-extension system-service-type hurd-rc-entry))) + (default-value %hurd-rc-script))) + +(define %hurd-startup-service + ;; The service that produces the RC script. + (service hurd-startup-service-type %hurd-rc-script)) (define special-files-service-type ;; Service to install "special files" such as /bin/sh and /usr/bin/env. diff --git a/gnu/system.scm b/gnu/system.scm index 41c551af0b..c20f4649f9 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -610,6 +610,7 @@ bookkeeping." (define (hurd-default-essential-services os) (list (service system-service-type '()) %boot-service + %hurd-startup-service %activation-service %shepherd-root-service (service user-processes-service-type) -- 2.26.2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-=--