Hi, I would like to submit a patch that will "enhance" the mbr of i386 machines.
Currently, the mbr will not check it there are many bootable partition in the partition table. It simply start the first active partition it found. I've made a small modification that will check the partition status before going on. If there are no bootable partitions or there are many bootable partition it will print an error message and stop. I think this can be useful for people that plays with mbr and forget to setup it correctly (like me). A new small routine before the "drive_ok" label will check for it. The original source is "$OpenBSD: mbr.S,v 1.21 2007/06/25 14:10:17 tom Exp $" fetched from 4.6 release. I hope this can be useful... Best Regards Giuseppe The patch is: diff mbr.S.orig mbr.S: 37a38,44 > /* Copyright (c) 2010 Giuseppe Magnotta <[email protected]> > * last edited 20 Feb 2010 > * Added the check for a single bootable partition. > * You may use this code or fragments thereof in a manner consistent > * with the other copyrights as long as you retain my pseudonym and > * this copyright notice in the file. > */ 227,228c234 < * Note: this should be the only active partition. We currently < * don't check for that. --- > * Note: this should be the only active partition. We check for that. 232a239,253 > xorw %ax, %ax > xorw %bx, %bx > > test_pt: > movb (%si), %al > addw %ax, %bx > addw $PARTSZ, %si > loop test_pt > > cmpw $DOSACTIVE, %bx > jne no_part > > movw $pt, %si > movw $NDOSPART, %cx > 536c557 < enoboot: .ascii "No active partition" /* runs into crlf... */ --- > enoboot: .ascii "Error selecting bootable partition" /* runs into crlf... */
