From ede52eb1dbf2c6a39126b75edd5632c53c103a39 Mon Sep 17 00:00:00 2001 From: able Date: Mon, 17 Jul 2023 00:36:06 -0500 Subject: [PATCH] ARM: work done on getting the bootloader working --- kernel/.cargo/config.toml | 4 ++-- kernel/src/arch/aarch64/mod.rs | 8 ++++++++ repbuild/limine.cfg | 2 +- repbuild/src/main.rs | 13 +++++++++++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/kernel/.cargo/config.toml b/kernel/.cargo/config.toml index 739873d75..8b608a110 100644 --- a/kernel/.cargo/config.toml +++ b/kernel/.cargo/config.toml @@ -3,8 +3,8 @@ build-std = ["core", "compiler_builtins", "alloc"] build-std-features = ["compiler-builtins-mem"] [build] -target = "./targets/x86_64-ableos.json" -# target = "./targets/aarch64-virt-ableos.json" +# target = "./targets/x86_64-ableos.json" +target = "./targets/aarch64-virt-ableos.json" [target.'cfg(target_arch = "x86_64")'] rustflags = ["-C", "target-feature=+rdrand"] diff --git a/kernel/src/arch/aarch64/mod.rs b/kernel/src/arch/aarch64/mod.rs index 05f1d8612..e14e6a4f1 100644 --- a/kernel/src/arch/aarch64/mod.rs +++ b/kernel/src/arch/aarch64/mod.rs @@ -3,7 +3,15 @@ // use limine::{TerminalRequest, TerminalResponse}; #[no_mangle] +#[allow(deprecated)] unsafe extern "C" fn _kernel_start() -> ! { + use limine::{Framebuffer, FramebufferRequest, NonNullPtr}; + static FB_REQ: FramebufferRequest = FramebufferRequest::new(0); + let fb1: &NonNullPtr = &FB_REQ.get_response().get().unwrap().framebuffers()[0]; + unsafe { + fb1.address.as_ptr().expect("REASON").write_volatile(0x00); + } + loop {} } diff --git a/repbuild/limine.cfg b/repbuild/limine.cfg index 6948659f0..9af3aa579 100644 --- a/repbuild/limine.cfg +++ b/repbuild/limine.cfg @@ -1,4 +1,4 @@ -${ABLEOS_KERNEL}=boot:///kernel +${ABLEOS_KERNEL}=boot:///{$ARCH}/kernel # TODO: Make a boot background image for ableOS DEFAULT_ENTRY=1 diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 041e51bda..13fc84a5a 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -112,6 +112,15 @@ fn get_fs() -> Result, io::Error> { &mut bootdir.create_file("bootx64.efi")?, )?; + io::copy( + &mut File::open("limine/BOOTAA64.EFI") + .into_report() + .attach_printable( + "copying Limine bootloader arm version (have you pulled the submodule?)", + )?, + &mut bootdir.create_file("bootaa64.efi")?, + )?; + io::copy( &mut File::open("repbuild/limine.cfg")?, &mut fs.root_dir().create_file("limine.cfg")?, @@ -166,7 +175,7 @@ fn build(release: bool, target: Target) -> Result<(), Error> { (|| -> std::io::Result<_> { io::copy( &mut File::open( - Path::new("target/x86_64-ableos") + Path::new("target/aarch64-virt-ableos") .join(if release { "release" } else { "debug" }) .join("kernel"), )?, @@ -230,7 +239,7 @@ fn run(release: bool, target: Target) -> Result<(), Error> { if target == Target::Aarch64 { com.args([ "-bios", - "target/OVMF_CODE.fd", + "AAVMF_CODE.fd", "-M", "virt", "-device",