kernel: Rewrite from scratch since the current thing is held by duct tape (lmao)

This commit is contained in:
RaphProductions 2025-05-18 09:04:25 +02:00
parent d017412af5
commit a1e27c2730
117 changed files with 285 additions and 13622 deletions

View file

@ -1,16 +1,15 @@
#! /bin/sh
set -ex
srcdir="$(dirname "$0")"
test -z "$srcdir" && srcdir=.
cd "$srcdir"
clone_repo_commit() {
echo " DEPS Cloning $1 to $2 (commit: $3)"
if test -d "$2/.git"; then
git -C "$2" reset --hard
git -C "$2" clean -fd
git -C "$2" reset --hard > /dev/null 2>&1
git -C "$2" clean -fd > /dev/null 2>&1
if ! git -C "$2" checkout $3; then
rm -rf "$2"
fi
@ -22,8 +21,8 @@ clone_repo_commit() {
fi
fi
if ! test -d "$2"; then
git clone $1 "$2"
if ! git -C "$2" checkout $3; then
git clone $1 "$2" > /dev/null 2>&1
if ! git -C "$2" checkout $3 > /dev/null 2>&1; then
rm -rf "$2"
exit 1
fi
@ -32,27 +31,28 @@ clone_repo_commit() {
download_by_hash() {
DOWNLOAD_COMMAND="curl -Lo"
if ! command -v $DOWNLOAD_COMMAND >/dev/null 2>&1; then
if ! command -v "${DOWNLOAD_COMMAND%% *}" >/dev/null 2>&1; then
DOWNLOAD_COMMAND="wget -O"
if ! command -v $DOWNLOAD_COMMAND >/dev/null 2>&1; then
if ! command -v "${DOWNLOAD_COMMAND%% *}" >/dev/null 2>&1; then
set +x
echo "error: Neither curl nor wget found"
exit 1
fi
fi
SHA256_COMMAND="sha256sum"
if ! command -v $SHA256_COMMAND >/dev/null 2>&1; then
if ! command -v "${SHA256_COMMAND%% *}" >/dev/null 2>&1; then
SHA256_COMMAND="sha256"
if ! command -v $SHA256_COMMAND >/dev/null 2>&1; then
if ! command -v "${SHA256_COMMAND%% *}" >/dev/null 2>&1; then
set +x
echo "error: Cannot find sha256(sum) command"
exit 1
fi
fi
echo " DEPS Downloading $1 to $2"
if ! test -f "$2" || ! $SHA256_COMMAND "$2" | grep $3 >/dev/null 2>&1; then
rm -f "$2"
mkdir -p "$2" && rm -rf "$2"
$DOWNLOAD_COMMAND "$2" $1
$DOWNLOAD_COMMAND "$2" $1 > /dev/null 2>&1
if ! $SHA256_COMMAND "$2" | grep $3 >/dev/null 2>&1; then
set +x
echo "error: Cannot download file '$2' by hash"
@ -64,17 +64,29 @@ download_by_hash() {
fi
}
clone_repo_commit \
https://github.com/osdev0/freestnd-c-hdrs-0bsd.git \
freestnd-c-hdrs \
a87c192f3eb66b0806740dc67325f9ad23fc2d0b
mkdir src/deps
clone_repo_commit \
https://github.com/osdev0/cc-runtime.git \
cc-runtime \
576a01179f3298a4795b92f42c088f9f8800b56b
https://codeberg.org/mintsuki/flanterm \
src/deps/flanterm \
bdecdcb1b7dad05ab5249e2c3e4d2c27a661e864
clone_repo_commit \
https://codeberg.org/osdev/freestnd-c-hdrs-0bsd.git \
src/deps/freestnd-c-hdrs \
a87c192f3eb66b0806740dc67325f9ad23fc2d0b
download_by_hash \
https://codeberg.org/osdev/cc-runtime/raw/commit/d5425655388977fa12ff9b903e554a20b20c426e/cc-runtime.c \
src/deps/cc-runtime.c \
60bb1af4f6541077b736f19bf0f5a22b5dd8a2f3bed0d9d9d89846a33ef24b74
download_by_hash \
https://github.com/limine-bootloader/limine/raw/4687a182be23939c2d9f15db970382dc353ed956/limine.h \
src/limine.h \
src/deps/limine.h \
6879e626f34c1be25ac2f72bf43b083fc2b53887280bb0fcdaee790e258c6974
download_by_hash \
https://github.com/charlesnicholson/nanoprintf/raw/49628bd79977478dbd7c9a1b5277c44e5d49b118/nanoprintf.h \
src/deps/npf.h \
ef496c71868b3942695f63e0215da9d25ebdfa21569c854950e8f91adb9e0bea