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 0EqeCidF1l7nZQAA0tVLHw (envelope-from ) for ; Tue, 02 Jun 2020 12:25:11 +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 yIKfBidF1l4FDAAAB5/wlQ (envelope-from ) for ; Tue, 02 Jun 2020 12:25:11 +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 5A2A3940983 for ; Tue, 2 Jun 2020 12:25:10 +0000 (UTC) Received: from localhost ([::1]:36870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg5yf-0008Lb-AT for larch@yhetil.org; Tue, 02 Jun 2020 08:25:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg5yY-0008LK-NV for bug-guix@gnu.org; Tue, 02 Jun 2020 08:25:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jg5yY-0006Vb-EV for bug-guix@gnu.org; Tue, 02 Jun 2020 08:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jg5yY-0002vY-B9 for bug-guix@gnu.org; Tue, 02 Jun 2020 08:25:02 -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 12:25:02 +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: Mathieu Othacehe Received: via spool by 41541-submit@debbugs.gnu.org id=B41541.159110065011183 (code B ref 41541); Tue, 02 Jun 2020 12:25:02 +0000 Received: (at 41541) by debbugs.gnu.org; 2 Jun 2020 12:24:10 +0000 Received: from localhost ([127.0.0.1]:38135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jg5xd-0002uD-KM for submit@debbugs.gnu.org; Tue, 02 Jun 2020 08:24:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jg5xc-0002tH-CM for 41541@debbugs.gnu.org; Tue, 02 Jun 2020 08:24:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43152) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg5xX-0006Oz-4z; Tue, 02 Jun 2020 08:23:59 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=38456 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 1jg5xW-0003RA-5I; Tue, 02 Jun 2020 08:23:58 -0400 From: Jan Nieuwenhuizen 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> X-Url: http://AvatarAcademy.nl Date: Tue, 02 Jun 2020 14:23:54 +0200 In-Reply-To: <87r1uxwz5q.fsf@gnu.org> (Mathieu Othacehe's message of "Tue, 02 Jun 2020 12:16:33 +0200") Message-ID: <87mu5ly7tx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) 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 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: hH7gdxGTuIii --=-=-= Content-Type: text/plain Mathieu Othacehe writes: Hi Mathieu, > 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=%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? Anyway...see working prototype attached! To get rid of the extra sevice that I added I'd need some help. Please feel free to just rework it if you like! > 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. The Hurd code uses it "everywhere" and I seem to remember that a simple substitute* on the Hurd archive was not enough...sadly I do not remember the details, so maybe... Greetings, Janneke --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gnu-services-Add-hurd-startup-service.patch >From e11e59cbcd9165e3b885c1019e19aaab471f5498 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 30 Apr 2020 15:40:07 +0200 Subject: [PATCH] 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 --rc-file=RC-FILE. (hurd-rc-script): Move to... * gnu/services.scm (%hurd-rc-file): ...this new variable. (bootable-kernel-arguments): Use it. (%hurd-bare-metal-service): New variable. * gnu/system.scm (hurd-default-essential-services): Use it. --- gnu/packages/hurd.scm | 52 ++++++++++--------------------------------- gnu/services.scm | 40 +++++++++++++++++++++++++++++++++ gnu/system.scm | 21 ++++++++++------- 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm index 5de4acb1c5..542ca1e229 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 + (--rc-file=*) + rc=${i#--rc-file=} + ;; + esac +done + +echo Starting ${rc}... +exec ${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..b21520eafc 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,44 @@ ACTIVATION-SCRIPT-TYPE." activation-service-type %linux-kernel-activation)) +;; XXX this won't go into SYSTEM (as system-service); the result is fine +;; though and it gets picked-up well by --rc-file=%hurd-rc-script +(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)) + #~(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 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-entry))) + (compose identity) + (extend (const (lower-object %hurd-rc-script))) + (description + "Produce the operating system's RC script, which is executed +by RUNSYSTEM."))) + +(define %hurd-startup-service + ;; The service that produces the RC script. + (service hurd-startup-service-type #t)) (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..09ab574278 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -170,14 +170,18 @@ (define (bootable-kernel-arguments system root-device) "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE." - (list (string-append "--root=" - ;; Note: Always use the DCE format because that's what - ;; (gnu build linux-boot) expects for the '--root' - ;; kernel command-line option. - (file-system-device->string root-device - #:uuid-type 'dce)) - #~(string-append "--system=" #$system) - #~(string-append "--load=" #$system "/boot"))) + (append + (if (hurd-target?) + (list #~(string-append "--rc-file=" #$%hurd-rc-script)) + '()) + (list (string-append "--root=" + ;; Note: Always use the DCE format because that's what + ;; (gnu build linux-boot) expects for the '--root' + ;; kernel command-line option. + (file-system-device->string root-device + #:uuid-type 'dce)) + #~(string-append "--system=" #$system) + #~(string-append "--load=" #$system "/boot")))) ;; System-wide configuration. ;; TODO: Add per-field docstrings/stexi. @@ -610,6 +614,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 --=-=-=--