Working on booting on nixOS

This commit is contained in:
able 2023-05-23 04:26:32 -05:00
parent 2744e8e67b
commit ad22051a20
6 changed files with 49 additions and 48 deletions

View file

@ -2,5 +2,5 @@ TODO:
Support cache drives Support cache drives
# Compiling # Compiling
1. `git submodule --update init` 1. `git submodule update --init`
1. `cargo repbuild` 1. `cargo repbuild`

View file

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

View file

@ -9,6 +9,7 @@
prelude_import, prelude_import,
ptr_sub_ptr ptr_sub_ptr
)] )]
#![deny(clippy::pedantic)]
#![no_std] #![no_std]
#![feature(custom_test_frameworks)] #![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)] #![test_runner(crate::test_runner)]

View file

@ -155,10 +155,6 @@ fn run(release: bool, target: Target) -> Result<(), Error> {
if target == Target::X86_64 { if target == Target::X86_64 {
#[rustfmt::skip] #[rustfmt::skip]
com.args([ com.args([
"-bios", "-bios",
std::env::var("REPBUILD_QEMU_FIRMWARE_PATH") std::env::var("REPBUILD_QEMU_FIRMWARE_PATH")
.as_deref() .as_deref()

42
shell.nix Normal file
View file

@ -0,0 +1,42 @@
{ pkgs ? import <nixpkgs> { } }:
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/"
];
}

View file

@ -1,4 +1,6 @@
[boot] [boot]
# This package must be installed system wide
init = "init_server"
[boot.limine] [boot.limine]
default_entry = 1 default_entry = 1
timeout = 0 timeout = 0
@ -18,14 +20,10 @@ resolution = "1024x768x24"
[repositories] [repositories]
core = "https://git.ablecorp.us/AbleOS/core" core = "https://git.ablecorp.us/AbleOS/core"
userspace = "https://git.ablecorp.us/AbleOS/ableos_userland" userspace = "https://git.ablecorp.us/AbleOS/ableos_userland"
nya = "https://git.ablecorp.us/AbleOS/nya"
[packages] [packages]
[packages.list_files] [packages.init_server]
version = "0.1.1" version = "1.0"
hash = "" hash = ""
repo = "userspace" repo = "core"
authors = []
[packages.list_files.configuration]