Mageia Bugzilla – Attachment 9823 Details for
Bug 21246
Video mode selection in drakboot is ignored when using grub2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Proposed fix v2
0002-Fix-drakboot-video-mode-selection-when-using-grub2-m.patch (text/plain), 4.02 KB, created by
Martin Whitaker
on 2017-12-08 10:13:57 CET
(
hide
)
Description:
Proposed fix v2
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2017-12-08 10:13:57 CET
Size:
4.02 KB
patch
obsolete
>From 9bf25681dc128b437235ab13e41e4376e0a59e14 Mon Sep 17 00:00:00 2001 >From: Martin Whitaker <mageia@martin-whitaker.me.uk> >Date: Mon, 24 Jul 2017 23:07:38 +0100 >Subject: [PATCH 2/5] Fix drakboot video mode selection when using grub2 > (mga#21246) > >The video mode needs to be extracted from and written back to the >GRUB_CMDLINE_LINUX_DEFAULT parameter in /etc/defaults/grub2. > >This fix creates a new "default_vga" key in the $bootloader hash to >hold the current selection. Using the existing "vga" key would cause >the default video mode to be added to any bootloader entries that >don't have a specific "vga" value, e.g. the "failsafe" entry. > >The $bootloader "vga" value doesn't appear to be set anywhere else, >so may in fact be obsolete. > >diff --git a/perl-install/any.pm b/perl-install/any.pm >index 376240aac..a82fce94a 100644 >--- a/perl-install/any.pm >+++ b/perl-install/any.pm >@@ -632,7 +632,7 @@ sub setupBootloader__grub2 { > require Xconfig::resolution_and_depth; > > require network::network; #- to list network profiles >- my $vga = Xconfig::resolution_and_depth::from_bios($b->{vga}); >+ my $vga = Xconfig::resolution_and_depth::from_bios($b->{default_vga}); > my $os_prober = $in->do_pkgs->is_installed('os-prober', '/usr/bin/os-prober'); > > my $res = $in->ask_from_( >@@ -660,7 +660,7 @@ sub setupBootloader__grub2 { > if ($res) { > $b->{entries} = $b2->{entries}; > $b->{default} = $default; >- $b->{vga} = ref($vga) ? $vga->{bios} : $vga; >+ $b->{default_vga} = ref($vga) ? $vga->{bios} : $vga; > $b->{perImageAppend} = $append; > if ($os_prober) { > $in->do_pkgs->ensure_is_installed('os-prober', '/usr/bin/os-prober'); >diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm >index 6af1f1680..f749a8561 100644 >--- a/perl-install/bootloader.pm >+++ b/perl-install/bootloader.pm >@@ -278,6 +278,8 @@ sub read_ { > $bootloader->{default_options} = $default; > $bootloader->{perImageAppend} ||= $default->{append}; > log::l("perImageAppend is now $bootloader->{perImageAppend}"); >+ $bootloader->{default_vga} ||= $default->{vga}; >+ log::l("default_vga is now $bootloader->{default_vga}"); > } else { > $bootloader->{default_options} = {}; > } >@@ -307,8 +309,10 @@ sub read_grub2() { > return if is_empty_hash_ref(\%bootloader) & !-s "$::prefix/boot/grub2/grub.cfg"; > my %h = getVarsFromSh("$::prefix/etc/default/grub"); > $bootloader{timeout} = $h{GRUB_TIMEOUT}; >- # keep suggested perImageAppend on first run (during installer) or when migrating from grub-legacy or lilo: >- $bootloader{perImageAppend} ||= $h{GRUB_CMDLINE_LINUX_DEFAULT}; >+ # keep suggested perImageAppend and default_vga on first run (during installer) or when migrating from grub-legacy or lilo: >+ my ($vga, $other) = partition { /^vga=/ } split(' ', $h{GRUB_CMDLINE_LINUX_DEFAULT}); >+ $bootloader{perImageAppend} ||= join(' ', @$other) if @$other; >+ $bootloader{default_vga} ||= $vga->[0] =~ /vga=(.*)/ && $1 if @$vga; > $bootloader{entries} = []; > my $entry; > my $f = "$::prefix/boot/grub2/grub.cfg"; >@@ -1229,6 +1233,7 @@ sub suggest { > method_choices($all_hds, 0)); # or best if no valid one is installed > > $bootloader->{perImageAppend} = $bootloader->{entries}[0]{append}; >+ $bootloader->{default_vga} = $options{vga_fb}; > > if (main_method($bootloader->{method}) eq 'grub') { > my %processed_entries = {}; >@@ -1865,7 +1870,11 @@ sub write_grub2_sysconfig { > my $f = "$::prefix/etc/default/grub"; > my %conf = getVarsFromSh($f); > >- $conf{GRUB_CMDLINE_LINUX_DEFAULT} = $bootloader->{perImageAppend} || get_grub2_append($bootloader); >+ my $append = $bootloader->{perImageAppend} || get_grub2_append($bootloader); >+ my $vga = $bootloader->{default_vga}; >+ $append .= " vga=$vga" if $append !~ /vga=/ && $vga && $vga ne "normal"; >+ >+ $conf{GRUB_CMDLINE_LINUX_DEFAULT} = $append; > $conf{GRUB_GFXPAYLOAD_LINUX} = 'auto' if is_uefi(); > $conf{GRUB_DISABLE_RECOVERY} = 'false'; # for 'failsafe' entry > $conf{GRUB_DEFAULT} //= 'saved'; # for default entry but do not overwrite user choice >-- >2.13.6 >
From 9bf25681dc128b437235ab13e41e4376e0a59e14 Mon Sep 17 00:00:00 2001 From: Martin Whitaker <mageia@martin-whitaker.me.uk> Date: Mon, 24 Jul 2017 23:07:38 +0100 Subject: [PATCH 2/5] Fix drakboot video mode selection when using grub2 (mga#21246) The video mode needs to be extracted from and written back to the GRUB_CMDLINE_LINUX_DEFAULT parameter in /etc/defaults/grub2. This fix creates a new "default_vga" key in the $bootloader hash to hold the current selection. Using the existing "vga" key would cause the default video mode to be added to any bootloader entries that don't have a specific "vga" value, e.g. the "failsafe" entry. The $bootloader "vga" value doesn't appear to be set anywhere else, so may in fact be obsolete. diff --git a/perl-install/any.pm b/perl-install/any.pm index 376240aac..a82fce94a 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -632,7 +632,7 @@ sub setupBootloader__grub2 { require Xconfig::resolution_and_depth; require network::network; #- to list network profiles - my $vga = Xconfig::resolution_and_depth::from_bios($b->{vga}); + my $vga = Xconfig::resolution_and_depth::from_bios($b->{default_vga}); my $os_prober = $in->do_pkgs->is_installed('os-prober', '/usr/bin/os-prober'); my $res = $in->ask_from_( @@ -660,7 +660,7 @@ sub setupBootloader__grub2 { if ($res) { $b->{entries} = $b2->{entries}; $b->{default} = $default; - $b->{vga} = ref($vga) ? $vga->{bios} : $vga; + $b->{default_vga} = ref($vga) ? $vga->{bios} : $vga; $b->{perImageAppend} = $append; if ($os_prober) { $in->do_pkgs->ensure_is_installed('os-prober', '/usr/bin/os-prober'); diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 6af1f1680..f749a8561 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -278,6 +278,8 @@ sub read_ { $bootloader->{default_options} = $default; $bootloader->{perImageAppend} ||= $default->{append}; log::l("perImageAppend is now $bootloader->{perImageAppend}"); + $bootloader->{default_vga} ||= $default->{vga}; + log::l("default_vga is now $bootloader->{default_vga}"); } else { $bootloader->{default_options} = {}; } @@ -307,8 +309,10 @@ sub read_grub2() { return if is_empty_hash_ref(\%bootloader) & !-s "$::prefix/boot/grub2/grub.cfg"; my %h = getVarsFromSh("$::prefix/etc/default/grub"); $bootloader{timeout} = $h{GRUB_TIMEOUT}; - # keep suggested perImageAppend on first run (during installer) or when migrating from grub-legacy or lilo: - $bootloader{perImageAppend} ||= $h{GRUB_CMDLINE_LINUX_DEFAULT}; + # keep suggested perImageAppend and default_vga on first run (during installer) or when migrating from grub-legacy or lilo: + my ($vga, $other) = partition { /^vga=/ } split(' ', $h{GRUB_CMDLINE_LINUX_DEFAULT}); + $bootloader{perImageAppend} ||= join(' ', @$other) if @$other; + $bootloader{default_vga} ||= $vga->[0] =~ /vga=(.*)/ && $1 if @$vga; $bootloader{entries} = []; my $entry; my $f = "$::prefix/boot/grub2/grub.cfg"; @@ -1229,6 +1233,7 @@ sub suggest { method_choices($all_hds, 0)); # or best if no valid one is installed $bootloader->{perImageAppend} = $bootloader->{entries}[0]{append}; + $bootloader->{default_vga} = $options{vga_fb}; if (main_method($bootloader->{method}) eq 'grub') { my %processed_entries = {}; @@ -1865,7 +1870,11 @@ sub write_grub2_sysconfig { my $f = "$::prefix/etc/default/grub"; my %conf = getVarsFromSh($f); - $conf{GRUB_CMDLINE_LINUX_DEFAULT} = $bootloader->{perImageAppend} || get_grub2_append($bootloader); + my $append = $bootloader->{perImageAppend} || get_grub2_append($bootloader); + my $vga = $bootloader->{default_vga}; + $append .= " vga=$vga" if $append !~ /vga=/ && $vga && $vga ne "normal"; + + $conf{GRUB_CMDLINE_LINUX_DEFAULT} = $append; $conf{GRUB_GFXPAYLOAD_LINUX} = 'auto' if is_uefi(); $conf{GRUB_DISABLE_RECOVERY} = 'false'; # for 'failsafe' entry $conf{GRUB_DEFAULT} //= 'saved'; # for default entry but do not overwrite user choice -- 2.13.6
View Attachment As Raw
Actions:
View
Attachments on
bug 21246
:
9514
| 9823