Linux Boot Loader/GRUB2

From The Brainwrecked Wiki
Revision as of 10:08, 26 May 2021 by BrainwreckedTech (talk | contribs) (Created page with "{{hc|${BOOT}/grub/grub.cfg|2=<nowiki> insmod part_<gpt|msdos> insmod <btrfs|ext4|f2fs|fat32|jfs|ntfs|xfs|zfs> insmod gettext search --no-floppy --set=root --label <Boot_Files...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
${BOOT}/grub/grub.cfg
insmod	part_<gpt|msdos>
insmod	<btrfs|ext4|f2fs|fat32|jfs|ntfs|xfs|zfs>
insmod	gettext

search	--no-floppy --set=root --label <Boot_Filesystem_Label>

loadfont "/grub/fonts/unicode.pf2"
terminal_input	console
terminal_output	console

function set_resolutions {
	for resolution in 1920x1080 1680x1050 1440x900 1368x768 1366x768 1360x768 1280x720 1280x1024 1024x600 1024x768 800x480 800x600 640x480; do
		for colordepth in 32 16 8; do
			modes=${modes}${resolution}x${colordepth},
		done
	done
	modes=${modes}auto
}  

function load_gfxterm {
	insmod	all_video
	insmod	gfxterm
	set	gfxpayload=keep
	set_resolutions
	set	gfxmode=${modes}
	terminal_output	gfxterm
}

function load_theme {
	insmod	png
	load_gfxterm
	set	theme=/grub/themes/<theme-name>/theme.txt
}

set	timeout=2
set	default=0

menuentry 'Arch Linux (default)' --class desktop {
	echo	'Loading kernel...'
	linux	/arch/boot/vmlinuz-linux-zen root=LABEL=<Root_Filesystem_Label> rootfs=<fs-type> rootflags=noatime,compress-force=zstd,subvol=arch rw consoleblank=0 nvidia-drm.modeset=1 quiet splash loglevel=3 rd.udev.log_priority=3 rd.systemd.show_status=auto vt.global_cursor_default=0
	echo	'Loading initramfs...'
	initrd	/arch/boot/initramfs-linux-zen.img
	load_gfxterm
}

menuentry 'Arch Linux (verbose)' --class desktop {
	echo	'Loading kernel...'
	linux	/arch/boot/vmlinuz-linux-zen root=LABEL=<Root_Filesystem_Label> rootfs=<fs-type> rootflags=noatime,compress-force=zstd,subvol=arch rw consoleblank=0 nvidia-drm.modeset=1
	echo	'Loading initramfs...'
	initrd	/arch/boot/initramfs-linux-zen.img
	load_gfxterm
}

menuentry 'Arch Linux (fallback)' --class desktop {
	echo	'Loading kernel...'
	linux	/arch/boot/vmlinuz-linux-zen root=LABEL=<Root_Filesystem_Label> rootfs=<fs-type> rootflags=noatime,compress-force=zstd,subvol=arch rw consoleblank=0 nvidia-drm.modeset=1
	echo	'Loading initramfs...'
	initrd	/arch/boot/initramfs-linux-zen-fallback.img
	load_gxfterm
}

menuentry 'Arch Linux (console)' --class desktop {
	echo	'Loading kernel...'
	linux	/arch/boot/vmlinuz-linux-zen root=LABEL=<Root_Filesystem_Label> rootfs=<fs-type> rootflags=noatime,compress-force=zstd,subvol=arch rw consoleblank=0 nvidia-drm.modeset=1 systemd.unit=multi-user.target
	echo	'Loading initramfs...'
	initrd	/arch/boot/initramfs-linux-zen-fallback.img
	load_gfxterm
}

menuentry 'Arch Linux (rescue)' --class desktop {
	echo	'Loading kernel...'
	linux	/arch/boot/vmlinuz-linux-zen root=LABEL=<Root_Filesystem_Label> rootfs=<fs-type> rootflags=noatime,compress-force=zstd,subvol=arch rw consoleblank=0 nvidia-drm.modeset=1 systemd.unit=rescue.target
	echo	'Loading initramfs...'
	initrd	/arch/boot/initramfs-linux-zen-fallback.img
	load_gfxterm
}

if [ "${grub_platform}" == "pc" ]; then
	menuentry "Memtest86+" {
		linux16	/memtest86+/memtest.bin
	}
fi