#4 Refactor 10_linux and use its kernel detection / menu entry generation
- Refactor
10_linux
: extractgrub-mkconfig-linux_lib
with most of its code and split it into functions. - Apply the
GRUB_LINUX_KERNEL_GLOBS
patch fromoverlay/sys-boot/grub/files
. -
11_linux_be
: use the functions fromgrub-mkconfig-linux_lib
to find kernels and generate menu entries.
Testing: run grub-mkconfig > /tmp/new
and check the result.
-
Run it in a chroot without bind-mounting anything extra (use
bemerge
).Should work (as long as zfs!19 (merged) is merged). Should not print any error messages.
-
Run it in a chroot, bind-mounting the real running be inside the chroot.
Should work. Should not print any error messages.
-
Run it when there are some BEs without kernels in
/boot
(e.g. a pre-linux-be
BE or an OpenIndiana BE).Should skip adding menu entries for the BEs without kernels. Should not print any error messages.
-
Run it when there are BEs with the latest kernel having a different name than in the running BE (e.g.
kernel-4.14-gentoo
instead ofkernel-4.9-gentoo
).Should use the BE's latest kernel name (e.g.
kernel-4.14-gentoo
) for its menu entry (instead of the running BE's kernel name (e.g.kernel-4.9-gentoo
)). -
Run it when there are BEs with a newer kernel built with
genkernel
(/etc/kernels
contains a config file for the kernel in a BE, but does not in the running BE).Should put the following into the menu entry for such BEs:
if [ "x$grub_platform" = xefi ]; then set gfxpayload=keep fi
-
Run it when there are some BEs with names containing
_
,:
, and.
characters.Should use the properly-escaped (as defined in zfs#23 (comment 59496971)) BE names after
$menuentry_id_option
in the result. -
Run it when there are some BEs with kernels in their root (instead of their
/boot
).Should use the correct kernel paths.
-
Make a separate pool. Create a dataset with the contents of
/boot
in it. Mount one of the BEs with kernels in their root mentioned above somewhere (e.g./mnt/test
). Mount the new/boot
dataset under it (/mnt/test/boot
). Run it.Should use the root pool for it (can be distinguished by the hex UUID of the pool being used for setting the root in the menu entry).
-
Make a BE without kernels in it. Create a dataset with the contents of
/boot
and some kernels on a separate pool. Mount the BE and the/boot
dataset under it. Bind-mount/
inside the BE mountpoint. Rungrub-mkconfig
in a chroot to the BE.Should use the boot pool for it (setting the root, loading the kernel/initrd), but pass the BE dataset (from the root pool) to the kernel.
-
Compare the result with one generated with
beadm
branch. (TODO write down the commands withsed
s I used to comparenew
andold
.) -
Verify that all the BEs that weren't mounted before running it are not mounted after that.
-
Mount some more BEs inside the chroot. Run in the chroot.
Should not unmount the BEs mounted above. Should not print any error messages.
Closes #4 (closed)