diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..309b66f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "libraries/libnoxos"] + path = libraries/libnoxos + url = https://git.nerdcult.net/noxos/libnoxos.git +[submodule "initrd/sources/userland"] + path = initrd/sources/userland + url = https://git.nerdcult.net/noxos/userland.git diff --git a/build.sh b/build.sh index d8d21e8..f8f1336 100755 --- a/build.sh +++ b/build.sh @@ -3,6 +3,7 @@ # This file is part of noxos and licensed under the MIT open source license set -e +PROJECT_ROOT=$PWD workspace_setup() { echo " --> Setting up workspace" @@ -42,17 +43,12 @@ kernel_build() { echo "" } -libnx_build() { - cd ../libnx - bash build.sh - cd ../kernel +libnoxos_build() { + cd libraries/libnoxos/ + # bash build.sh + cd $PROJECT_ROOT } -shell_build() { - gcc shell.c -o ramdisk/shell.elf -nostdlib -nolibc -fno-stack-protector -I../libnx/inc ../libnx/build/cmake/libnx.so -} - - limine_install() { echo " --> Installing Limine" cd build @@ -67,7 +63,10 @@ limine_install() { generate_initial_ramdisk() { echo " --> Generating initrd" - tar -C ramdisk -cvf build/initrd.tar . + cd initrd + bash build.bash + cd $PROJECT_ROOT + tar -C initrd -cvf build/initrd.tar . } generate_image() { @@ -98,7 +97,7 @@ generate_image() { echo "" } -echo "!=====[ NoxOS build script ]=====!" +echo "!=====[ NOXOS build script ]=====!" case $1 in "check") @@ -108,8 +107,7 @@ case $1 in workspace_setup kernel_build [ ! -d "build/limine" ] && limine_install - libnx_build - shell_build + libnoxos_build generate_initial_ramdisk generate_image ;; diff --git a/initrd/.gitignore b/initrd/.gitignore new file mode 100644 index 0000000..a2e6e6e --- /dev/null +++ b/initrd/.gitignore @@ -0,0 +1,3 @@ + +build/ + diff --git a/initrd/build.bash b/initrd/build.bash new file mode 100644 index 0000000..ae42858 --- /dev/null +++ b/initrd/build.bash @@ -0,0 +1,5 @@ +#!/bin/bash + +cd sources/userland/ +# bash build.bash + diff --git a/initrd/sources/userland b/initrd/sources/userland new file mode 160000 index 0000000..9999b29 --- /dev/null +++ b/initrd/sources/userland @@ -0,0 +1 @@ +Subproject commit 9999b292ac52afd0ff629b566b372aeb5db978cf diff --git a/libraries/libnoxos b/libraries/libnoxos new file mode 160000 index 0000000..d5ed088 --- /dev/null +++ b/libraries/libnoxos @@ -0,0 +1 @@ +Subproject commit d5ed088f54751dd1874aaf2c2678cc5ab292434a diff --git a/ramdisk/modules/config.json b/ramdisk/modules/config.json deleted file mode 100644 index 789f9ac..0000000 --- a/ramdisk/modules/config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "drivers": - [ - { - "name": "nxFAT32", - "author": "NOXOS Authors", - "category": "filesystem", - "type": "fat32", - - "definition-path": "/modules/fat32/definition.json", - "binary-path": "/modules/fat32/driver.so" - } - ] -} - diff --git a/ramdisk/modules/fat32/config.json b/ramdisk/modules/fat32/config.json deleted file mode 100644 index 8d1c8b6..0000000 --- a/ramdisk/modules/fat32/config.json +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ramdisk/modules/fat32/definition.json b/ramdisk/modules/fat32/definition.json deleted file mode 100644 index 8d1c8b6..0000000 --- a/ramdisk/modules/fat32/definition.json +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ramdisk/noxos.json b/ramdisk/noxos.json deleted file mode 100644 index a0bd89f..0000000 --- a/ramdisk/noxos.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "PS2_ACPI_VALIDATION": true, - "LOG_GRAPHICAL": true, - - "modules": { - "FAT32": "/initrd/modules/fat32.nxkm" - } -} diff --git a/ramdisk/test.txt b/ramdisk/test.txt deleted file mode 100644 index 6c3059e..0000000 --- a/ramdisk/test.txt +++ /dev/null @@ -1,11 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. -Proin molestie porta erat eu interdum. -Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. -Cras semper porta ligula quis condimentum. -Aliquam sed bibendum diam, sit amet gravida orci. -Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. -Proin vitae urna vel magna luctus pulvinar. -Etiam diam diam, vulputate nec eros a, bibendum tristique velit. -Donec interdum consectetur vehicula. -Vestibulum gravida varius nisi non fringilla. -Nam eu accumsan erat, ac condimentum massa. diff --git a/shell.c b/shell.c deleted file mode 100644 index 1922021..0000000 --- a/shell.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "nox/stdio.h" -#include "nox/memory.h" -#include "nox/math.h" - -#define COMMAND_BUFFER_SIZE 512 - -int read_command(char* command_buffer) { - char chr = 0; - int pos = 0; - while (chr != '\n') { - chr = getc(); - switch (chr) { - case '\b': { - if (pos > 0) pos--; - break; - } - default: { - if (pos < COMMAND_BUFFER_SIZE) { - command_buffer[pos] = chr; - pos++; - } - break; - } - } - } - - command_buffer[--pos] = '\0'; - return pos; -} - -bool handle_command(char* command_buffer) { - int command_length = strlen(command_buffer); - - if (command_length < 2) return true; - - if (memcmp(command_buffer, "help", min(4, command_length))) { - printf("Commands:\n"); - printf(" help | shows this help message\n"); - printf(" exit | exit noxsh\n"); - } else if (memcmp(command_buffer, "exit", min(4, command_length))) { - printf("exiting noxsh\n"); - return false; - } else { - printf("Unknown command: '"); - printf(command_buffer); - printf("'\n"); - } - - return true; -} - -void _start() { - printf("Welcome to the nox shell.\ntype 'help' for a list of commands\n"); - - bool running = true; - - while(running) { - printf("\n[/]=> "); - char command_buffer[COMMAND_BUFFER_SIZE]; - read_command(command_buffer); - running = handle_command(command_buffer); - } -} \ No newline at end of file diff --git a/update.bash b/update.bash new file mode 100755 index 0000000..dbef147 --- /dev/null +++ b/update.bash @@ -0,0 +1,5 @@ +#!/bin/bash + +git submodule update libraries/libnoxos/ +git submodule update initrd/sources/userland/ +