multiarch compat

This commit is contained in:
River 2025-02-17 10:46:04 -05:00
parent 0485052b11
commit a05218fc0d
Signed by: shibedrill
GPG Key ID: 5FE0CB25945EFAA2
7 changed files with 31 additions and 4 deletions

10
Dockerfile Normal file
View File

@ -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"]

View File

@ -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

3
src/arch/mod.rs Normal file
View File

@ -0,0 +1,3 @@
#[cfg(target_arch = "x86_64")]
pub mod x86_64;
pub use x86_64 as current;

1
src/arch/x86_64/mod.rs Normal file
View File

@ -0,0 +1 @@
pub mod display;

View File

@ -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;
/// Architecture dependent.
pub mod arch;

View File

@ -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() -> !{