summaryrefslogtreecommitdiff
path: root/setup-disk.in
diff options
context:
space:
mode:
authorMagnus Sandin <magnus.sandin@valitron.se>2023-01-30 14:32:53 +0100
committerMagnus Sandin <magnus.sandin@valitron.se>2023-01-30 19:24:39 +0100
commitb527b1b2eea9a9ed11a11dcb8c50fb0a28d36120 (patch)
tree87e09ded9c38df4c2be0f7429337ad14958c0dff /setup-disk.in
parent3c563344e98c9ac187d56d2600de0a37b3967373 (diff)
downloadalpine-conf-b527b1b2eea9a9ed11a11dcb8c50fb0a28d36120.zip
setup-disk: Add support for booting zfs (in grub)
Diffstat (limited to 'setup-disk.in')
-rwxr-xr-x[-rw-r--r--]setup-disk.in19
1 files changed, 19 insertions, 0 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 9258df2..20be60c 100644..100755
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -238,6 +238,9 @@ find_mount_dev() {
supported_boot_fs() {
local supported="ext2 ext3 ext4 btrfs xfs vfat"
+ if [ "$BOOTLOADER" = "grub" ]; then
+ local supported="$supported zfs"
+ fi
local fs=
if is_rpi; then
supported=vfat
@@ -352,6 +355,10 @@ setup_grub() {
GRUB_DISABLE_RECOVERY=true
GRUB_CMDLINE_LINUX_DEFAULT="modules=$modules $kernel_opts"
EOF
+
+ case "$initfs_features" in
+ *zfs*) echo "GRUB_FS=zfs" >> "$mnt"/etc/default/grub;;
+ esac
}
# setup syslinux bootloader
@@ -544,6 +551,18 @@ install_mounted_root() {
echo "Continuing at your own risk."
fi
+ # if root fileystem is zfs, check if we need to load
+ # nvme feature when creating initramfs
+ if [ "$root_fs" = "zfs" ]; then
+ for dev in $(zpool list -v ${rootdev%%/*} | sed '/^\S.*/d;s/^\s*\(\S*\)\s.*/\1/g'); do
+ case $dev in
+ nvme*)
+ initfs_features="${initfs_features% nvme} nvme"
+ ;;
+ esac
+ done
+ fi
+
# check if our root is on raid so we can feed mkinitfs and
# bootloader conf with the proper kernel module params
for dev in $rootdev $pvs $cryptdev; do