summaryrefslogtreecommitdiffstats
path: root/lib/MGA
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MGA')
-rw-r--r--lib/MGA/DrakISO/BuildBoot.pm33
1 files changed, 26 insertions, 7 deletions
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",
),
);