[cmds] Fix makeboot to use proper minor number mask to get raw device using sys -M by ghaerr · Pull Request #2387 · ghaerr/elks (original) (raw)
Fixes sys -M writing MBR to wrong hard drive, identified in #2385 with "Writing MBR to ..." an incorrect device.
This bug cropped up some time ago when the BIOS hard and floppy drive numbers were renumbered, but makeboot was hard-coded to use the older numbering scheme, and the error never found until now. The makeboot source code now uses the minor drive numbers directly from the BIOS driver, so this won't happen again.
On a two-hard drive system, using sys -M /dev/hdb1:
BEFORE (Writing MBR to /dev/hda)
AFTER (Writing MBR to /dev/hdb)