Author: juhliarik Date: Mon Jun 9 13:33:21 2008 New Revision: 48160 URL: http://svn.opensuse.org/viewcvs/yast?rev=48160&view=rev Log: added fix for problem with Vista booting bnc #396444 M bootloader/src/grub/misc.ycp * added saved MBR to /var/log/YaST2 * replace only 440B in MBR for generic code M bootloader/src/routines/misc.ycp * replace only 440B in MBR for generic code M bootloader/src/routines/lilolike.ycp * added saved MBR to /var/log/YaST2 M bootloader/scripts/examine_mbr.pl * detect Vista in MBR Modified: branches/SuSE-Linux-11_0-Branch/bootloader/scripts/examine_mbr.pl branches/SuSE-Linux-11_0-Branch/bootloader/src/grub/misc.ycp branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/lilolike.ycp branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/misc.ycp Modified: branches/SuSE-Linux-11_0-Branch/bootloader/scripts/examine_mbr.pl URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/bootloader/scripts/examine_mbr.pl?rev=48160&r1=48159&r2=48160&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/bootloader/scripts/examine_mbr.pl (original) +++ branches/SuSE-Linux-11_0-Branch/bootloader/scripts/examine_mbr.pl Mon Jun 9 13:33:21 2008 @@ -66,7 +66,7 @@ if (substr($MBR, 320, 126) =~ m,invalid partition table.*Error loading operating system,i) { print "Vista MBR\n"; - exit 200; + exit 0; } Modified: branches/SuSE-Linux-11_0-Branch/bootloader/src/grub/misc.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/bootloader/src/grub/misc.ycp?rev=48160&r1=48159&r2=48160&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/bootloader/src/grub/misc.ycp (original) +++ branches/SuSE-Linux-11_0-Branch/bootloader/src/grub/misc.ycp Mon Jun 9 13:33:21 2008 @@ -274,6 +274,8 @@ string device_file = mergestring (splitstring (device, "/"), "_"); string device_file_path = "/var/lib/YaST2/backup_boot_sectors/" + device_file; + string device_file_path_to_logs = "/var/log/YaST2/" + + device_file; SCR::Execute (.target.bash, "test -d /var/lib/YaST2/backup_boot_sectors || mkdir /var/lib/YaST2/backup_boot_sectors"); if (SCR::Read (.target.size, device_file_path) > 0) @@ -298,6 +300,10 @@ SCR::Execute (.target.bash, sformat ( "/bin/dd if=%1 of=%2 bs=512 count=1 2>&1", device, device_file_path)); + // save MBR to yast2 log directory + SCR::Execute (.target.bash, sformat ( + "/bin/dd if=%1 of=%2 bs=512 count=1 2>&1", + device, device_file_path_to_logs)); if (device == BootCommon::mbrDisk) { SCR::Execute (.target.bash, sformat ( @@ -352,8 +358,9 @@ list<string> disks_to_rewrite = grub_getMbrsToRewrite (); foreach (string d, disks_to_rewrite, { y2milestone ("Copying generic MBR code to %1", d); + // added fix 446 -> 440 for Vista booting problem bnc #396444 string command = sformat ( - "/bin/dd bs=446 count=1 if=%1 of=%2", + "/bin/dd bs=440 count=1 if=%1 of=%2", "/usr/lib/boot/master-boot-code", d); y2milestone ("Running command %1", command); @@ -574,19 +581,13 @@ // - 0 for a "Generic MBR" (DOS MBR) // - 254 for a GRUB or lilo "stage 1" // - 0 for an unknown MBR + // - 0 for Vista MBR map out = (map)SCR::Execute (.target.bash_output, sformat ( "/usr/lib/YaST2/bin/examine_mbr.pl %1", boot_partition_disk)); y2milestone ("MBR examining script returned %1", out); exit = out["exit"]:0; - // hack for vista - instal GRUB to MBR - if (exit != 200) - { - BootCommon::globals["generic_mbr"] = ((exit == 254) && (! keep_mbr)) ? "true" : "false"; - } else { - y2milestone("Detected Vista MBR"); - BootCommon::globals["generic_mbr"] = "false"; - selected_location = `mbr; - } + BootCommon::globals["generic_mbr"] = ((exit == 254) && (! keep_mbr)) ? "true" : "false"; + } else if (size (underlying_boot_partition_devices) > 1) @@ -630,9 +631,7 @@ // partition can remain activated, which causes less problems with // other installed OSes like Windows (older versions assign the C: // drive letter to the activated partition). - // hack for vista - doesn't activate just install GRUB to MBR - if (exit != 200) - BootCommon::globals["activate"] = + BootCommon::globals["activate"] = (size (Storage::GetBootPartition (BootCommon::mbrDisk)) == 0) ? "true" : "false"; else y2milestone("Detected Vista MBR don't activate"); Modified: branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/lilolike.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/lilolike.ycp?rev=48160&r1=48159&r2=48160&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/lilolike.ycp (original) +++ branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/lilolike.ycp Mon Jun 9 13:33:21 2008 @@ -220,17 +220,13 @@ // - 0 for a "Generic MBR" (DOS MBR) // - 254 for a GRUB or lilo "stage 1" // - 0 for an unknown MBR + // - 0 for a Vista MBR map out = (map)SCR::Execute (.target.bash_output, sformat ( "/usr/lib/YaST2/bin/examine_mbr.pl %1", disk)); y2milestone ("MBR examining script returned %1", out); exit = out["exit"]:0; repl_mbr = (exit == 254) && (! keep_mbr); - // hack for vista install GRUB to MBR - if (exit == 200) - { - repl_mbr = false; - selected_location = "mbr"; - } + } else if (size (needed_devices) > 1) { @@ -261,9 +257,7 @@ // we are installing into MBR: // if there is an active partition, then we do not need to activate // one (otherwise we do) - // hack for vista - if (exit != 200) - activate = size (Storage::GetBootPartition (mbrDisk)) == 0; + activate = size (Storage::GetBootPartition (mbrDisk)) == 0; } else { Modified: branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/misc.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/misc.ycp?rev=48160&r1=48159&r2=48160&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/misc.ycp (original) +++ branches/SuSE-Linux-11_0-Branch/bootloader/src/routines/misc.ycp Mon Jun 9 13:33:21 2008 @@ -1032,6 +1032,8 @@ string device_file = mergestring (splitstring (device, "/"), "_"); string device_file_path = "/var/lib/YaST2/backup_boot_sectors/" + device_file; + string device_file_path_to_logs = "/var/log/YaST2/" + + device_file; SCR::Execute (.target.bash, "test -d /var/lib/YaST2/backup_boot_sectors || mkdir /var/lib/YaST2/backup_boot_sectors"); if (SCR::Read (.target.size, device_file_path) > 0) @@ -1056,6 +1058,10 @@ SCR::Execute (.target.bash, sformat ( "/bin/dd if=%1 of=%2 bs=512 count=1 2>&1", device, device_file_path)); + // save MBR to yast2 log directory + SCR::Execute (.target.bash, sformat ( + "/bin/dd if=%1 of=%2 bs=512 count=1 2>&1", + device, device_file_path_to_logs)); if (device == mbrDisk) { SCR::Execute (.target.bash, sformat ( @@ -1107,8 +1113,9 @@ list<string> disks_to_rewrite = getMbrsToRewrite (); foreach (string d, disks_to_rewrite, { y2milestone ("Copying generic MBR code to %1", d); + // added fix 446 -> 440 Vista booting problem bnc # 396444 string command = sformat ( - "/bin/dd bs=446 count=1 if=%1 of=%2", + "/bin/dd bs=440 count=1 if=%1 of=%2", "/usr/lib/boot/master-boot-code", d); y2milestone ("Running command %1", command); @@ -1175,7 +1182,7 @@ /** * Rewrite current MBR with /var/lib/YaST2/backup_boot_sectors/%device - * Warning!!! don't use for bootsectors, 446 bytes of sector are written + * Warning!!! don't use for bootsectors, 440 bytes of sector are written * @param device string device to rewrite MBR to * @return boolean true on success */ @@ -1187,8 +1194,9 @@ Report::Error ("Can't restore MBR. No saved MBR found"); return false; } + // added fix 446 -> 440 for Vista booting problem bnc #396444 integer ret = (integer) SCR::Execute (.target.bash, sformat ( - "/bin/dd of=%1 if=/var/lib/YaST2/backup_boot_sectors/%2 bs=446 count=1", + "/bin/dd of=%1 if=/var/lib/YaST2/backup_boot_sectors/%2 bs=440 count=1", device, device_file)); return (ret == 0); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org