vm: Set the boot flag on the root partition.
Reported by nebuli on #guix. * gnu/build/vm.scm (initialize-partition-table): Add #:bootable? parameter and honor it. (initialize-hard-disk): Likewise.
This commit is contained in:
parent
ced0106a44
commit
bff39668b9
|
@ -112,17 +112,21 @@ the #:references-graphs parameter of 'derivation'."
|
||||||
|
|
||||||
(define* (initialize-partition-table device partition-size
|
(define* (initialize-partition-table device partition-size
|
||||||
#:key
|
#:key
|
||||||
|
bootable?
|
||||||
(label-type "msdos")
|
(label-type "msdos")
|
||||||
(offset (expt 2 20)))
|
(offset (expt 2 20)))
|
||||||
"Create on DEVICE a partition table of type LABEL-TYPE, with a single
|
"Create on DEVICE a partition table of type LABEL-TYPE, with a single
|
||||||
partition of PARTITION-SIZE bytes starting at OFFSET bytes. Return #t on
|
partition of PARTITION-SIZE bytes starting at OFFSET bytes. When BOOTABLE? is
|
||||||
success."
|
true, set the bootable flag on the partition. Return #t on success."
|
||||||
(format #t "creating partition table with a ~a B partition...\n"
|
(format #t "creating partition table with a ~a B partition...\n"
|
||||||
partition-size)
|
partition-size)
|
||||||
(unless (zero? (system* "parted" device "mklabel" label-type
|
(unless (zero? (apply system* "parted" device "mklabel" label-type
|
||||||
"mkpart" "primary" "ext2"
|
"mkpart" "primary" "ext2"
|
||||||
(format #f "~aB" offset)
|
(format #f "~aB" offset)
|
||||||
(format #f "~aB" partition-size)))
|
(format #f "~aB" partition-size)
|
||||||
|
(if bootable?
|
||||||
|
'("set" "1" "boot" "on")
|
||||||
|
'())))
|
||||||
(error "failed to create partition table")))
|
(error "failed to create partition table")))
|
||||||
|
|
||||||
(define MS_BIND 4096) ; <sys/mounts.h> again!
|
(define MS_BIND 4096) ; <sys/mounts.h> again!
|
||||||
|
@ -183,13 +187,16 @@ volume name."
|
||||||
file-system-label
|
file-system-label
|
||||||
(closures '())
|
(closures '())
|
||||||
copy-closures?
|
copy-closures?
|
||||||
|
(bootable? #t)
|
||||||
(register-closures? #t))
|
(register-closures? #t))
|
||||||
"Initialize DEVICE, a disk of DISK-IMAGE-SIZE bytes, with a FILE-SYSTEM-TYPE
|
"Initialize DEVICE, a disk of DISK-IMAGE-SIZE bytes, with a FILE-SYSTEM-TYPE
|
||||||
partition with (optionally) FILE-SYSTEM-LABEL as its volume name, and with
|
partition with (optionally) FILE-SYSTEM-LABEL as its volume name, and with
|
||||||
GRUB installed. If REGISTER-CLOSURES? is true, register all of CLOSURES is
|
GRUB installed. When BOOTABLE? is true, set the bootable flag on that
|
||||||
the partition's store. If COPY-CLOSURES? is true, copy all of CLOSURES to the
|
partition.
|
||||||
partition. SYSTEM-DIRECTORY is the name of the directory of the 'system'
|
|
||||||
derivation."
|
If REGISTER-CLOSURES? is true, register all of CLOSURES is the partition's
|
||||||
|
store. If COPY-CLOSURES? is true, copy all of CLOSURES to the partition.
|
||||||
|
SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
|
||||||
(define target-directory
|
(define target-directory
|
||||||
"/fs")
|
"/fs")
|
||||||
|
|
||||||
|
@ -197,7 +204,8 @@ derivation."
|
||||||
(string-append device "1"))
|
(string-append device "1"))
|
||||||
|
|
||||||
(initialize-partition-table device
|
(initialize-partition-table device
|
||||||
(- disk-image-size (* 5 (expt 2 20))))
|
(- disk-image-size (* 5 (expt 2 20)))
|
||||||
|
#:bootable? bootable?)
|
||||||
|
|
||||||
(format-partition partition file-system-type
|
(format-partition partition file-system-type
|
||||||
#:label file-system-label)
|
#:label file-system-label)
|
||||||
|
|
Loading…
Reference in New Issue