mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 04:35:00 +08:00
grub-btrfs: add custom kernel parameters option for snapshots
Fix #214, #160 Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
This commit is contained in:
@@ -121,7 +121,7 @@ boot_hs=$(${grub_probe} --device ${boot_device} --target="hints_string" 2>/dev/n
|
|||||||
boot_fs=$(${grub_probe} --device ${boot_device} --target="fs" 2>/dev/null) # Type filesystem of boot device
|
boot_fs=$(${grub_probe} --device ${boot_device} --target="fs" 2>/dev/null) # Type filesystem of boot device
|
||||||
|
|
||||||
## Parameters passed to the kernel
|
## Parameters passed to the kernel
|
||||||
kernel_parameters="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
|
kernel_parameters="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT $GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS"
|
||||||
## Mount point location
|
## Mount point location
|
||||||
grub_btrfs_mount_point=$(mktemp -dt grub-btrfs.XXXXXXXXXX)
|
grub_btrfs_mount_point=$(mktemp -dt grub-btrfs.XXXXXXXXXX)
|
||||||
## Class for theme
|
## Class for theme
|
||||||
|
|||||||
9
config
9
config
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
GRUB_BTRFS_VERSION=4.12-improve-config-2022-12-05T20:15:10+00:00
|
GRUB_BTRFS_VERSION=4.12-improve-config-2022-12-06T21:56:44+00:00
|
||||||
|
|
||||||
# Disable grub-btrfs.
|
# Disable grub-btrfs.
|
||||||
# Default: "false"
|
# Default: "false"
|
||||||
@@ -48,6 +48,13 @@ GRUB_BTRFS_VERSION=4.12-improve-config-2022-12-05T20:15:10+00:00
|
|||||||
# Default: ("")
|
# Default: ("")
|
||||||
#GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")
|
#GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")
|
||||||
|
|
||||||
|
# Additonal kernel command line parameters that should be passed to the kernel
|
||||||
|
# when booting a snapshot.
|
||||||
|
# For dracut based distros this could be useful to pass "rd.live.overlay.overlayfs=1"
|
||||||
|
# or "rd.live.overlay.readonly=1" to the Kernel for booting snapshots read only.
|
||||||
|
# Default: ""
|
||||||
|
#GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"
|
||||||
|
|
||||||
# Comma seperated mount options to be used when booting a snapshot.
|
# Comma seperated mount options to be used when booting a snapshot.
|
||||||
# They can be defined here as well as in the "/" line inside the respective snapshots'
|
# They can be defined here as well as in the "/" line inside the respective snapshots'
|
||||||
# "/etc/fstab" files. Mount options found in both places are combined, and this variable
|
# "/etc/fstab" files. Mount options found in both places are combined, and this variable
|
||||||
|
|||||||
@@ -39,7 +39,11 @@ You notice that the name of the `hook` must match the name of the 2 installed fi
|
|||||||
Re-generate your initramfs
|
Re-generate your initramfs
|
||||||
`mkinitcpio -P` (option -P means, all preset present in `/etc/mkinitcpio.d`)
|
`mkinitcpio -P` (option -P means, all preset present in `/etc/mkinitcpio.d`)
|
||||||
|
|
||||||
|
#### Dracut based distros
|
||||||
|
Distributions that use Dracut to make their initramfs (many of the Fedora based Distros) simply have to pass either `rd.live.overlay.readonly=1` (to boot into the snapshot read only) or `rd.live.overlay.overlayfs=1` (to act like a livedisk, that is files can be changed but changes will be lost on the next boot) to their kernel command line in grub.
|
||||||
|
Grub-btrfs provides the variable `GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS` to add any command to the kernel command line. Set it to `GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"` to make snapshots immutable when booted into.
|
||||||
|
After changing this run `sudo /etc/grub.d/41_snapshots-btrfs` to generate a new snapshot-submenu with the parameter added.
|
||||||
|
|
||||||
#### Other distribution
|
#### Other distribution
|
||||||
Refer to your distribution's documentation
|
Refer to your distribution's documentation or contribute to this project to add a paragraph.
|
||||||
or contribute to this project to add a paragraph.
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.TH "grub-btrfs" "1"
|
.TH "grub-btrfs" "8"
|
||||||
|
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
.PP
|
.PP
|
||||||
@@ -114,6 +114,17 @@ Example: \fCGRUB_BTRFS_NKERNEL=("kernel\-5.19.4\-custom" "vmlinux\-5.19.4\-custo
|
|||||||
\fCGRUB_BTRFS_NINIT=("initramfs\-5.19.4\-custom.img" "initrd\-5.19.4\-custom.img" "otherinit\-5.19.4\-custom.gz")\fP
|
\fCGRUB_BTRFS_NINIT=("initramfs\-5.19.4\-custom.img" "initrd\-5.19.4\-custom.img" "otherinit\-5.19.4\-custom.gz")\fP
|
||||||
\fCGRUB_BTRFS_CUSTOM_MICROCODE=("custom\-ucode.img" "custom\-uc.img "custom_ucode.cpio")\fP
|
\fCGRUB_BTRFS_CUSTOM_MICROCODE=("custom\-ucode.img" "custom\-uc.img "custom_ucode.cpio")\fP
|
||||||
|
|
||||||
|
.SS "\fCGRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS\fP"
|
||||||
|
.PP
|
||||||
|
Additonal kernel command line parameters that should be passed to the kernelwhen
|
||||||
|
booting a snapshot.
|
||||||
|
For dracut based distros this could be useful to pass “rd.live.overlay.overlayfs=1”
|
||||||
|
or “rd.live.overlay.readonly=1” to the Kernel for booting read only snapshots.
|
||||||
|
.IP \(em 4
|
||||||
|
Default: “”
|
||||||
|
.IP \(em 4
|
||||||
|
Example: \fCGRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"\fP
|
||||||
|
|
||||||
.SS "SNAPSHOT FILTERING"
|
.SS "SNAPSHOT FILTERING"
|
||||||
.SS "\fCGRUB_BTRFS_IGNORE_SPECIFIC_PATH\fP"
|
.SS "\fCGRUB_BTRFS_IGNORE_SPECIFIC_PATH\fP"
|
||||||
.PP
|
.PP
|
||||||
@@ -168,7 +179,6 @@ Example: \fCGRUB_BTRFS_BOOT_DIRNAME="/"\fP
|
|||||||
.SS "\fCGRUB_BTRFS_GRUB_DIRNAME\fP"
|
.SS "\fCGRUB_BTRFS_GRUB_DIRNAME\fP"
|
||||||
.PP
|
.PP
|
||||||
Location of the folder containing the “grub.cfg” file.
|
Location of the folder containing the “grub.cfg” file.
|
||||||
Used by grub-btrfs to save the file “grub-btrfs.cfg”.
|
|
||||||
Might be grub2 on some systems.
|
Might be grub2 on some systems.
|
||||||
For example, on Fedora with EFI : “/boot/efi/EFI/fedora”
|
For example, on Fedora with EFI : “/boot/efi/EFI/fedora”
|
||||||
.IP \(em 4
|
.IP \(em 4
|
||||||
@@ -183,9 +193,13 @@ Some distributions (like OpenSuSE) store those file at the snapshot directory
|
|||||||
instead of boot. Be aware that this direcory must be available for grub during
|
instead of boot. Be aware that this direcory must be available for grub during
|
||||||
startup of the system.
|
startup of the system.
|
||||||
.IP \(em 4
|
.IP \(em 4
|
||||||
Default: “/boot/grub”
|
Default: $GRUB\d\s-2BTRFS\s+2\u\d\s-2GRUB\s+2\u\d\s-2DIRNAME\s+2\u
|
||||||
.IP \(em 4
|
.IP \(em 4
|
||||||
|
<<<<<<< HEAD
|
||||||
Example: \fCGRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"\fP
|
Example: \fCGRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"\fP
|
||||||
|
=======
|
||||||
|
Example \fCGRUB_BTRFS_GBTRFS_DIRNAME="/boot/grub2"\fP
|
||||||
|
>>>>>>> e76cdc4 (grub-btrfs: add custom kernel parameters option for snapshots)
|
||||||
|
|
||||||
.SS "\fCGRUB_BTRFS_GBTRFS_SEARCH_DIRNAME\fP"
|
.SS "\fCGRUB_BTRFS_GBTRFS_SEARCH_DIRNAME\fP"
|
||||||
.PP
|
.PP
|
||||||
@@ -204,7 +218,6 @@ with `$\` before the `$`
|
|||||||
.IP \(em 4
|
.IP \(em 4
|
||||||
Example: GRUB\d\s-2BTRFS\s+2\u\d\s-2GBTRFS\s+2\u\d\s-2SEARCH\s+2\u\d\s-2DIRNAME\s+2\u=“\${prefix}”
|
Example: GRUB\d\s-2BTRFS\s+2\u\d\s-2GBTRFS\s+2\u\d\s-2SEARCH\s+2\u\d\s-2DIRNAME\s+2\u=“\${prefix}”
|
||||||
|
|
||||||
|
|
||||||
.SS "\fCGRUB_BTRFS_MKCONFIG\fP"
|
.SS "\fCGRUB_BTRFS_MKCONFIG\fP"
|
||||||
.PP
|
.PP
|
||||||
Name/path of the command to generate the grub menu, used by “grub-btrfs.service”
|
Name/path of the command to generate the grub menu, used by “grub-btrfs.service”
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ Customs kernel, initramfs and microcodes that are not detected can be added in t
|
|||||||
~GRUB_BTRFS_NINIT=("initramfs-5.19.4-custom.img" "initrd-5.19.4-custom.img" "otherinit-5.19.4-custom.gz")~
|
~GRUB_BTRFS_NINIT=("initramfs-5.19.4-custom.img" "initrd-5.19.4-custom.img" "otherinit-5.19.4-custom.gz")~
|
||||||
~GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")~
|
~GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")~
|
||||||
|
|
||||||
|
*** ~GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS~
|
||||||
|
Additonal kernel command line parameters that should be passed to the kernelwhen
|
||||||
|
booting a snapshot.
|
||||||
|
For dracut based distros this could be useful to pass "rd.live.overlay.overlayfs=1"
|
||||||
|
or "rd.live.overlay.readonly=1" to the Kernel for booting read only snapshots.
|
||||||
|
- Default: ""
|
||||||
|
- Example: ~GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"~
|
||||||
|
|
||||||
** SNAPSHOT FILTERING
|
** SNAPSHOT FILTERING
|
||||||
|
|
||||||
*** ~GRUB_BTRFS_IGNORE_SPECIFIC_PATH~
|
*** ~GRUB_BTRFS_IGNORE_SPECIFIC_PATH~
|
||||||
|
|||||||
Reference in New Issue
Block a user