diff --git a/files/mnt/p1/boot/grub/grub.cfg b/files/mnt/p1/boot/grub/grub.cfg index 24bcf2a5..bd7d102c 100644 --- a/files/mnt/p1/boot/grub/grub.cfg +++ b/files/mnt/p1/boot/grub/grub.cfg @@ -1,57 +1,84 @@ -set default="boot" + set timeout="5" set timeout_style="menu" -set pager=1 -set vesa_mode=1 -set color_normal=white/black -set menu_color_normal=light-cyan/black -set menu_color_highlight=black/cyan if [ -s ${prefix}/grubenv ]; then load_env --skip-sig 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 - -terminal_input console -terminal_output console - -if [ "${feature_all_video_module}" = "y" ]; then - insmod all_video else - insmod efi_gop - insmod efi_uga - insmod vbe - insmod vga - insmod video_bochs - insmod video_cirrus + set default="boot" fi -if loadfont unicode; then - set gfxmode=auto - terminal_output gfxterm +if [ "${linux_gfx_mode}" ]; then + save_env linux_gfx_mode +else + set linux_gfx_mode=keep + save_env linux_gfx_mode fi +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +function load_video { + if [ x"${feature_all_video_module}" = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +if [ x"${feature_default_font_path}" = xy ]; then + font=unicode +else + font=${prefix}/fonts/unicode.pf2 +fi + +if loadfont ${font}; then + set gfxmode=auto + load_video + insmod gfxterm + set locale_dir=$prefix/locale + set lang=en_US + insmod gettext +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 fi +set color_normal=white/black +set menu_color_normal=light-cyan/black +set menu_color_highlight=black/cyan + insmod png background_image ${prefix}/logo.png -function set_gfxpayload { - if [ ${vesa_mode} -eq 1 ]; then - set gfxpayload=keep - else - set gfxpayload=text - fi +function gfxmode { + set gfxpayload="${linux_gfx_mode}" + if [ "${linux_gfx_mode}" = "keep" ]; then + set vt_handoff=vt.handoff=7 + else + set vt_handoff= + fi } 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" @@ -60,9 +87,8 @@ search --set=root --label "RR3" if [ -s /zImage-dsm -a -s /initrd-dsm ]; then if [ "${default}" = "direct" ]; then set timeout="1" - set pager=0 - menuentry 'Boot DSM kernel directly' --id direct { - set_gfxpayload + menuentry 'Boot DSM kernel directly' ${menuentry_id_option} direct { + gfxmode echo "RRVersion: ${rr_version}" echo "${rr_booting}" echo -n "Boot Time: "; date @@ -86,8 +112,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then echo "Access http://find.synology.com/ to connect the DSM via web." } fi - menuentry 'Boot DSM' --id boot { - set_gfxpayload + menuentry 'Boot DSM' ${menuentry_id_option} boot { + gfxmode echo "Loading kernel..." linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} echo "Loading initramfs..." @@ -98,8 +124,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then fi echo "Booting..." } - menuentry 'Boot Recovery' --id recovery { - set_gfxpayload + menuentry 'Boot Recovery' ${menuentry_id_option} recovery { + gfxmode echo "Loading kernel..." linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} recovery echo "Loading initramfs..." @@ -110,8 +136,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then fi echo "Booting..." } - menuentry 'Force re-install DSM' --id junior { - set_gfxpayload + menuentry 'Force re-install DSM' ${menuentry_id_option} junior { + gfxmode echo "Loading kernel..." linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} force_junior echo "Loading initramfs..." @@ -124,8 +150,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then } fi -menuentry 'Configure loader' --id config { - set_gfxpayload +menuentry 'Configure loader' ${menuentry_id_option} config { + gfxmode echo "Loading kernel..." linux /bzImage-rr ${RR_CMDLINE} ${rr_cmdline} IWANTTOCHANGETHECONFIG echo "Loading initramfs..." @@ -137,26 +163,33 @@ menuentry 'Configure loader' --id config { echo "Booting..." } -menuentry 'Enter BIOS Setup' --id bios { - fwsetup -} +if [ "${grub_platform}" = "efi" ]; then + insmod bli + fwsetup --is-supported + if [ "$?" = 0 ]; then + menuentry 'UEFI Firmware Settings' ${menuentry_id_option} uefi { + fwsetup + } + fi +fi -menuentry 'Start Memtest86+' --id memtest { - echo "Loading memtest86+..." - linux ${prefix}/memtest -} +if [ -e ${prefix}/memtest ]; then + menuentry 'Start Memtest86+' ${menuentry_id_option} memtest { + echo "Loading memtest86+..." + linux ${prefix}/memtest + } +fi -if [ ${vesa_mode} = 1 ]; then - menuentry 'Change vesa to text video mode' --id videomode { - set vesa_mode=0 - save_env vesa_mode +if [ "${linux_gfx_mode}" = "keep" ]; then + menuentry 'Change vesa to text video mode' ${menuentry_id_option} videomode { + set linux_gfx_mode=text + save_env linux_gfx_mode configfile ${prefix}/grub.cfg } else - menuentry 'Change text to vesa video mode' --id videomode { - set vesa_mode=1 - save_env vesa_mode - reboot + menuentry 'Change text to vesa video mode' ${menuentry_id_option} videomode { + set linux_gfx_mode=keep + save_env linux_gfx_mode configfile ${prefix}/grub.cfg } fi