Ted Unangst wrote: > Is this really an improvement? If I have two bootable partitions, at > least one of them will boot now, letting me fix the problem. If you > refuse to boot, now I need to dig around in my toy box for a floppy > drive or something before I can fix it. I would prefer booting into > the wrong OS over not booting any day.
Hi Ted. In the (strange) case you have many bootable partition do you think is safe to boot in the first active one? If your answer is yes, please find attached a new patch that in case there are many bootable partition then print on screen "Corrupted partition table" and boots the first bootable partition it find otherwise if there are no bootable partition will print the same error and block (as original code did). What do you think about this? Regards, Giuseppe ? diff ? mbr Index: mbr.S =================================================================== RCS file: /cvs/src/sys/arch/i386/stand/mbr/mbr.S,v retrieving revision 1.21 diff -u -r1.21 mbr.S --- mbr.S 25 Jun 2007 14:10:17 -0000 1.21 +++ mbr.S 20 Feb 2010 20:27:26 -0000 @@ -3,6 +3,7 @@ /* * Copyright (c) 1997 Michael Shalayeff and Tobias Weingartner * Copyright (c) 2003 Tom Cosgrove <[email protected]> + * Copyright (c) 2010 Giuseppe Magnotta <[email protected]> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -223,13 +224,25 @@ movb $0x80, %dl drive_ok: - /* Find the first active partition. - * Note: this should be the only active partition. We currently - * don't check for that. - */ + /* Find first and check for only active partition. */ movw $pt, %si movw $NDOSPART, %cx + xorw %ax, %ax + xorw %bx, %bx + +test_pt: + movb (%si), %al + addw %ax, %bx + addw $PARTSZ, %si + loop test_pt + + cmpw $0x0, %bx + je no_part + + cmpw $DOSACTIVE, %bx + jg more_part + find_active: DBGMSG(CHAR_L) movb (%si), %al @@ -253,6 +266,16 @@ /* Just to make sure */ jmp stay_stopped +more_part: + movw $enoboot, %si + + call Lmessage + + movw $pt, %si + movw $NDOSPART, %cx + + jmp find_active + found: /* * Found bootable partition @@ -533,7 +556,7 @@ efdmbr: .asciz "MBR on floppy or old BIOS\r\n" eread: .asciz "\r\nRead error\r\n" enoos: .asciz "No O/S\r\n" -enoboot: .ascii "No active partition" /* runs into crlf... */ +enoboot: .ascii "Corrupted partition table" /* runs into crlf... */ crlf: .asciz "\r\n" endofcode:
