rust-osdev / bootloader

An experimental pure-Rust x86 bootloader
Apache License 2.0
1.37k stars 208 forks source link

[Question] How do you make the MBR not have ELF headers? #272

Open davidgm94 opened 1 year ago

davidgm94 commented 1 year ago

Hi, First I just want to say this is a great project and thanks for putting this out here. I have a question regarding the BIOS bootloader. If I am undestanding properly, the BIOS bootloader is a unique ELF mixing Rust and assembly code, split into 4 stages. I wonder how you do to make Rust (or the LLVM backend inside it) not to generate ELF headers at the beginning of the file, so MBR code is first. I appreciate the help in advance.

JarlEvanson commented 1 year ago

Llvm obj-copy is used to transform the elf file corresponding to the mbr bootsector into a binary file, which has no headers