gitee.com/mysnapcore/mysnapd@v0.1.0/bootloader/assets/data/grub.cfg (about) 1 # Snapd-Boot-Config-Edition: 3 2 3 set default=0 4 set timeout=3 5 set timeout_style=hidden 6 7 # load only kernel_status and kernel command line variables set by snapd from 8 # the bootenv 9 load_env --file /EFI/ubuntu/grubenv kernel_status snapd_extra_cmdline_args snapd_full_cmdline_args 10 11 set snapd_static_cmdline_args='panic=-1' 12 if [ "$grub_cpu" = "x86_64" ]; then 13 set snapd_static_cmdline_args='console=ttyS0,115200n8 console=tty1 panic=-1' 14 fi 15 set cmdline_args="$snapd_static_cmdline_args $snapd_extra_cmdline_args" 16 if [ -n "$snapd_full_cmdline_args" ]; then 17 set cmdline_args="$snapd_full_cmdline_args" 18 fi 19 20 set kernel=kernel.efi 21 22 if [ "$kernel_status" = "try" ]; then 23 # a new kernel got installed 24 set kernel_status="trying" 25 save_env kernel_status 26 # run fallback (menu entry #1) if we cannot start the kernel 27 set fallback=1 28 29 # use try-kernel.efi 30 set kernel=try-kernel.efi 31 elif [ "$kernel_status" = "trying" ]; then 32 # nothing cleared the "trying snap" so the boot failed 33 # we clear the mode and boot normally 34 set kernel_status="" 35 save_env kernel_status 36 elif [ -n "$kernel_status" ]; then 37 # ERROR invalid kernel_status state, reset to empty 38 echo "invalid kernel_status!!!" 39 echo "resetting to empty" 40 set kernel_status="" 41 save_env kernel_status 42 fi 43 44 menuentry "Run Ubuntu Core" { 45 # use $prefix because the symlink manipulation at runtime for kernel snap 46 # upgrades, etc. should only need the /boot/grub/ directory, not the 47 # /EFI/ubuntu/ directory 48 chainloader $prefix/$kernel snapd_recovery_mode=run $cmdline_args 49 } 50 menuentry "Fallback on failed update" { 51 # kernel_status has already been set to "trying", rebooting now 52 # will fail the pending kernel update. Note that we cannot simply 53 # chainload the fallback kernel as TPM measurements need to be 54 # cleaned-up to be able to unseal the key. 55 echo "Cannot start new kernel - booting previous one" 56 reboot 57 }