From 193e14a489ff663ce3039244c8864c811a558e58 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 6 Jun 2018 13:01:54 +0200 Subject: [PATCH] grub2: avoid switching modes to reduce flickering during boot Issue #2778 --- repos/base-nova/src/core/platform.cc | 9 +++++++++ repos/base/ports/grub2.hash | 2 +- repos/base/ports/grub2.port | 2 +- tool/run/boot_dir/nova | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc index 616f3fa30..0f9c3c6e2 100644 --- a/repos/base-nova/src/core/platform.cc +++ b/repos/base-nova/src/core/platform.cc @@ -490,11 +490,17 @@ Platform::Platform() : Hip::Mem_desc *boot_fb = nullptr; + bool efi_boot = false; + /* * All "available" ram must be added to our physical allocator before all * non "available" regions that overlaps with ram get removed. */ for (unsigned i = 0; i < num_mem_desc; i++, mem_desc++) { + /* 32/64bit EFI image handle pointer - see multiboot spec 2 */ + if (mem_desc->type == 20 || mem_desc->type == 19) + efi_boot = true; + if (mem_desc->type == Hip::Mem_desc::FRAMEBUFFER) boot_fb = mem_desc; if (mem_desc->type != Hip::Mem_desc::AVAILABLE_MEMORY) continue; @@ -675,6 +681,9 @@ Platform::Platform() : if (!boot_fb) return; + if (!efi_boot) + return; + xml.node("framebuffer", [&] () { xml.attribute("phys", String<32>(Hex(boot_fb->addr))); xml.attribute("width", Resolution::Width::get(boot_fb->size)); diff --git a/repos/base/ports/grub2.hash b/repos/base/ports/grub2.hash index ad3a4940c..d8e31f5a0 100644 --- a/repos/base/ports/grub2.hash +++ b/repos/base/ports/grub2.hash @@ -1 +1 @@ -e1b6f0ea55b716ef8548fbf416ec503a5d31a09d +8cf62c015199b37018676d8c13be026989724a4b diff --git a/repos/base/ports/grub2.port b/repos/base/ports/grub2.port index 67161c80d..7149299d6 100644 --- a/repos/base/ports/grub2.port +++ b/repos/base/ports/grub2.port @@ -3,7 +3,7 @@ VERSION := git DOWNLOADS := g2fg.git URL(g2fg) := https://github.com/alex-ab/g2fg.git -REV(g2fg) := cf35a6e5dc35a9b1961f66cd37cb1d4c23309832 +REV(g2fg) := 1b148c6479f2c1f96fa1a1ae66c8cd3bbae538f2 DIR(g2fg) := boot default: $(DOWNLOADS) diff --git a/tool/run/boot_dir/nova b/tool/run/boot_dir/nova index 694b006af..995018514 100644 --- a/tool/run/boot_dir/nova +++ b/tool/run/boot_dir/nova @@ -107,8 +107,8 @@ proc run_boot_dir {binaries} { # puts $fh "loadfont /boot/grub/unicode.pf2" puts $fh "set timeout=0" - # tell grub2 to prefer 32bit framebuffer resolution - puts $fh "set gfxpayload=\"0x0x32\"" + # choose best graphic mode + puts $fh "set gfxpayload=auto" if {[have_include image/uefi]} { puts $fh "insmod gfxterm"