BOOTBOOT: Difference between revisions

2,408 bytes added ,  2 years ago
no edit summary
[unchecked revision][unchecked revision]
mNo edit summary
No edit summary
 
(15 intermediate revisions by 2 users not shown)
Line 7:
== Supported Platforms ==
 
BOOBOOTBOOTBOOT can load your 64 bit kernel on the following platforms:
* Legacy BIOS (x86_64 with PMBR)
* El Torito "no emulation" CDROM boot (x86_64)
* UEFI (x86_64)
* Raspberry Pi (AArch64)
* Legacy BIOS (x86_64 with PMBRMBR)
* Legacy BIOS boot with any arbitrary boot manager (x86_64, chainloaded from VBR)
* Legacy BIOS boot with a single OS on a forward-compatible GPT disk (x86_64, booted from PMBR)
* Legacy BIOS for embedded systems (x86_64, in BIOS Expansion ROM)
* UEFI (x86_64)
* UEFI for embedded systems (x86_64, in PCI Option ROM)
* CDROM, El Torito "no emulation" CDROMBIOS boot (x86_64, hybrid GPT/ISO9660 image)
* CDROM, El Torito UEFI boot Extension (x86_64)
* ISOLINUX / LILO / BOOTLIN / etc. (x86_64 via the Linux kernel boot protocol)
* COREBOOT: as a primary payload in ROM (x86_64)
 
For GRUB compatibility, BOOTBOOT is also Multiboot compliant, so you can add it to the grub.cfg in it's own entry. This is useful if want to dual boot multiple OSes.
Line 17 ⟶ 24:
== Supported Sources ==
 
Your kernel can be wrapped in an initial ramdisk archive ([[USTAR]], cpio, James Molloy's initrd format etc.), which in turn can be a simple file on a [[FAT|FAT16/32]] partition; or can occupy the whole partition as well using a file system of your choosing ([[SFS]] among others). BOOTBOOT uses GPT partitions, so your boot partition should be either an [[EFI_System_Partition|ESP]], or it should have the bootable flag (attribute 2) set.
 
If despite the warning you decide to [[Roll Your Own Filesystem]], then BOOTBOOT is definitely for you. You can either write an FS module (one function), or just make sure the kernel is the first executable in the archive / on the partition. BOOTBOOT is capable of loading kernels from unknown file systems as well.
 
Optionally you can load your OS from ROM (see qemu's -option-rom command line argument, or bochs rc file; or with [https://coreboot.org coreboot] as a BIOS using qemu -bios), and the Raspberry Pi version can also load the ramdisk over serial line. Although it's not implemented as of yet, the BOOTBOOT protocol allows loading the initrd from a TFTP server.
 
== Your Kernel ==
 
You can use ELF64 or PE32+ formats for your kernel. You must link it as a [[Higher Half Kernel]], and your entry point should point to [[Long Mode]] code. That's all. Unlike all the other boot protocols (e.g. [[Multiboot]] and [[stivale]]), there's absolutely no need for special sections nor for magic structs, unimplementable in some languages. No real mode nor protected mode trampoline code needed at alleither, which simplifies your build environment significantly. Example linker script provided for both x86_64 and AArch64. There are [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel example kernels] written in [[C]], [[C++]], [[Pascal]], [[Ada]], [[Rust]] and [[Go]].
 
BOOTBOOT passes a configuration to your kernel in a newline separated, zero-terminated UTF-8 string. Each line contains a ''key=value'' pair, where only two keys, "screen" and "kernel" are reserved. You are free to use any other keys that your kernel wishes to use.
Line 31 ⟶ 38:
== Console ==
 
BOOTBOOT does not support VGA text mode, it sets up graphic mode regardless to the platform. You don't have to mess around with [[VESA]] or [[GOP]] any more, you will get the frame buffer ready to use. The example Hello World kernel provided with the BOOTBOOT source has a minimal puts() example, which outputs text on that frame buffer using [[PC Screen Font]] (same that Linux Console uses). You can also use the [[Scalable Screen Font]] library's ''ssfn_putc()''.
 
The loader also initializes the [[Serial_Ports|serial console]] for you with 115200 baud, 8 data bits, no parity and 1 stop bit. Your kernel can send debug messages from the start.
 
== How to Install ==
 
You can install BOOTBOOT yourself following the [[Bootable_Disk|bootable disk]] tutorial and using one of the provided mkboot.c utilities. But the simplest way is to use
the multiplatform (Windows, MacOSX, Linux) disk image creator tool, [https://gitlab.com/bztsrc/bootboot/tree/master/mkbootimg mkbootimg] which is very similar to [[GRUB|grub-mkrescue]].
 
For input, you provide the contents of your initrd in a directory, and a JSON configuration describing what disk image you would like. The rest is taken care for you.
 
== There's more... ==
Line 46 ⟶ 60:
== External Links ==
*[https://gitlab.com/bztsrc/bootboot Source on Gitlab] the repository
*[https://gitlab.com/bztsrc/bootboot/treeraw/master/mykernelbootboot_spec_1st_ed.pdf ExampleBOOTBOOT Hello World KernelSpecification] withand Makefileuser's andmanual minimalin linkerPDF script.format
*[https://gitlab.com/bztsrc/bootboot/tree/master/mkbootimg mkbootimg] simple to use, dependency-free [[Bootable_Disk|bootable disk]] creator
*[https://gitlab.com/bztsrc/bootboot/tree/master/mykernel Example Hello World Kernels] with Makefile and minimal linker script
*Mykernel in [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/c C]
*Mykernel in [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/cpp C++]
*Mykernel in [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/rust Rust]
*Mykernel in [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/pas Pascal]
*Mykernel in [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/ada Ada]
*Mykernel in [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/go Go]
 
[[Category:Bootloaders]]
[[Category:ARM]]
[[Category:Raspberry Pi]]
[[Category:x86-64]]
[[Category:UEFI]]
 
[[de:BOOTBOOT]]
Anonymous user