From ad22051a20ffdcd8f31fd4a8daf34d0b7b9530d1 Mon Sep 17 00:00:00 2001 From: able Date: Tue, 23 May 2023 04:26:32 -0500 Subject: [PATCH] Working on booting on nixOS --- README.md | 2 +- kernel/data/test.wat | 36 ------------------------------------ kernel/src/lib.rs | 1 + repbuild/src/main.rs | 4 ---- shell.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ system.toml | 12 +++++------- 6 files changed, 49 insertions(+), 48 deletions(-) delete mode 100644 kernel/data/test.wat create mode 100644 shell.nix diff --git a/README.md b/README.md index 50159fe5..59087445 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,5 @@ TODO: Support cache drives # Compiling -1. `git submodule --update init` +1. `git submodule update --init` 1. `cargo repbuild` diff --git a/kernel/data/test.wat b/kernel/data/test.wat deleted file mode 100644 index 8473c2ca..00000000 --- a/kernel/data/test.wat +++ /dev/null @@ -1,36 +0,0 @@ -(module - (data "mouse") - (data "x") - (data "y") - (func $rma (import "host" "read_mem_addr")(param i32)(result i32)) - (func $co (import "host" "create_object")(param i32 i32)(result i64)) - (func $roa (import "host" "read_object_attribute")(param i64 i32 i32)(result i32 i32)) - (memory (export "memory") 1) - - (func - (export "start")(result i64) - ;; Copy into memory the object name - (memory.init 0 - (i32.const 0) ;; target offset - (i32.const 0) ;; source offset - (i32.const 5)) - (memory.init 1 - (i32.const 6) ;; target offset - (i32.const 0) ;; source offset - (i32.const 1)) - (memory.init 2 - (i32.const 7) ;; target offset - (i32.const 0) ;; source offset - (i32.const 1)) - - i32.const 0 - i32.const 5 - call $co - - ;; i32.const 6 - ;; i32.const 1 - - ;; call $roa - - ) -) diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 02279925..ff840603 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -9,6 +9,7 @@ prelude_import, ptr_sub_ptr )] +#![deny(clippy::pedantic)] #![no_std] #![feature(custom_test_frameworks)] #![test_runner(crate::test_runner)] diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 3242f3f4..1e57fb8c 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -155,10 +155,6 @@ fn run(release: bool, target: Target) -> Result<(), Error> { if target == Target::X86_64 { #[rustfmt::skip] com.args([ - - - - "-bios", std::env::var("REPBUILD_QEMU_FIRMWARE_PATH") .as_deref() diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..a2dad0d3 --- /dev/null +++ b/shell.nix @@ -0,0 +1,42 @@ +{ pkgs ? import { } }: +pkgs.mkShell rec { + buildInputs = with pkgs; [ + clang + llvmPackages.bintools + rustup + qemu_full + # OMVFFull + # OMVF + ]; + extraCmds = ''''; + + + RUSTC_VERSION = pkgs.lib.readFile ./rust-toolchain.toml; + # https://github.com/rust-lang/rust-bindgen#environment-variables + LIBCLANG_PATH = + pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ]; + shellHook = '' + export REPBUILD_QEMU_FIRMWARE_PATH=$(find -O3 /* -name OVMF_CODE.fd 2>/dev/null | head -n 1) + export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin + export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ + ''; + # Add precompiled library to rustc search path + RUSTFLAGS = (builtins.map (a: "-L ${a}/lib") [ + # add libraries here (e.g. pkgs.libvmi) + ]); + # Add glibc, clang, glib and other headers to bindgen search path + BINDGEN_EXTRA_CLANG_ARGS = + # Includes with normal include path + (builtins.map (a: ''-I"${a}/include"'') [ + # add dev libraries here (e.g. pkgs.libvmi.dev) + pkgs.glibc.dev + ]) + # Includes with special directory paths + ++ [ + '' + -I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"'' + ''-I"${pkgs.glib.dev}/include/glib-2.0"'' + "-I${pkgs.glib.out}/lib/glib-2.0/include/" + ]; + +} diff --git a/system.toml b/system.toml index 54e67cdf..7cfb5ea4 100644 --- a/system.toml +++ b/system.toml @@ -1,4 +1,6 @@ [boot] +# This package must be installed system wide +init = "init_server" [boot.limine] default_entry = 1 timeout = 0 @@ -18,14 +20,10 @@ resolution = "1024x768x24" [repositories] core = "https://git.ablecorp.us/AbleOS/core" userspace = "https://git.ablecorp.us/AbleOS/ableos_userland" -nya = "https://git.ablecorp.us/AbleOS/nya" [packages] -[packages.list_files] -version = "0.1.1" +[packages.init_server] +version = "1.0" hash = "" -repo = "userspace" -authors = [] - -[packages.list_files.configuration] +repo = "core"