diff options
Diffstat (limited to 'gnu/bootloader')
| -rw-r--r-- | gnu/bootloader/grub.scm | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 2d9a39afc3e..d4dbb571315 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm | |||
| @@ -330,36 +330,58 @@ when booting a root file system on a Btrfs subvolume." | |||
| 330 | (define all-entries | 330 | (define all-entries |
| 331 | (append entries (bootloader-configuration-menu-entries config))) | 331 | (append entries (bootloader-configuration-menu-entries config))) |
| 332 | (define (menu-entry->gexp entry) | 332 | (define (menu-entry->gexp entry) |
| 333 | (let* ((device (menu-entry-device entry)) | 333 | (let ((label (menu-entry-label entry)) |
| 334 | (device-mount-point (menu-entry-device-mount-point entry)) | 334 | (linux (menu-entry-linux entry)) |
| 335 | (label (menu-entry-label entry)) | 335 | (device (menu-entry-device entry)) |
| 336 | (arguments (menu-entry-linux-arguments entry)) | 336 | (device-mount-point (menu-entry-device-mount-point entry))) |
| 337 | (kernel (normalize-file (menu-entry-linux entry) | 337 | (if linux |
| 338 | device-mount-point | 338 | (let ((arguments (menu-entry-linux-arguments entry)) |
| 339 | store-directory-prefix)) | 339 | (linux (normalize-file linux |
| 340 | (initrd (normalize-file (menu-entry-initrd entry) | 340 | device-mount-point |
| 341 | device-mount-point | 341 | store-directory-prefix)) |
| 342 | store-directory-prefix))) | 342 | (initrd (normalize-file (menu-entry-initrd entry) |
| 343 | ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. | 343 | device-mount-point |
| 344 | ;; Use the right file names for KERNEL and INITRD in case | 344 | store-directory-prefix))) |
| 345 | ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a | 345 | ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. |
| 346 | ;; separate partition. | 346 | ;; Use the right file names for LINUX and INITRD in case |
| 347 | #~(format port "menuentry ~s { | 347 | ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a |
| 348 | ;; separate partition. | ||
| 349 | |||
| 350 | ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the linux and | ||
| 351 | ;; initrd paths, to allow booting from a Btrfs subvolume. | ||
| 352 | #~(format port "menuentry ~s { | ||
| 348 | ~a | 353 | ~a |
| 349 | linux ~a ~a | 354 | linux ~a ~a |
| 350 | initrd ~a | 355 | initrd ~a |
| 351 | }~%" | 356 | }~%" |
| 352 | #$label | 357 | #$label |
| 353 | #$(grub-root-search device kernel) | 358 | #$(grub-root-search device linux) |
| 354 | #$kernel (string-join (list #$@arguments)) | 359 | #$linux (string-join (list #$@arguments)) |
| 355 | #$initrd))) | 360 | #$initrd)) |
| 356 | (define sugar | 361 | (let ((kernel (menu-entry-multiboot-kernel entry)) |
| 357 | (eye-candy config | 362 | (arguments (menu-entry-multiboot-arguments entry)) |
| 358 | (menu-entry-device (first all-entries)) | 363 | (modules (menu-entry-multiboot-modules entry)) |
| 359 | (menu-entry-device-mount-point (first all-entries)) | 364 | (root-index 1)) ; XXX EFI will need root-index 2 |
| 360 | #:store-directory-prefix store-directory-prefix | 365 | #~(format port " |
| 361 | #:system system | 366 | menuentry ~s { |
| 362 | #:port #~port)) | 367 | multiboot ~a root=device:hd0s~a~a~a |
| 368 | }~%" | ||
| 369 | #$label | ||
| 370 | #$kernel | ||
| 371 | #$root-index (string-join (list #$@arguments) " " 'prefix) | ||
| 372 | (string-join (map string-join '#$modules) | ||
| 373 | "\n module " 'prefix)))))) | ||
| 374 | |||
| 375 | (define (sugar) | ||
| 376 | (let* ((entry (first all-entries)) | ||
| 377 | (device (menu-entry-device entry)) | ||
| 378 | (mount-point (menu-entry-device-mount-point entry))) | ||
| 379 | (eye-candy config | ||
| 380 | device | ||
| 381 | mount-point | ||
| 382 | #:store-directory-prefix store-directory-prefix | ||
| 383 | #:system system | ||
| 384 | #:port #~port))) | ||
| 363 | 385 | ||
| 364 | (define keyboard-layout-config | 386 | (define keyboard-layout-config |
| 365 | (let* ((layout (bootloader-configuration-keyboard-layout config)) | 387 | (let* ((layout (bootloader-configuration-keyboard-layout config)) |
| @@ -384,7 +406,7 @@ keymap ~a~%" #$keymap)))) | |||
| 384 | "# This file was generated from your Guix configuration. Any changes | 406 | "# This file was generated from your Guix configuration. Any changes |
| 385 | # will be lost upon reconfiguration. | 407 | # will be lost upon reconfiguration. |
| 386 | ") | 408 | ") |
| 387 | #$sugar | 409 | #$(sugar) |
| 388 | #$keyboard-layout-config | 410 | #$keyboard-layout-config |
| 389 | (format port " | 411 | (format port " |
| 390 | set default=~a | 412 | set default=~a |
