Pre-notification : the following is very simplified and refers only to the “traditional” (or “old”) disk partitioning scheme called dos partition table ( mbr-based partitioning ) . although probably partly true for the guid partition table ( gpt ) . but definitely not related to the unified extensible firmware interface ( uefi ) .
To put it simply, bios loads the first 512 bytes from the block device specified in its settings into memory, and transfers control to this “piece of code” (in terms of grub, this is called the “first stage loader” - stage 1 loader ).
in addition to the executable code, there is also some information necessary for this code itself. it is clear that in such a meager amount of code, something reasonable is quite difficult to fit, and, in fact, this code only loads another, much larger portion of code ( stage 2 ), and transfers control to it.
where exactly this second portion is taken from, the “first stage loader” finds out from the very information that is written next to it in those same 512 bytes. among other things, there are recorded at least: the address of the block device (after all, stage 2 can be located on another used one) and the address of the sector (s) that (s) must be loaded into memory.
Why is the sector address, and not the file name? because in 512 bytes it is impossible to “put” a code that could work with the file system .
By the way, by the way: in the case of overwriting a file from stage2, its physical location is likely to change, and, accordingly, it will be necessary to adjust the contents of those same 512 bytes of the “first stage loader”.
but the code that was loaded from stage 2 , “understands” both file systems and configuration files can read and display a dialog for the user, based on these configuration files, and the selected program that performs the functions of the kernel, download (the one that loads “Trained”: ntoskrnl.exe , linux , etc., etc.).
The stage2 loader from the ms company is clearly not “trained” to load the linux program, and the stage2 loader grub (as well as lilo and others) is not “trained” to download ntoskrnl.exe .
but they can all load other stage1 loaders (and even stage2 loaders) and transfer control to them .
and then we can only talk about the degree of automation of the settings of this process.
in the case of the bootloader from the company ms , of course, no automation of the settings is envisaged: facilitating the use of a “foreign” operating system is a “low blow”, i.e., to a wallet. as they say, "it's just business, nothing personal."
To set up, you need to get hold of the “first stage loader”, write these 512 bytes to a file (for example, c:\bootsect.aln ) and add a line to the operating systems section of the configuration file of the c:\boot.ini loader c:\boot.ini content:
c:\bootsect.aln="alien operating system"
do not forget to manually update the contents of this 512-byte file every time after updating the stage2 loader, to the addresses of the sectors with which it (the file) should refer!
There are, of course, all sorts of “boot managers” (of the type mentioned in the easybcd comments), but if at least one of them has an automatic update account in the stage2 file of the same grub , I don't know. but I suspect that it is unlikely (considering, firstly, there may be much more than one talk with grub , and second, that the “initiative of renewal” comes from the side of grub , which, quite naturally, hardly suspects the existence of any “boot managers”).
- in the case of the grub loader, the approach is diametrically opposite: everything (which is possible) is done to simplify the configuration of the boot process of other operating systems. in “normal conditions” everything happens “automagically”: during the installation of the grub program (and when updating files containing stage2 ), the update-grub program (included in the grub package) is called, which (as a rule, quite successfully) “finds” on block devices and their sections other bootloaders, and adds items with them to the boot menu.
which way suits you best - choose for yourself.
ps perhaps it is worth noting that the code for the “second stage loader” of the grub program has long grown to such an extent that developers had to create (albeit not only for this reason) an intermediate loader (which was called stage 1.5 ). This does not change the essence, but it is written about stages 1, 1.5 and 2 even in Wikipedia , and the mention will be appropriate.
addition
about where to put 512 bytes of stage1 , so as not to overwrite mbr : put it not in the mbr disk, but in the vbr partition . there is enough space. bootloader installers know this, and know how to handle it.
sda1is not a disk and you needsda. I understand correctly that I will need to specify the--forcekey--forcethat it is installed on the partition? - Qwertiy ♦--force(and similar) in any program, perhaps, should be used if you have a good idea of ​​what you are going to do. - aleksandr barakin/boot/grub). About stage even in Wikipedia it is popularly written: en.wikipedia.org/wiki/GNU_GRUB - aleksandr barakin