x86 bare metal Rust thing
eighty-six
x86 bare metal Rust thing
I'm following the intermezzOS book to get a feel about how Rust can be used for x86 kernel development. I'm particularly interested in studying the tooling involved as I heard that developers make use of Makefiles and external assembly files to build their kernels, and I feel that neither (Makefiles or external assembly files) should be necessary if one uses Cargo to build the kernel (but I might be wrong).
I have another goal: I'd love the replace rustc
dependence on an external linker (usually gcc
)
with a lld
that's embedded in rustc
itself. The x86 kernel dev space is an excellent testing
ground for this as its "executables" (the kernels) are free of C dependencies (libraries, startup
objects, etc.). Check the lld branch for more details.
I've just finished Chapter 3, and my "kernel" prints "Hello, world!" to the screen and does nothing more :tada:. Some relevant differences between my build process and intermezzOS':
# Build the kernel
$ xargo build --target x86_64
multiboot_header.asm
) has been fully
implemented in the linker script. And boot.asm
has been implemented as Rust code
(src/main.rs
).asm!("hlt")
, which can't be emitted using pure Rust code
(AFAIK).core
is not explicitly build. Xargo takes care of compiling it without user intervention.Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.