initial commit

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

5
.gitignore vendored Normal file
View File

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

19
README.md Normal file
View File

@@ -0,0 +1,19 @@
# The M1X operating system
M1X is an operating system partially inspired by Solaris aiming to provide a pragmatic
capability based security environment. M1X follows the "(almost) everything is a file"
philosophy in which machine resources and files are accessible through a unified file
interface similar to those found in POSIX environments, however, the underlying file
management mechanisms are to be handled orthogonally to machine resource managment.
The way this is to be done is by introducing the concept of filepath prefixes which
allow the kernel to differentiate between machine resources and true files.
## Building M1X
To build M1X, start with obtaining required dependencies by executing the ``bootstrap.sh``
script found within the top-level ``host/`` directory. After which, one may build the toolchain
by invoking ``toolchain.sh`` which is found in the same directory.
Once the toolchain is complete, the world can be built by invoking the ``build.sh`` script located
in the top-level ``host/`` directory.

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

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)"