Permalink
Browse files

- store the mbrid file in /boot and not in /boot/grub. The location

  is misleading if another than the grub bootmanager is used
  • Loading branch information...
1 parent 32949b2 commit 2bdc5f3dcb17dd706149dbd216c91dd738e5adc8 @schaefi schaefi committed Jul 23, 2012
Showing with 27 additions and 82 deletions.
  1. +20 −75 modules/KIWIBoot.pm
  2. +1 −1 modules/KIWIImage.pm
  3. +6 −6 modules/KIWILinuxRC.sh
View
@@ -2499,8 +2499,8 @@ sub setupInstallFlags {
# Include MBR ID to initrd
#------------------------------------------
my $FD;
- qxx ("mkdir -p $irddir/boot/grub");
- if (! open ($FD, '>', "$irddir/boot/grub/mbrid")) {
+ qxx ("mkdir -p $irddir/boot");
+ if (! open ($FD, '>', "$irddir/boot/mbrid")) {
$kiwi -> error ("Couldn't create mbrid file: $!");
$kiwi -> failed ();
qxx ("rm -rf $irddir");
@@ -2838,9 +2838,7 @@ sub setupBootLoaderStages {
#==========================================
# Boot directories
#------------------------------------------
- my @bootdir = (
- "$tmpdir/boot/grub"
- );
+ my @bootdir = ();
if ($efi) {
push @bootdir,"$tmpdir/boot/grub2-efi/$efipc";
push @bootdir,"$tmpdir/boot/grub2/$grubpc";
@@ -3268,14 +3266,27 @@ sub setupBootLoaderConfiguration {
$cmdline .= " showopts\n";
# ensure exactly one space at start
$cmdline =~ s/^\s*/ /;
-
#==========================================
# Check boot partition number
#------------------------------------------
if (! defined $bootpart) {
$bootpart = 0;
}
#==========================================
+ # Create MBR id file for boot device check
+ #------------------------------------------
+ $kiwi -> info ("Saving disk label boot/mbrid: $this->{mbrid}...");
+ qxx ("mkdir -p $tmpdir/boot");
+ if (! open (FD,">$tmpdir/boot/mbrid")) {
+ $kiwi -> failed ();
+ $kiwi -> error ("Couldn't create mbrid file: $!");
+ $kiwi -> failed ();
+ return;
+ }
+ print FD "$this->{mbrid}";
+ close FD;
+ $kiwi -> done();
+ #==========================================
# Grub2
#------------------------------------------
if ($loader eq "grub2") {
@@ -3335,23 +3346,11 @@ sub setupBootLoaderConfiguration {
$vesa{'0x31a'} = ["1280x1024x24", "1280x1024"];
$vesa{'0x31b'} = ["1280x1024x32", "1280x1024"];
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create grub.cfg file
#------------------------------------------
$kiwi -> info ("Creating grub2 configuration file...");
foreach my $config (@config) {
+ qxx ("mkdir -p $tmpdir/boot/$config");
if (! open (FD,">$tmpdir/boot/$config/grub.cfg")) {
$kiwi -> failed ();
$kiwi -> error ("Couldn't create $config/grub.cfg: $!");
@@ -3533,22 +3532,10 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader eq "grub") {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create menu.lst file
#------------------------------------------
$kiwi -> info ("Creating grub menu list file...");
+ qxx ("mkdir -p $tmpdir/boot/grub");
if (! open (FD,">$tmpdir/boot/grub/menu.lst")) {
$kiwi -> failed ();
$kiwi -> error ("Couldn't create menu.lst: $!");
@@ -3727,20 +3714,6 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader =~ /(sys|ext)linux/) {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- qxx ("mkdir -p $tmpdir/boot/grub");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create syslinux config file
#------------------------------------------
my $syslconfig = "syslinux.cfg";
@@ -3936,23 +3909,9 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader eq "zipl") {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- qxx ("mkdir -p $tmpdir/boot/grub");
- qxx ("mkdir -p $tmpdir/boot/zipl");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create zipl.conf
#------------------------------------------
+ qxx ("mkdir -p $tmpdir/boot/zipl");
$cmdline =~ s/\n//g;
my $ziplconfig = "zipl.conf";
$kiwi -> info ("Creating $ziplconfig config file...");
@@ -4131,20 +4090,6 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader eq "uboot") {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- qxx ("mkdir -p $tmpdir/boot/grub");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create uboot image file from initrd
#------------------------------------------
$kiwi -> info ("Creating uBoot initrd image...");
@@ -1937,7 +1937,7 @@ sub createImageLiveCD {
$kiwi -> info ("Saving hybrid disk label in initrd: $this->{mbrid}...");
qxx ("mkdir -p $tmpdir/boot/grub");
my $FD;
- if (! open ($FD, '>', "$tmpdir/boot/grub/mbrid")) {
+ if (! open ($FD, '>', "$tmpdir/boot/mbrid")) {
$kiwi -> failed ();
$kiwi -> error ("Couldn't create mbrid file: $!");
$kiwi -> failed ();
@@ -730,7 +730,7 @@ function installBootLoader {
esac
masterBootID=$(printf 0x%04x%04x $RANDOM $RANDOM)
Echo "writing new MBR ID to master boot record: $masterBootID"
- echo $masterBootID > /boot/grub/mbrid
+ echo $masterBootID > /boot/mbrid
masterBootIDHex=$(echo $masterBootID |\
sed 's/^0x\(..\)\(..\)\(..\)\(..\)$/\\x\4\\x\3\\x\2\\x\1/')
echo -e -n $masterBootIDHex | dd of=$imageDiskDevice \
@@ -3201,12 +3201,12 @@ function searchImageISODevice {
local isofrom_device
local isofrom_system
mkdir -p /cdrom
- if [ ! -f /boot/grub/mbrid ];then
+ if [ ! -f /boot/mbrid ];then
systemException \
"Can't find MBR id file in initrd" \
"reboot"
fi
- mbrIID=$(cat /boot/grub/mbrid)
+ mbrIID=$(cat /boot/mbrid)
Echo -n "Searching for boot device in Application ID..."
udevPending
#======================================
@@ -3482,8 +3482,8 @@ function storeIDFiles {
if ! mount -o ro $dev /mnt;then
continue
fi
- if [ -f /mnt/boot/grub/mbrid ];then
- cp -a /mnt/boot/grub/mbrid $cmpd/mbrid$ifix
+ if [ -f /mnt/boot/mbrid ];then
+ cp -a /mnt/boot/mbrid $cmpd/mbrid$ifix
ifix=$((ifix + 1))
umount /mnt
break
@@ -6000,7 +6000,7 @@ function bootImage {
# copy boot log file into system image
#--------------------------------------
mkdir -p /mnt/var/log
- rm -f /mnt/boot/grub/mbrid
+ rm -f /mnt/boot/mbrid
if [ -e /mnt/dev/shm/initrd.msg ];then
cp -f /mnt/dev/shm/initrd.msg /mnt/var/log/boot.msg
fi

0 comments on commit 2bdc5f3

Please sign in to comment.