优化 grub.cfg,调整终端输出设置并简化 gfxmode 函数调用

This commit is contained in:
Ing 2025-06-06 16:13:09 +08:00
parent cdf0e65f7e
commit 7bf872272b

View File

@ -49,6 +49,8 @@ else
font=${prefix}/fonts/unicode.pf2
fi
terminal_output console
if loadfont ${font}; then
set gfxmode=auto
load_video
@ -56,10 +58,9 @@ if loadfont ${font}; then
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
terminal_output --append gfxterm
fi
terminal_output gfxterm
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
terminal_input --append serial
terminal_output --append serial
@ -72,10 +73,6 @@ set menu_color_highlight=black/cyan
insmod png
background_image ${prefix}/logo.png
function gfxmode {
set gfxpayload="${linux_gfx_mode}"
}
set RR_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off amd_iommu_intr=legacy net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable amd_pstate=disable nox2apic nomodeset nowatchdog"
search --set=root --label "RR3"
@ -89,7 +86,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
load_env --skip-sig --file=${prefix}/rsysenv
fi
menuentry 'Boot DSM kernel directly' ${menuentry_id_option} direct {
gfxmode
set gfxpayload="${linux_gfx_mode}"
echo "RRVersion: ${rr_version}"
echo "${rr_booting}"
echo -n "Boot Time: "; date
@ -114,7 +111,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
}
fi
menuentry 'Boot DSM' ${menuentry_id_option} boot {
gfxmode
set gfxpayload="${linux_gfx_mode}"
echo "Loading kernel..."
linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline}
echo "Loading initramfs..."
@ -122,7 +119,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
echo "Booting..."
}
menuentry 'Boot Recovery' ${menuentry_id_option} recovery {
gfxmode
set gfxpayload="${linux_gfx_mode}"
echo "Loading kernel..."
linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} recovery
echo "Loading initramfs..."
@ -130,7 +127,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
echo "Booting..."
}
menuentry 'Force re-install DSM' ${menuentry_id_option} junior {
gfxmode
set gfxpayload="${linux_gfx_mode}"
echo "Loading kernel..."
linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} force_junior
echo "Loading initramfs..."
@ -140,7 +137,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
menuentry 'Configure loader' ${menuentry_id_option} config {
gfxmode
set gfxpayload="${linux_gfx_mode}"
echo "Loading kernel..."
linux /bzImage-rr earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 ${RR_CMDLINE} ${rr_cmdline} IWANTTOCHANGETHECONFIG
echo "Loading initramfs..."
@ -149,7 +146,7 @@ menuentry 'Configure loader' ${menuentry_id_option} config {
}
menuentry 'Configure loader (verbose)' ${menuentry_id_option} verbose {
gfxmode
set gfxpayload="${linux_gfx_mode}"
echo "Loading kernel..."
linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} earlycon=tty2 console=tty2 IWANTTOCHANGETHECONFIG
echo "Loading initramfs..."