From 2cf3508433c323d88aafff3d961e956f669da7db Mon Sep 17 00:00:00 2001 From: alberand Date: Sat, 20 Mar 2021 09:15:03 +0100 Subject: [PATCH] Move grub.cfg to the default location The default path grub is looking for its config is /boot/grub/grub.cfg. --- README.pod | 6 +++++- novaboot | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.pod b/README.pod index 039a1eb..dff5ae6 100644 --- a/README.pod +++ b/README.pod @@ -371,10 +371,14 @@ Alias for B<--prefix>. =item --grub2[=I] Generate GRUB2 menu entry in I. If I is not -specified F is used. The content of the menu entry can be +specified F<./boot/grub/grub.cfg> is used. The content of the menu entry can be customized with B<--grub-preamble>, B<--grub2-prolog> or B<--grub_prefix> options. +GRUB2 can boot multiboot-compliant kernels and a few kernels with specific +support. L could be used to specify the command used by GRUB2 to +load the kernel. See L. + To use the generated menu entry on your development machine that uses GRUB2, append the following snippet to F file and regenerate your grub configuration, diff --git a/novaboot b/novaboot index abd5b9c..7e0bcb6 100755 --- a/novaboot +++ b/novaboot @@ -22,6 +22,7 @@ use Getopt::Long qw(GetOptionsFromString GetOptionsFromArray); use Pod::Usage; use File::Basename; use File::Spec; +use File::Path qw(make_path); use IO::Handle; use Time::HiRes("usleep"); use Socket; @@ -347,7 +348,7 @@ if (defined $serial) { $ENV{NB_SERIAL} = $serial; } if (defined $grub_config) { $grub_config ||= "menu.lst"; } -if (defined $grub2_config) { $grub2_config ||= "grub.cfg"; } +if (defined $grub2_config) { $grub2_config ||= "./boot/grub/grub.cfg"; } ## Parse the novaboot script(s) my @scripts; @@ -569,6 +570,10 @@ sub generate_grub2_config($$$$;$$) { my ($filename, $title, $base, $modules_ref, $preamble, $prolog) = @_; if ($base && substr($base,-1,1) ne '/') { $base = "$base/"; }; + my $dir = dirname($filename); + make_path($dir, { + chmod => 0755, + }); open(my $fg, '>', $filename) or die "$filename: $!"; print $fg "$preamble\n" if $preamble; $title ||= 'novaboot'; @@ -1730,7 +1735,7 @@ Alias for B<--prefix>. =item --grub2[=I] Generate GRUB2 menu entry in I. If I is not -specified F is used. The content of the menu entry can be +specified F<./boot/grub/grub.cfg> is used. The content of the menu entry can be customized with B<--grub-preamble>, B<--grub2-prolog> or B<--grub_prefix> options. -- 2.39.2