Mageia Bugzilla – Attachment 11074 Details for
Bug 24908
Installer hangs at end of bootloader install step on some Lenovo machines (BIOS bug when writing to EFI NVRAM?)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Script to test writing the rEFInd PreviousBoot NVRAM variable
set-last-boot.pl (text/plain), 1.09 KB, created by
Martin Whitaker
on 2019-06-08 12:47:58 CEST
(
hide
)
Description:
Script to test writing the rEFInd PreviousBoot NVRAM variable
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2019-06-08 12:47:58 CEST
Size:
1.09 KB
patch
obsolete
>#!/bin/perl > >use lib qw(/usr/lib/libDrakX); > >use MDK::Common; > >sub run { > my ($name, @args) = @_; > print "$name @args\n"; > system($name, @args); >} > >my $default_kernel = readlink("$::prefix/boot/vmlinuz"); >if ($default_kernel) { > my $efivars = '/sys/firmware/efi/efivars'; > my $already_mounted = cat_('/proc/mounts') =~ /$efivars/; > run('mount', '-t', 'efivarfs', 'none', $efivars) if !$already_mounted; > my $previous_boot = "$efivars/PreviousBoot-36d08fa7-cf0b-42f5-8f14-68df73ed3740"; > run('chattr', '-i', $previous_boot) if -e $previous_boot; > if (open(my $efivar, '>:raw', $previous_boot)) { > require Encode; > print "writing rEFInd PreviousBoot variable\n"; > print $efivar "\x07\x00\x00\x00"; > print $efivar Encode::encode('UTF16-LE', $default_kernel); > print $efivar "\x00\x00"; > close($efivar); > print "rEFInd PreviousBoot variable written\n"; > } else { > print "failed to write rEFInd PreviousBoot variable: $@ ($!)\n"; > } > run('umount', $efivars) if !$already_mounted; >} else { > print "default kernel name not found\n"; >}
#!/bin/perl use lib qw(/usr/lib/libDrakX); use MDK::Common; sub run { my ($name, @args) = @_; print "$name @args\n"; system($name, @args); } my $default_kernel = readlink("$::prefix/boot/vmlinuz"); if ($default_kernel) { my $efivars = '/sys/firmware/efi/efivars'; my $already_mounted = cat_('/proc/mounts') =~ /$efivars/; run('mount', '-t', 'efivarfs', 'none', $efivars) if !$already_mounted; my $previous_boot = "$efivars/PreviousBoot-36d08fa7-cf0b-42f5-8f14-68df73ed3740"; run('chattr', '-i', $previous_boot) if -e $previous_boot; if (open(my $efivar, '>:raw', $previous_boot)) { require Encode; print "writing rEFInd PreviousBoot variable\n"; print $efivar "\x07\x00\x00\x00"; print $efivar Encode::encode('UTF16-LE', $default_kernel); print $efivar "\x00\x00"; close($efivar); print "rEFInd PreviousBoot variable written\n"; } else { print "failed to write rEFInd PreviousBoot variable: $@ ($!)\n"; } run('umount', $efivars) if !$already_mounted; } else { print "default kernel name not found\n"; }
View Attachment As Raw
Actions:
View
Attachments on
bug 24908
:
11064
|
11066
|
11067
| 11074