feat(bootloader): add bootable image

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2021-11-28 02:12:32 +01:00
parent 8ff78bbc02
commit 65a962361a
4 changed files with 29 additions and 3 deletions

View File

@ -1,5 +1,9 @@
[target.'cfg(target_os = "linux")']
rustflags = ["-C", "link-arg=-nostartfiles"]
[build]
target = "x86_64-julios.json"
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins"]
[target.'cfg(target_os = "none")']
runner = "bootimage runner"

9
Cargo.lock generated
View File

@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "bootloader"
version = "0.9.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c452074efc3c0bfb241fb7bc87df04741c7c85e926f6a07c05f8fbd6008240"
[[package]]
name = "julios"
version = "0.1.0"
dependencies = [
"bootloader",
]

View File

@ -6,4 +6,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bootloader = "0.9.8"

View File

@ -7,8 +7,21 @@ fn panic(_info: &core::panic::PanicInfo) -> !
loop {}
}
static HELLO: &[u8] = b"Welcome to the JuliOS";
#[no_mangle]
pub extern "C" fn _start() -> !
{
let vga_buffer: *mut u8 = 0xb8000 as *mut u8;
for (i, &byte) in HELLO.iter().enumerate()
{
unsafe
{
*vga_buffer.offset(i as isize * 2) = byte;
*vga_buffer.offset(i as isize * 2 + 1) = 0xb;
}
}
loop {}
}