Bootloader FAQ: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
(→‎BIOS or UEFI?: Link to the section on the UEFI page)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 54:
 
The last time you installed a Linux distro, chances are you wrote the live CD to the USB drive and booted from it. The problem, however, is that BIOSes treat USB drives as hard disks, so the CD image needs to additionally contain a valid MBR that is then loaded by the BIOS. Now, in contrast to hard drives, the space available between the MBR and the first interesting ISO-9660 sector may be used for stage-2.
 
=== Network ===
 
A Network bootloader can load your kernel straight from the machine which compiled it. Many (all?) network chipsets and BIOSes made in the last 15 or so years support the PXE standard for network boot. You will need a tftp (Trivial FTP) server to serve your kernel and stage-2 bootloader, and may need to specially configure a suitable DHCP server.
 
== What should my bootloader support? ==
 
Apart from loading the kernel, the bootloader also has to prepare the environment appropriately before handing off control to the kernel. This includescould include:
* Detecting CPU/BIOS features. You need to make sure that the CPU or the BIOS supports any features that you use (e.g. INT 0x13 extensions).
* [[Detecting Memory (x86)|Getting the memory map]]. Where will you even load the kernel if you don't know what memory areas actually are memory?
* Enabling [[A20|A20]] and [[Protected Mode|protected mode]] with [[Paging|paging]] (or [[Long Mode|long mode]] if running on a [[x86-64|x86_64]]). GRUB doesn't enable paging or long mode, but that doesn't mean other bootloaders shouldn't do betterit either. Not enabling paging or long mode in the bootloader means that you need to decide a priori in which physical memory area the kernel will reside, which may lead to two potential consequences:
** There might not be actually any memory at that address;
** It makes it a bit harder, if not impossible, and more messy to do a [[Higher Half Kernel|higher half kernel]].
 
When you are more advanced, you may also want/need to do these things in the bootloader:
Line 71 ⟶ 75:
 
It's probably a good idea to start from the bare minimum in order to load the kernel, then implement whatever you see the kernel needs. Don't try to match an existing specification (e.g. Multiboot), otherwise it would be probably better to use an existing bootloader (e.g. GRUB).
 
[[Category:Bootloaders]]
Anonymous user