diff --git a/.gitignore b/.gitignore index 2216b6f..c795b05 100644 --- a/.gitignore +++ b/.gitignore @@ -1,106 +1 @@ -# ---> C -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -# ---> CMake -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps - -# ---> Go -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work - -# ---> Rust -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb - +build \ No newline at end of file diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..1e2cb0b --- /dev/null +++ b/test/README.md @@ -0,0 +1,3 @@ +# Test driver + +This is a test driver, to test driver loading and the API. \ No newline at end of file diff --git a/test/build.sh b/test/build.sh new file mode 100755 index 0000000..67e24c9 --- /dev/null +++ b/test/build.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash + +# This file is part of noxos and licensed under the MIT open source license + +NX_DRV_NAME="test" + +set -e + +workspace_setup() { + echo " --> Setting up workspace" + mkdir -pv ../build + echo "" +} + +check_toolchain() { + echo " --> Checking Toolchain" + hash gcc + echo " |--> found gcc" + hash ld + echo " |--> found ld" + [ ! -f "../../libraries/libnxdrv/build/libnxdrv.so" ] && echo "libnxdrv not found!" && exit 255 + echo " |--> found libnxdrv" + + echo " --> All checks passed" +} + + +driver_build() { + echo " --> Building driver: $NX_DRV_NAME" + gcc src/main.c -o ../build/$NX_DRV_NAME.nxkm -nostdlib -nolibc -I../../libraries/libnxdrv/inc -L../../libraries/libnxdrv/build -lnxdrv + echo "" +} + + +echo "!=====[ libnx build script ]=====!" + +case $1 in + "check") + check_toolchain + ;; + *) + workspace_setup + driver_build + ;; +esac + +echo "!=====[ Finished ]=====!" + diff --git a/test/src/main.c b/test/src/main.c new file mode 100644 index 0000000..eef40af --- /dev/null +++ b/test/src/main.c @@ -0,0 +1,7 @@ +#include "libnxdrv.h" + +int _start() { + nx_drv_init(); + + return 0; +} \ No newline at end of file