initial commit

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-03-24 23:44:28 -04:00
commit 7edb312f23
5 changed files with 144 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/var
*.o
*.d
*.sys
*.iso

55
host/bootstrap.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
#
# Copyright (c) 2026, Mirocom Laboratories
# Provided under the BSD-3 clause
#
#
# Check if a list of programs are installed on the system
#
# <@>: List of programs to check
#
check_deps() {
for dep in $@; do
printf "Checking if $dep is installed... "
which $dep &>/dev/null
if [ $? -ne 0 ]; then
echo "no"
echo "Please install $dep!"
exit 1
fi
echo "yes"
done
}
#
# Obtain the Mirocom gcc toolchain
#
get_toolchain() {
if [ ! -d var/cc/toolchain ]; then
git clone https://git.mirocom.org/Mirocom/mirocom-toolchain --depth=1 var/cc/toolchain
cd var/cc/toolchain
tar -xzvf toolchain.tar.gz
mv public/* .; rm -rf public/
cd ../../../
fi
}
#
# Obtain all deps
#
get_deps() {
get_toolchain
}
# Make sure everything is installed
check_deps \
git \
make \
gcc \
xorriso
# Obtain all the deps we need
get_deps

8
host/build.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# Copyright (c) 2026, Mirocom Laboratories
# Provided under the BSD-3 clause
#

39
host/toolchain.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
#
# Copyright (c) 2026, Mirocom Laboratories
# Provided under the BSD-3 clause
#
TARGET=x86_64-pc-mirocom
MAKE=make
mkdir -p var/
mkdir -p var/cc/root/usr/include/
mkdir -p var/cc/root/usr/bin/
# Don't build again if the lock exists
if [ -f var/cc/.lock ]; then
echo "var/cc/.lock exists, skipping toolchain build"
exit 1
fi
pushd var/cc/toolchain
bash build.sh
mkdir -p gcc
pushd gcc
# Configure gcc
../gcc-patched/configure --target=$TARGET \
--prefix=$(pwd) --with-sysroot=$(pwd)/../../root/ \
--disable-nls --enable-languages=c --disable-multilib
# Build gcc
$MAKE all-gcc
$MAKE install-gcc
# Lock the directory
popd
popd
touch var/cc/.lock

37
src/mk/default.mk Normal file
View File

@@ -0,0 +1,37 @@
ARCH_TARGET = x86_64
CC = \
../var/cc/toolchain/gcc/bin/$(ARCH_TARGET)-pc-mirocom-gcc
LD = \
../var/cc/toolchain/build-binutils/bin/$(ARCH_TARGET)-pc-mirocom-ld
AR = \
../var/cc/toolchain/build-binutils/bin/$(ARCH_TARGET)-pc-mirocom-ar
SYS_CFLAGS = \
-nostdlib \
-nostdinc \
-ffreestanding \
-fexceptions \
--std=gnu11 \
-mcmodel=kernel \
-Wno-attributes \
-fno-stack-protector\
-D_M1X_MULTICORE
ifeq ($(ARCH_TARGET),x86_64)
SYS_CFLAGS += \
-mno-sse \
-mno-sse2 \
-mno-sse3 \
-mno-avx \
-mno-avx2 \
-mno-80387 \
-mno-3dnow \
-mno-mmx
endif
PASSDOWN_ARGS = \
ARCH=$(ARCH_TARGET) \
SYS_CC=$(CC) \
SYS_LD=$(LD) \
SYS_CFLAGS="$(SYS_CFLAGS)"