0

So i'm relatively farmiliar with Linux, been using it for a few years now and recently I've been toying around with FreeBSD and Dragonfly BSD. I've recently wanted to create my own distro based on Dragonfly BSD. I really like what they have done with the FreeBSD code base. But I've been wanting to create a bootloader from scratch in assembly. I don't want to create anything big and complex like grub with multi boot. All I want is a single system bootloader. Just to boot the linux/Dragonfly BSD kernel. But I don't know where to start learning assembly and after that how I would go about creating a bootloader like that. I'm not looking for code just a point in the right direction to learn assembly and to simply boot a single Linux/Dragonfly BSD kernel.

  • Booting x86 is not simple. These days most systems can boot in EFI mode instead of legacy BIOS mode, so your kernel loader can be an EFI application (see https://wiki.archlinux.org/index.php/systemd-boot for docs on *using* gummiboot / systemd-boot. Source at https://github.com/systemd/systemd/tree/master/src/boot/efi). Many users will *prefer* this, but old hardware, or new hardware configured to boot in legacy BIOS mode, will need a traditional boot-sector. – Peter Cordes Jul 27 '18 at 21:20
  • You can find lots of examples of legacy real-mode boot sectors on SO, like [How to make the kernel for my bootloader?](https://stackoverflow.com/a/33619597) and [general tips for bootloader development](https://stackoverflow.com/a/32705076). – Peter Cordes Jul 27 '18 at 21:21
  • Note that loading the FreeBSD or Dragonfly BSD kernel is not an easy task since the kernel requires kernel modules to be loaded at boot time to work correctly. Basically, you are going to have to implement a good chunk of what `ld.so` does which is not quite easy. You also need to implement a file system driver just so you can read the kernel from disk. I don't recommend this as a beginner's project. – fuz Jul 27 '18 at 21:52

0 Answers0