Merge pull request #519 from fbelavenuto/dev

Adding video mode selection in grub.
This commit is contained in:
Fabio Belavenuto 2023-01-18 17:01:45 -03:00 committed by GitHub
commit 705d2d9817
2 changed files with 41 additions and 23 deletions

View File

@ -50,6 +50,7 @@ ln -s "${CACHE_PATH}/ssh" "/etc/ssh"
# Link bash history to cache volume # Link bash history to cache volume
rm -rf ~/.bash_history rm -rf ~/.bash_history
ln -s ${CACHE_PATH}/.bash_history ~/.bash_history ln -s ${CACHE_PATH}/.bash_history ~/.bash_history
touch ~/.bash_history
if ! grep -q "menu.sh" ~/.bash_history; then if ! grep -q "menu.sh" ~/.bash_history; then
echo "menu.sh " >> ~/.bash_history echo "menu.sh " >> ~/.bash_history
fi fi

View File

@ -14,6 +14,19 @@ insmod ext2
set default="boot" set default="boot"
set timeout="5" set timeout="5"
set timeout_style="menu" set timeout_style="menu"
set vesa_mode=1
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ]; then
set default="${next_entry}"
unset next_entry
save_env next_entry
fi
if [ "${vesa_mode}" ]; then
set vesa_mode=${vesa_mode}
fi
function load_video { function load_video {
if [ x$feature_all_video_module = xy ]; then if [ x$feature_all_video_module = xy ]; then
@ -33,7 +46,6 @@ load_video
if loadfont unicode; then if loadfont unicode; then
set gfxmode=auto set gfxmode=auto
insmod gfxterm insmod gfxterm
set gfxpayload=keep
terminal_output gfxterm terminal_output gfxterm
fi fi
@ -45,30 +57,22 @@ if serial --unit=0 --speed=115200; then
terminal_output --append serial_com0 terminal_output --append serial_com0
fi fi
if [ -s $prefix/grubenv ]; then function set_gfxpayload {
load_env if [ ${vesa_mode} -eq 1 ]; then
fi set gfxpayload=keep
if [ "${default}" ]; then else
set default="${default}" set gfxpayload=text
fi fi
if [ "${next_entry}" ]; then }
set default="${next_entry}"
set next_entry=
save_env next_entry
fi
if serial --unit=0 --speed=115200; then
terminal_input --append serial_com0
terminal_output --append serial_com0
fi
set TERM=tty2 set TERM=tty2
search --set=root --label "ARPL3" search --set=root --label "ARPL3"
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
if [ "${default}" = "direct" ]; then if [ "${default}" = "direct" ]; then
set timeout="1" set timeout="1"
menuentry 'Boot DSM kernel directly' --id direct { menuentry 'Boot DSM kernel directly' --id direct {
load_video set_gfxpayload
echo "Loading DSM kernel..." echo "Loading DSM kernel..."
linux /zImage-dsm console=ttyS0,115200n8 earlyprintk log_buf_len=32M earlycon=uart8250,io,0x3f8,115200n8 root=/dev/md0 loglevel=15 ${dsm_cmdline} linux /zImage-dsm console=ttyS0,115200n8 earlyprintk log_buf_len=32M earlycon=uart8250,io,0x3f8,115200n8 root=/dev/md0 loglevel=15 ${dsm_cmdline}
echo "Loading DSM initramfs..." echo "Loading DSM initramfs..."
@ -77,7 +81,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
} }
fi fi
menuentry 'Boot DSM' --id boot { menuentry 'Boot DSM' --id boot {
load_video set_gfxpayload
echo "Loading kernel..." echo "Loading kernel..."
linux /bzImage-arpl console=${TERM} net.ifnames=0 linux /bzImage-arpl console=${TERM} net.ifnames=0
echo "Loading initramfs..." echo "Loading initramfs..."
@ -85,22 +89,35 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
echo "Booting..." echo "Booting..."
} }
menuentry 'Force re-install DSM' --id junior { menuentry 'Force re-install DSM' --id junior {
load_video set_gfxpayload
echo "Loading kernel..." echo "Loading kernel..."
linux /bzImage-arpl console=${TERM} net.ifnames=0 force_junior linux /bzImage-arpl console=${TERM} net.ifnames=0 force_junior
echo "Loading initramfs..." echo "Loading initramfs..."
initrd /initrd-arpl initrd /initrd-arpl
echo "Booting..." echo "Booting..."
} }
else
set timeout="1"
fi fi
menuentry 'Configure loader' --id config { menuentry 'Configure loader' --id config {
load_video set_gfxpayload
echo "Loading kernel..." echo "Loading kernel..."
linux /bzImage-arpl console=${TERM} net.ifnames=0 IWANTTOCHANGETHECONFIG linux /bzImage-arpl console=${TERM} net.ifnames=0 IWANTTOCHANGETHECONFIG
echo "Loading initramfs..." echo "Loading initramfs..."
initrd /initrd-arpl initrd /initrd-arpl
echo "Booting..." echo "Booting..."
} }
if [ ${vesa_mode} = 1 ]; then
menuentry 'Change vesa to text video mode' --id videomode {
set vesa_mode=0
save_env vesa_mode
configfile ${prefix}/grub.cfg
}
else
menuentry 'Change text to vesa video mode' --id videomode {
set vesa_mode=1
save_env vesa_mode
reboot
configfile ${prefix}/grub.cfg
}
fi