diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dbee23b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM rust:latest as builder +WORKDIR /usr/src/gila +COPY . . +RUN rustup default nightly +RUN rustup target add x86_64-unknown-none + +FROM alpine:3.21 +RUN apk add bash xorriso make limine qemu-system-x86_64 +CMD ["/bin/bash"] + diff --git a/Makefile b/Makefile index a446a16..2777346 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ TARGET ?= "x86_64-unknown-none" +QEMU ?= "qemu-system-x86_64" all: clean prepare gila iso run @@ -10,7 +11,18 @@ prepare: # Run the ISO in an emulator. run: build/gila.iso - qemu-system-x86_64 -drive file=build/gila.iso,format=raw,index=0,media=disk + +ifeq ($(TARGET),x86_64-unknown-none) + QEMU = "qemu-system-x86_64" +else ifeq ($(TARGET),riscv64gc-unknown-none-elf) + QEMU = "qemu-system-riscv64" +else ifeq ($(TARGET),aarch64-unknown-none) + QEMU = "qemu-system-aarch64" +else ifeq ($(TARGET),loongarch64-unknown-none) + QEMU = "qemu-system-loongarch64" +endif + + $(QEMU) -drive file=build/gila.iso,format=raw,index=0,media=disk # Build the bootable kernel image. .PHONY: build/iso/gila diff --git a/src/arch/mod.rs b/src/arch/mod.rs new file mode 100644 index 0000000..80b1c69 --- /dev/null +++ b/src/arch/mod.rs @@ -0,0 +1,3 @@ +#[cfg(target_arch = "x86_64")] +pub mod x86_64; +pub use x86_64 as current; \ No newline at end of file diff --git a/src/display.rs b/src/arch/x86_64/display.rs similarity index 100% rename from src/display.rs rename to src/arch/x86_64/display.rs diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs new file mode 100644 index 0000000..9fc4ff2 --- /dev/null +++ b/src/arch/x86_64/mod.rs @@ -0,0 +1 @@ +pub mod display; \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 4820649..b6fa032 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,5 +11,6 @@ pub mod panic; pub mod boot; /// Resources accessible from many parts of the code. pub mod resources; -/// Display facilities. -pub mod display; \ No newline at end of file + +/// Architecture dependent. +pub mod arch; diff --git a/src/main.rs b/src/main.rs index 2c54976..8252d77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use gila::process; use gila::memory; use gila::panic; use gila::boot; -use gila::display::{self, TextWriter}; +use gila::arch::current::display; #[unsafe(no_mangle)] unsafe extern "C" fn main() -> !{