mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2025-12-06 07:12:01 +01:00
add GRUB loopback.cfg support
This commit is contained in:
parent
2d18d9bca1
commit
e09eb40683
1
build.sh
1
build.sh
|
|
@ -341,6 +341,7 @@ make_efi() {
|
||||||
s|%DEFAULT_KERNEL_PARAM%|${default_kernel_param}|g;
|
s|%DEFAULT_KERNEL_PARAM%|${default_kernel_param}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g" \
|
s|%INSTALL_DIR%|${install_dir}|g" \
|
||||||
${script_path}/efiboot/grub/grubsrcd.cfg > ${work_dir}/iso/boot/grub/grubsrcd.cfg
|
${script_path}/efiboot/grub/grubsrcd.cfg > ${work_dir}/iso/boot/grub/grubsrcd.cfg
|
||||||
|
cp ${script_path}/efiboot/grub/loopback.cfg ${work_dir}/iso/boot/grub/
|
||||||
cp -a /usr/share/edk2-shell/${edk2arch}/Shell_Full.efi ${work_dir}/iso/EFI/shell.efi
|
cp -a /usr/share/edk2-shell/${edk2arch}/Shell_Full.efi ${work_dir}/iso/EFI/shell.efi
|
||||||
cp ${work_dir}/${arch}/airootfs/boot/memtest86+/memtest.efi ${work_dir}/iso/EFI/memtest.efi
|
cp ${work_dir}/${arch}/airootfs/boot/memtest86+/memtest.efi ${work_dir}/iso/EFI/memtest.efi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,100 +1,115 @@
|
||||||
# Global options
|
# SystemRescue main GRUB config file
|
||||||
set timeout=30
|
|
||||||
set default=0
|
|
||||||
set fallback=1
|
|
||||||
set pager=1
|
|
||||||
|
|
||||||
# Display settings
|
# Note: This is set when we are loaded from loopback.cfg
|
||||||
if loadfont /boot/grub/font.pf2 ; then
|
if [ -z "$srcd_skip_init" ]; then
|
||||||
set gfxmode=640x480
|
# Global options
|
||||||
set color_normal=black/cyan
|
set timeout=30
|
||||||
set color_highlight=black/light-gray
|
set default=0
|
||||||
set menu_color_normal=black/cyan
|
set fallback=1
|
||||||
set menu_color_highlight=black/light-gray
|
set pager=1
|
||||||
insmod efi_gop
|
|
||||||
insmod efi_uga
|
# Display settings
|
||||||
insmod gfxterm
|
if loadfont /boot/grub/font.pf2 ; then
|
||||||
insmod all_video
|
set gfxmode=640x480
|
||||||
insmod videotest
|
set color_normal=black/cyan
|
||||||
insmod videoinfo
|
set color_highlight=black/light-gray
|
||||||
terminal_output gfxterm
|
set menu_color_normal=black/cyan
|
||||||
|
set menu_color_highlight=black/light-gray
|
||||||
|
insmod efi_gop
|
||||||
|
insmod efi_uga
|
||||||
|
insmod gfxterm
|
||||||
|
insmod all_video
|
||||||
|
insmod videotest
|
||||||
|
insmod videoinfo
|
||||||
|
terminal_output gfxterm
|
||||||
|
fi
|
||||||
|
|
||||||
|
# enable serial console with common settings (ttyS0, 115200 Baud, 8n1)
|
||||||
|
# this works in parallel to regular console
|
||||||
|
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
|
||||||
|
terminal_input --append serial
|
||||||
|
terminal_output --append serial
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# enable serial console with common settings (ttyS0, 115200 Baud, 8n1)
|
if [ -z "$archiso_param" ]; then
|
||||||
# this works in parallel to regular console
|
archiso_param="archisolabel=%ARCHISO_LABEL%"
|
||||||
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
|
fi
|
||||||
terminal_input --append serial
|
|
||||||
terminal_output --append serial
|
|
||||||
|
|
||||||
menuentry "Boot SystemRescue using default options" {
|
# Placing menuentry commands inside an eval allows the value of variables
|
||||||
|
# like $archiso_param to be visible in the GRUB editor
|
||||||
|
eval "
|
||||||
|
|
||||||
|
menuentry 'Boot SystemRescue using default options' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM%
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM%
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Boot SystemRescue and copy system to RAM (copytoram)" {
|
menuentry 'Boot SystemRescue and copy system to RAM (copytoram)' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% copytoram
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% copytoram
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Boot SystemRescue and verify integrity of the medium (checksum)" {
|
menuentry 'Boot SystemRescue and verify integrity of the medium (checksum)' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% checksum
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% checksum
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Boot SystemRescue using basic display drivers (nomodeset)" {
|
menuentry 'Boot SystemRescue using basic display drivers (nomodeset)' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% nomodeset
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% nomodeset
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Boot SystemRescue with serial console (ttyS0,115200n8)" {
|
menuentry 'Boot SystemRescue with serial console (ttyS0,115200n8)' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% console=tty0 console=ttyS0,115200n8
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% console=tty0 console=ttyS0,115200n8
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Boot SystemRescue, do not activate md raid or lvm (nomdlvm)" {
|
menuentry 'Boot SystemRescue, do not activate md raid or lvm (nomdlvm)' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% nomdlvm
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% nomdlvm
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Boot a Linux operating system installed on the disk (findroot)" {
|
menuentry 'Boot a Linux operating system installed on the disk (findroot)' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% findroot
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% findroot
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Stop during the boot process before mounting the root filesystem" {
|
menuentry 'Stop during the boot process before mounting the root filesystem' {
|
||||||
set gfxpayload=keep
|
set gfxpayload=keep
|
||||||
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %DEFAULT_KERNEL_PARAM% break
|
linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% $archiso_param %DEFAULT_KERNEL_PARAM% break
|
||||||
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Memtest86+ memory tester for UEFI" {
|
menuentry 'Memtest86+ memory tester for UEFI' {
|
||||||
insmod fat
|
insmod fat
|
||||||
set gfxpayload=800x600,1024x768
|
set gfxpayload=800x600,1024x768
|
||||||
linux /EFI/memtest.efi keyboard=both
|
linux /EFI/memtest.efi keyboard=both
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Start EFI Shell" {
|
menuentry 'Start EFI Shell' {
|
||||||
insmod fat
|
insmod fat
|
||||||
insmod chain
|
insmod chain
|
||||||
terminal_output console
|
terminal_output console
|
||||||
chainloader /EFI/shell.efi
|
chainloader /EFI/shell.efi
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "EFI Firmware setup" {
|
menuentry 'EFI Firmware setup' {
|
||||||
fwsetup
|
fwsetup
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Reboot" {
|
menuentry 'Reboot' {
|
||||||
reboot
|
reboot
|
||||||
}
|
}
|
||||||
|
|
||||||
menuentry "Power off" {
|
menuentry 'Power off' {
|
||||||
halt
|
halt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
" # end eval
|
||||||
|
|
|
||||||
37
efiboot/grub/loopback.cfg
Normal file
37
efiboot/grub/loopback.cfg
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# SystemRescue loopback-mount GRUB config file
|
||||||
|
|
||||||
|
# Per loopback.cfg convention, 'iso_path' should have been set to the
|
||||||
|
# filesystem location of the SystemRescue ISO-image file.
|
||||||
|
# (Reference: https://www.supergrubdisk.org/wiki/Loopback.cfg)
|
||||||
|
|
||||||
|
if [ -z "$iso_path" ]
|
||||||
|
then
|
||||||
|
echo "Warning: 'iso_path' is not set."
|
||||||
|
|
||||||
|
elif search --file --set=archiso_grub_dev --no-floppy $iso_path
|
||||||
|
then
|
||||||
|
echo "Found '$iso_path' on ($archiso_grub_dev)"
|
||||||
|
|
||||||
|
if probe --fs-uuid --set=archiso_fs_uuid $archiso_grub_dev
|
||||||
|
then
|
||||||
|
echo "($archiso_grub_dev) filesystem UUID: $archiso_fs_uuid"
|
||||||
|
archiso_param="img_dev=/dev/disk/by-uuid/$archiso_fs_uuid img_loop=$iso_path"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Warning: Could not get filesystem UUID for ($archiso_grub_dev)."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Warning: Could not find the SystemRescue ISO-image file."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$archiso_param" ]
|
||||||
|
then
|
||||||
|
echo "The following GRUB menu is unlikely to boot SystemRescue successfully."
|
||||||
|
echo
|
||||||
|
echo -n "Press Enter to continue ... "
|
||||||
|
read
|
||||||
|
fi
|
||||||
|
|
||||||
|
srcd_skip_init=yes
|
||||||
|
source /boot/grub/grubsrcd.cfg
|
||||||
Loading…
Reference in a new issue