summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2019-01-08 19:47:50 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2019-01-11 18:33:00 +0000
commitfc1df87e90014c3befa671e84631cd0c55751891 (patch)
tree52783c16ee39af560a18637d59510a7a147e3906
parent6bf04a5608c9537de46ab8655b5ea09263fa8eb1 (diff)
downloaddrakiso-fc1df87e90014c3befa671e84631cd0c55751891.tar
drakiso-fc1df87e90014c3befa671e84631cd0c55751891.tar.gz
drakiso-fc1df87e90014c3befa671e84631cd0c55751891.tar.bz2
drakiso-fc1df87e90014c3befa671e84631cd0c55751891.tar.xz
drakiso-fc1df87e90014c3befa671e84631cd0c55751891.zip
Default to using linux16 and linuxefi GRUB2 commands (mga#24137).
-rw-r--r--NEWS2
-rw-r--r--bootloader/Makefile6
-rw-r--r--lib/MGA/DrakISO/BuildBoot.pm33
3 files changed, 31 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index ee96f77..0b0c3d4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- default to using linux16 and linuxefi GRUB2 commands (mga#24137)
+
1.6:
- give the ESP partition a volume label, to work round mga#23939
diff --git a/bootloader/Makefile b/bootloader/Makefile
index 99e5ed9..188be0b 100644
--- a/bootloader/Makefile
+++ b/bootloader/Makefile
@@ -6,7 +6,7 @@ GRUB2_MODULES = iso9660 ext2 fat jfs reiserfs xfs \
part_apple part_bsd part_gpt part_msdos \
all_video font gfxterm gfxmenu png \
boot chain configfile echo gettext \
- linux linux16 ls search test
+ linux ls search test
GRUB_IMAGES = images/boot_hybrid.img images/eltorito.img
@@ -32,11 +32,11 @@ images/eltorito.img:
images/bootia32.efi:
@mkdir -p images
- grub2-mkimage --output $@ --prefix /EFI/BOOT --format i386-efi $(GRUB2_MODULES)
+ grub2-mkimage --output $@ --prefix /EFI/BOOT --format i386-efi $(GRUB2_MODULES) linux16
images/bootx64.efi:
@mkdir -p images
- grub2-mkimage --output $@ --prefix /EFI/BOOT --format x86_64-efi $(GRUB2_MODULES)
+ grub2-mkimage --output $@ --prefix /EFI/BOOT --format x86_64-efi $(GRUB2_MODULES) linuxefi
kbd-names%txt lang-kbds%txt:
./make-kbd-info
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm
index 2775203..ae84c34 100644
--- a/lib/MGA/DrakISO/BuildBoot.pm
+++ b/lib/MGA/DrakISO/BuildBoot.pm
@@ -300,7 +300,7 @@ sub build_grub2_boot_efi {
my ($output, $format) = @_;
my @modules = qw(iso9660 fat part_msdos all_video font gfxterm gfxmenu png
- configfile echo gettext linux linux16 ls search test);
+ configfile echo gettext linux linuxefi ls search test);
run_('grub2-mkimage',
'--output', $output,
@@ -320,6 +320,13 @@ sub build_grub2_cfg {
my $gettext = $add_lang_menu ? '$' : '';
+ my %initrd_command = (
+ 'linuxefi' => 'initrdefi',
+ 'linux16' => 'initrd16',
+ 'linux' => 'initrd',
+ '$linux' => '$initrd'
+ );
+
join("\n",
"if [ -z \$initialised ] ; then",
" set grub2=(\$root)/boot/grub2",
@@ -353,7 +360,18 @@ sub build_grub2_cfg {
" fi",
" export theme",
@loadfonts,
+ "",
),
+ " if [ x\$efi == 'xtrue' ] ; then",
+ " set linux=linuxefi",
+ " set initrd=initrdefi",
+ " else",
+ " set linux=linux16",
+ " set initrd=initrd16",
+ " fi",
+ " export linux",
+ " export initrd",
+ "",
" set initialised=true",
" export initialised",
"fi",
@@ -379,24 +397,25 @@ sub build_grub2_cfg {
),
(map {
my ($name, $options) = @$_;
- my $command = $options->{command} || 'linux';
+ my $command = $options->{command} || '$linux';
my $image = $options->{image} || get_default_image($build, $name);
my $initrd = $options->{initrd} || get_default_initrd($build);
my $append = $options->{append};
- my $initrd_command = $command eq 'linux16 ' ? 'initrd16' : 'initrd';
-
join("\n",
+ if_($command eq 'linuxefi',
+ "if [ x\$efi == 'xtrue' ] ; then", # EFI only
+ ),
if_($command eq 'linux16',
"if [ x\$efi != 'xtrue' ] ; then", # EFI doesn't support 16-bit
),
"menuentry $gettext\"$name\" {",
" $command $image " . join(' ', get_default_append($build), $append),
- if_($initrd ne 'none',
- " $initrd_command $initrd",
+ if_($initrd ne 'none' && defined $initrd_command{$command},
+ " $initrd_command{$command} $initrd",
),
"}",
- if_($command eq 'linux16',
+ if_($command eq 'linuxefi' || $command eq 'linux16',
"fi",
),
);