initial commit

This commit is contained in:
Mira Kristipati 2025-06-26 23:27:08 -04:00
commit 02e6fa10eb
7 changed files with 84 additions and 0 deletions

5
.cargo/config.toml Normal file
View file

@ -0,0 +1,5 @@
[build]
target = "arm-none-eabihf.json"
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins"]

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

7
Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "jank_os"
version = "0.1.0"

6
Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "jank_os"
version = "0.1.0"
edition = "2024"
[dependencies]

28
arm-none-eabihf.json Normal file
View file

@ -0,0 +1,28 @@
{
"llvm-target": "arm-none-eabihf",
"target-endian": "little",
"target-pointer-width": "32",
"target-c-int-width": "32",
"os": "none",
"env": "eabi",
"vendor": "unknown",
"arch": "arm",
"panic-strategy": "abort",
"llvm-floatabi": "hard",
"disable-redzone": true,
"linker-flavor": "gcc",
"linker": "arm-none-eabi-gcc",
"pre-link-args": {
"gcc": [
"-Wall",
"-nostdlib",
"-nostartfiles",
"-ffreestanding",
"-march=armv6"
]
},
"features": "+strict-align,+v6,+vfp2,-d32",
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
"executables": true,
"relocation-model": "static"
}

11
notes.md Normal file
View file

@ -0,0 +1,11 @@
build: `cargo build --target arm-none-eabihf.json -Z build-std=core,compiler_builtins`
qemu: `qemu-system-arm -m 256 -M raspi0 -serial stdio -kernel kernel.elf`
---
# References
- https://os.phil-opp.com/minimal-rust-kernel/
- https://wiki.osdev.org/Raspberry_Pi_Bare_Bones
- https://wiki.osdev.org/Raspberry_Pi_Bare_Bones_Rust

26
src/main.rs Normal file
View file

@ -0,0 +1,26 @@
#![no_std]
#![no_main]
use core::panic::PanicInfo;
/// This function is called on panic.
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
static HELLO: &[u8] = b"Hello World!";
#[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! {
let vga_buffer = 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 {}
}