Slightly bigger restructuring to get the dependencies into this repo

This commit is contained in:
Eric-Paul Ickhorn 2023-05-29 22:59:31 +02:00
parent 2f9ca93cb1
commit 1ad60a7351
13 changed files with 32 additions and 112 deletions

6
.gitmodules vendored Normal file
View File

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

View File

@ -3,6 +3,7 @@
# This file is part of noxos and licensed under the MIT open source license # This file is part of noxos and licensed under the MIT open source license
set -e set -e
PROJECT_ROOT=$PWD
workspace_setup() { workspace_setup() {
echo " --> Setting up workspace" echo " --> Setting up workspace"
@ -42,17 +43,12 @@ kernel_build() {
echo "" echo ""
} }
libnx_build() { libnoxos_build() {
cd ../libnx cd libraries/libnoxos/
bash build.sh # bash build.sh
cd ../kernel 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() { limine_install() {
echo " --> Installing Limine" echo " --> Installing Limine"
cd build cd build
@ -67,7 +63,10 @@ limine_install() {
generate_initial_ramdisk() { generate_initial_ramdisk() {
echo " --> Generating initrd" 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() { generate_image() {
@ -98,7 +97,7 @@ generate_image() {
echo "" echo ""
} }
echo "!=====[ NoxOS build script ]=====!" echo "!=====[ NOXOS build script ]=====!"
case $1 in case $1 in
"check") "check")
@ -108,8 +107,7 @@ case $1 in
workspace_setup workspace_setup
kernel_build kernel_build
[ ! -d "build/limine" ] && limine_install [ ! -d "build/limine" ] && limine_install
libnx_build libnoxos_build
shell_build
generate_initial_ramdisk generate_initial_ramdisk
generate_image generate_image
;; ;;

3
initrd/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/

5
initrd/build.bash Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
cd sources/userland/
# bash build.bash

@ -0,0 +1 @@
Subproject commit 9999b292ac52afd0ff629b566b372aeb5db978cf

1
libraries/libnoxos Submodule

@ -0,0 +1 @@
Subproject commit d5ed088f54751dd1874aaf2c2678cc5ab292434a

View File

@ -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"
}
]
}

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -1,8 +0,0 @@
{
"PS2_ACPI_VALIDATION": true,
"LOG_GRAPHICAL": true,
"modules": {
"FAT32": "/initrd/modules/fat32.nxkm"
}
}

View File

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

63
shell.c
View File

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

5
update.bash Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
git submodule update libraries/libnoxos/
git submodule update initrd/sources/userland/