flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > NUMBR = Neville's User-friendly (Multi-)Master Boot Record |
Author |
|
neville 01 Sep 2014, 02:57
Most MBR code closely scrutinises the Partition Table, looking for any of several "errors" which will typically crash the PC with a very unfriendly JMP $, but after cheerfully displaying the error message. All of the Windows MBR's I've seen are certainly guilty of this. Some even do a checksum of the MBR including the Partition Table, so any changes will make the OS fail to boot.
NUMBR contains no error messages at all, and makes every attempt to boot the PC while keeping the user informed. In addition, NUMBR turns some of the traditional MBR "errors" into opportunities. Firstly, if none of the 4 possible partition boot flags are set, NUMBR assumes Multi-boot Mode and asks the user to select which of the up to 4 partitions it should boot from. The attachment includes a demonstration of multi-boot mode, with fasm source, and contains 4 "operating systems" to choose from, in a total image size of 29696 bytes, occupying only 58 sectors! (3 of the operating systems are actually bootable games which may or may not be familiar to you!) NUMBR10.IMG should be written to ASN0 of a USB pendrive or any old hard disk. If your existing drive's first partition starts at ASN63 or greater (almost all do), only your existing MBR at ASN0 will be overwritten which you can backup first if you wish. You can use HxD for these tasks, as explained here. Secondly NUMBR does not require consistency between the legacy CHS and 32-bit sector data in the partition records. NUMBR ignores the legacy data unless the user holds down either of the Shift keys while booting. If either Shift keys are depressed NUMBR attempts a legacy boot using INT13h/AH=2. Otherwise NUMBR defaults to an EDD boot using INT13h/AX=4200h and the specified 32-bit start sector offset. So if your BIOS supports both legacy and EDD booting you could potentially set up 8 different primary boot partitions with 8 different operating systems. Thirdly for maximum flexibility NUMBR does not check partition size data, nor does it check for partition overlaps etc. Lastly NUMBR presently ignores the Partition Type bytes in the Partition Table, although for compatibility I generally recommend legacy values, and certainly avoid the GPT Protective MBR value 0EEh (even if you have multiple partitions), and also avoid the EFI value 0EFh. However I've used (somewhat arbitrarily) the value 0BCH in each of the 4 partitions defined in NUMBR10. This value is one of several available which has not been formally defined. NUMBR Main Features: + defaults to EDD booting using INT13h/AX=4200h + attempts legacy booting using INT13h/AX=2 if EDD fails + holding either SHIFT key down forces legacy booting + defaults to Multi-Boot mode if no boot flags detected + does not require the 0AA55h "boot signature" + does not check partition types + no partition table consistency checks + simple Multi-Boot menu displayed in Multi-Boot mode (with 4 user-definable partition names) In short, it is perhaps the most flexible and accommodating MBR ever written! Issues & future development: - in multi-boot mode the selected OS's stage 2 bootloader can not identify which partition it is booting from by examining the bootflags. This issue doesn't arise in this demonstration because there are no stage 2 bootloaders, but a simple workaround would be to pass the user keypress (1-4) to the stage 2 bootloader. - at least one BIOS that I'm aware of (in a Sony Vaio notebook) doesn't update the keyboard status flags during IPL, so doesn't detect the SHIFT keys for legacy booting. + determine and display the actual number of partitions defined. Currently NUMBR just assumes there are 4 partitions and will accept any keypress from 1 to 4. The 4 defined partition names are also displayed on 4 consecutive lines whether they actually contain text, or are null, blank, or otherwise. + provide for up to 8 displayable partition names + default to Multi-Boot mode if more than 1 boot flag is detected + holding another key down (e.g. either CTRL key) forces Multi-Boot mode irrespective of boot flag(s). This would allow a normal default bootable partition to be defined. Even without much code optimisation, and allowing 64 bytes for the displayable partition names, there are still about 34 bytes of spare code space to play with! Note that Multi-boot Mode in NUMBR does NOT conform to the Multiboot Specification developed by gnu.org. That specification is much more complex and comprehensive, and is targeted at stage 2 bootloaders rather than the MBR itself. Source code for NUMBR and the complete image with 4 selectable OS's is included in the attachment but the source for the individual OS's is all available elsewhere. If you use NUMBR please let me know. Remember that the NUMBR demo binary (NUMBR10.IMG) in the attached archive must be written to Absolute sector 0, replacing the existing MBR and the following 57 sectors.
_________________ FAMOS - the first memory operating system |
|||||||||||
01 Sep 2014, 02:57 |
|
neville 01 Sep 2014, 04:29
I'm not familiar with (and don't use) any FDE software so I don't know. I've provided the source so anybody familiar with FDE software should be able to identify any issues pretty quickly
Back-up/restore suggestions are included in my post above, using external applications like HxD. If you mean an internal backup/restore option within a 512-byte MBR that might not be so easy! _________________ FAMOS - the first memory operating system |
|||
01 Sep 2014, 04:29 |
|
neville 02 Sep 2014, 04:30
I haven't used an emulator for a long time so I'm not sure if any of them would support booting an image which includes the MBR. Does anybody know?
_________________ FAMOS - the first memory operating system |
|||
02 Sep 2014, 04:30 |
|
Matrix 02 Sep 2014, 07:28
neville wrote: I haven't used an emulator for a long time so I'm not sure if any of them would support booting an image which includes the MBR. Does anybody know? i just do kvm -m 512M /dev/sda and it works fine or kvm -m 512M -cdrom anyisofile if it is a cd iso, and system needs cdrom emulation |
|||
02 Sep 2014, 07:28 |
|
neville 04 Sep 2014, 05:57
Matrix wrote: i just do kvm -m 512M /dev/sda and it works fine _________________ FAMOS - the first memory operating system |
|||
04 Sep 2014, 05:57 |
|
Matrix 04 Sep 2014, 13:48
neville wrote:
yes it does work with qemu, and i'm on linux, "W: kvm binary is deprecated, please use qemu-system-x86_64 instead" kvm always writes this amazing warning |
|||
04 Sep 2014, 13:48 |
|
neville 05 Sep 2014, 04:53
Ok, good to know. Thanks.
_________________ FAMOS - the first memory operating system |
|||
05 Sep 2014, 04:53 |
|
0ffer 07 Sep 2014, 17:44
Boot code from User-friendly (Multi-)Master Boot Record UFMBR.bin and DOS installer restrmbr.exe from PartitionMagic 8.0
For Boot flag manipulation EFDISK - SPACE toggles active flag if a partition is already active by Nagy Daniel Install: restrmbr.exe UFMBR.bin Uninstall: restrmbr.exe
|
|||||||||||
07 Sep 2014, 17:44 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.