unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Stefan <stefan-guix@vodafonemail.de>
Cc: 41011@debbugs.gnu.org
Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs.
Date: Sun, 6 Sep 2020 16:35:59 +0200	[thread overview]
Message-ID: <20200906163559.1b56c36f@scratchpost.org> (raw)
In-Reply-To: <D62D7658-8929-4578-8C6C-4123DD1D805F@vodafonemail.de>

[-- Attachment #1: Type: text/plain, Size: 6795 bytes --]

Hi Stefan,

I think this looks good in general.

I'd like to do some nitpicking on the names--especially since the procedure is
exported and thus presumably can't have its signature modified later without
breaking backward compatibility.

In this case, the man page grub-mknetdir(8) mentions "netboot" ?
Do you think "net" or "netboot" is a better name for this functionality ?

On Sat, 5 Sep 2020 13:25:24 +0200
Stefan <stefan-guix@vodafonemail.de> wrote:

> +            install-grub-net

I'm fine with whatever--but the man page says "netboot".  If that's the usual
name, let's use it.  If "net"'s the usual name, let's use that.

> +  (let* ((arch (car (string-split (or (%current-target-system)
> +                                      (%current-system))
> +                                  #\-)))

Let's not use arcane Scheme anachronisms like "car".  I know most Scheme
programmers probably know what it does--but still, better not to use
names of registers of a machine no one uses anymore.

Better something like this:

(let* ((system-parts (string-split (or (%current-target-system)
                                       (%current-system))
                            #\-)))

> +         (efi-bootloader-link (string-append "/boot"

> +                                             (match arch
> +                                               ("i686" "ia32")
> +                                               ("x86_64" "x64")
> +                                               ("arm" "arm")
> +                                               ("armhf" "arm")
> +                                               ("aarch64" "aa64")
> +                                               ("riscv" "riscv32")
> +                                               ("riscv64" "riscv64"))
> +                                             ".efi"))

Also, I have a slight preference for greppable file names even when it's a
little more redundant, so more like that:

(match system-parts
 (("i686" _ ...) "ia32.efi")
 (("x86_64" _ ...) "x64.efi")
 (("arm" _ ...) "arm.efi")
 (("armhf" _ ...) "arm.efi")
 (("aarch64" _ ...) "aa64.efi")
 (("riscv" _ ...) "riscv32.efi")
 (("riscv64" _ ...) "riscv64.efi"))

> +         (efi-bootloader (string-append (match arch
> +                                          ("i686" "i386")
> +                                          ("x86_64" "x86_64")
> +                                          ("arm" "arm")
> +                                          ("armhf" "arm")
> +                                          ("aarch64" "arm64")
> +                                          ("riscv" "riscv32")
> +                                          ("riscv64" "riscv64"))
> +                                        "-efi/core.efi")))

Likewise:

         (efi-bootloader (match system-parts
                          (("i686" _ ...) "i386-efi/core.efi")
                          (("x86_64" _ ...) "x86_64-efi/core.efi")
                          (("arm" _ ...) "arm-efi/core.efi")
                          (("armhf" _ ...) "arm-efi/core.efi")
                          (("aarch64" _ ...) "arm64-efi/core.efi")
                          (("riscv" _ ...) "riscv32-efi/core.efi")
                          (("riscv64" _ ...) "riscv64-efi/core.efi"))))

> +    #~(lambda (bootloader target mount-point)

> +        "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" \"into
> +SUBDIR, which is usually \"efi/boot\" or \"efi/Guix\" below the directory TARGET
> +for the system whose root is mounted at MOUNT-POINT."

I think you mean:

> +        "Install GRUB as e.g. \"bootx64.efi\" or \"bootarm64.efi\" \"into
> +SUBDIR (which is usually \"efi/boot\" or \"efi/Guix\") below the directory TARGET
> +for the system whose root is mounted at MOUNT-POINT."

> +        (let* (;; Use target-depth and subdir-depth to construct links to
> +               ;; "../gnu" and "../../../boot/grub/grub.cfg" with the correct
> +               ;; number of "../". Note: This doesn't consider ".." or ".",
> +               ;; which may appear inside target or subdir.

Uhhhh... that could use some more explanationary comments in the source code
of why it is done in the first place.

Also, is TARGET itself assumed to be an absolute path or is it relative to
something else ?  According to the rest of the patch it's relative to
MOUNT-POINT--but please state this explicitly in the docstring.

> +               (target-depth (length (delete "" (string-split target #\/))))

> +               (subdir-depth (length (delete "" (string-split #$subdir #\/))))

> +               (up1 (string-join (make-list target-depth "..") "/" 'suffix))

Maybe better name: escape-target or something.

> +               (up2 (string-join (make-list subdir-depth "..") "/" 'suffix))

Maybe better name: escape-subdir or something.

So this is in order to get out of (string-append TARGET "/" SUBDIR), correct?
Does the (string-append TARGET "/" SUBDIR) have an official name ?
If not, fine.

> +               (net-dir (string-append mount-point target "/"))

So TARGET is relative to MOUNT-POINT ?
And MOUNT-POINT is assumed to have a slash at the end ?

> +               (store-name (car (delete "" (string-split bootloader #\/))))

Maybe use match.

Also isn't there an official way to find out how the store is called ?
(%store-prefix) ?

> +               (store (string-append up1 store-name))

(string-append escape-target store-name)

> +               (store-link (string-append net-dir store-name))

*mumbles to self* (string-append MOUNT-POINT TARGET) is net-dir.
So it tries to get to (string-append MOUNT-POINT "/gnu").

I vaguely remember our docker pack adding some serious plumbing to support
symlinks like that.

I'll try to find it.  I just wanted to send this E-Mail because of the following:

>  ;;;
>  ;;; Bootloader definitions.
>  ;;;
> +;;; For all these grub-bootloader variables the path to /boot/grub/grub.cfg
> +;;; is fixed.  Inheriting and overwriting the field 'configuration-file' will
> +;;; break 'guix system delete-generations', 'guix system switch-generation',
> +;;; and 'guix system roll-back'.

I've added that comment to the source code in an extra commit
3f2bd9df410e85795ec656052f44d2cddec2a060 in guix master.
Thank you very much for it.

> -(define* grub-minimal-bootloader
> +(define grub-minimal-bootloader
>    (bootloader

> -(define* grub-efi-bootloader
> +(define grub-efi-bootloader
>    (bootloader

> -(define* grub-mkrescue-bootloader
> +(define grub-mkrescue-bootloader

I've applied this hunk to guix master as commit
8664c35d6d7fd6e9ce1ca8adefa8070a8e556db4.

Thanks.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-09-06 14:37 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 20:32 [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs Stefan
2020-05-10  8:20 ` Mathieu Othacehe
2020-05-10 21:13   ` Stefan
2020-05-18 21:43     ` Stefan
2020-05-21 15:07       ` Stefan
2020-05-21 18:40         ` Stefan
2020-05-23  8:10           ` Mathieu Othacehe
2020-05-24  0:22             ` Stefan
2020-05-23  8:02     ` Mathieu Othacehe
2020-05-24 10:18       ` Stefan
2020-05-24 11:00         ` Danny Milosavljevic
2020-05-24 13:09           ` Stefan
2020-05-24 13:42             ` Danny Milosavljevic
2020-05-24 13:58               ` Danny Milosavljevic
2020-05-24 17:06                 ` Stefan
2020-05-24 16:47               ` Stefan
2020-06-06 13:30         ` Stefan
2020-06-06 13:33           ` Stefan
2020-06-06 17:37             ` Danny Milosavljevic
     [not found]               ` <46CD97B3-9994-4AB7-AA7D-4DE39AB7A238@vodafonemail.de>
2020-06-09 13:44                 ` Danny Milosavljevic
2020-06-09 14:25                   ` Stefan
2020-06-11  4:21                   ` Maxim Cournoyer
2020-06-11 11:36                     ` Stefan
2020-06-11 13:07                       ` Maxim Cournoyer
2020-06-11 13:19                     ` Danny Milosavljevic
2020-06-12 14:41                       ` Stefan
2020-06-14 18:56                       ` Maxim Cournoyer
2020-06-11 23:43                     ` [bug#41820] [PATCH] file-systems: Add record type <nfs-share> for a file system device Stefan
2020-06-20 13:52                       ` Stefan
2020-06-12  0:06                     ` [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs Stefan
2020-06-14 19:09                       ` Maxim Cournoyer
2020-06-17 13:12                         ` Stefan
2020-09-05 11:25 ` Stefan
2020-09-06 13:07   ` Stefan
2020-09-06 14:35   ` Danny Milosavljevic [this message]
2020-09-06 15:14     ` Danny Milosavljevic
2020-09-07 22:59     ` Stefan
2020-09-08 22:37       ` Danny Milosavljevic
2020-09-13 17:46         ` [bug#41011] [PATCH] gnu: grub: Support for network boot via TFTP Stefan
2020-09-14  6:59           ` Efraim Flashner
2020-09-15 20:28             ` Stefan
2020-09-16  7:51               ` Efraim Flashner
2020-09-19 17:54                 ` Stefan
2020-09-20 11:47                   ` Stefan
2020-09-20 11:56                     ` Stefan
2020-09-26 10:52                       ` Stefan
2020-09-26 10:54                       ` Stefan
2020-09-26 16:13                         ` Danny Milosavljevic
2020-09-27 10:50                           ` Stefan
2020-09-27 10:51                             ` Stefan
2020-09-27 11:47                               ` Danny Milosavljevic
2020-09-14 12:34           ` Danny Milosavljevic
2020-09-15 22:10           ` Danny Milosavljevic
2020-09-27 11:57 ` bug#41011: " Stefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200906163559.1b56c36f@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=41011@debbugs.gnu.org \
    --cc=stefan-guix@vodafonemail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).