diff options
| author | Stefan <stefan-guix@vodafonemail.de> | 2020-09-14 14:20:16 +0200 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@scratchpost.org> | 2020-09-14 14:25:04 +0200 |
| commit | 8c4f1aa85f3844fc8c989e74cef9d269dd30889c (patch) | |
| tree | d0db8f5d57cf799d3359a60d44f592c6251ac81b /gnu/bootloader | |
| parent | f6807498bea9471dd7ef9b09359ba9077e7094e6 (diff) | |
gnu: grub: Support loading files from TFTP if the root filesystem is NFS.
* gnu/bootloader/grub.scm (grub-root-search): Set the root to "(tftp)" if
the searched-for file is stored on NFS.
Diffstat (limited to 'gnu/bootloader')
| -rw-r--r-- | gnu/bootloader/grub.scm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index e3febeefd01..f69bf8ed4d0 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm | |||
| @@ -295,6 +295,33 @@ code." | |||
| 295 | ((? file-system-label? label) | 295 | ((? file-system-label? label) |
| 296 | (format #f "search --label --set ~a" | 296 | (format #f "search --label --set ~a" |
| 297 | (file-system-label->string label))) | 297 | (file-system-label->string label))) |
| 298 | ((? (lambda (device) | ||
| 299 | (and (string? device) (string-contains device ":/"))) nfs-uri) | ||
| 300 | ;; This assumes that if your root file system is on NFS, then | ||
| 301 | ;; you also want to load your grub extra files, kernel and initrd | ||
| 302 | ;; from there. | ||
| 303 | ;; | ||
| 304 | ;; We explicitly set "root=(tftp)" here even though if grub.cfg | ||
| 305 | ;; had been loaded via TFTP, Grub would have set "root=(tftp)" | ||
| 306 | ;; automatically anyway. The reason is if you have a system that | ||
| 307 | ;; used to be on NFS but now is local, root would be set to local | ||
| 308 | ;; disk. If you then selected an older system generation that is | ||
| 309 | ;; supposed to boot from network in the Grub boot menu, Grub still | ||
| 310 | ;; wouldn't load those files from network otherwise. | ||
| 311 | ;; | ||
| 312 | ;; TFTP is preferred to HTTP because it is used more widely and | ||
| 313 | ;; specified in standards more widely--especially BOOTP/DHCPv4 | ||
| 314 | ;; defines a TFTP server for DHCP option 66, but not HTTP. | ||
| 315 | ;; | ||
| 316 | ;; Note: DHCPv6 specifies option 59 to contain a boot-file-url, | ||
| 317 | ;; which can contain a HTTP or TFTP URL. | ||
| 318 | ;; | ||
| 319 | ;; Note: It is assumed that the file paths are of a similar | ||
| 320 | ;; setup on both the TFTP server and the NFS server (it is | ||
| 321 | ;; not possible to search for files on TFTP). | ||
| 322 | ;; | ||
| 323 | ;; TODO: Allow HTTP. | ||
| 324 | "set root=(tftp)") | ||
| 298 | ((or #f (? string?)) | 325 | ((or #f (? string?)) |
| 299 | #~(format #f "search --file --set ~a" #$file))))) | 326 | #~(format #f "search --file --set ~a" #$file))))) |
| 300 | 327 | ||
