build: Implement build pipeline

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-21 23:29:51 +00:00
parent 994847a73e
commit 71de0c20b8
13 changed files with 361 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
timeout: 16
interface_branding_color: 7
interface_branding: -- Yiff! --
editor_enabled: no
interface_help_hidden: yes
randomize_hhdm_base: yes
/SystemPaw 3
protocol: limine
kernel_path: boot():/boot/stoskrnl.sys
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
.PHONY: all
all: deps iso
.PHONY: deps
deps:
./host/deps.sh
.PHONY: iso
iso:
./host/iso.sh
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
if [ ! -d stand/limine ]; then
git clone https://codeberg.org/Limine/Limine.git --branch=v10.x-binary --depth=1 stand/limine
make -C stand/limine
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
set -e
ISO=$ST_PROJECT_ROOT/artifacts/sp3.iso
CONFIG=$ST_PROJECT_ROOT/paw/base/boot/limine.conf
KERNEL=$ST_PROJECT_ROOT/artifacts/stoskrnl.sys
mkdir -p iso_root/boot/
# Copy the kernel to the ISO root
cp $KERNEL iso_root/boot
# Copy boot files
cp $CONFIG stand/limine/limine-bios.sys \
stand/limine/limine-bios-cd.bin \
stand/limine/limine-uefi-cd.bin \
iso_root/
# Generate the ISO
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 \
-boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part \
--efi-boot-image --protective-msdos-label iso_root/ -o $ISO 2>/dev/null
stand/limine/limine bios-install $ISO 2>/dev/null
rm -rf iso_root
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
# Description: Build envs
# Author: Chloe M.
#
# Source build variables
. paw/devel/vars.env
# Export envs
export ST_PROJECT_ROOT=$ST_PROJECT_ROOT
export ST_TARGET_ARCH=$ST_TARGET_ARCH
export ST_BOOT_PROTOCOL=$ST_BOOT_PROTOCOL
if [ "$ST_BUILD_SOURCED" != "1" ]
then
echo "[*] build env ok"
export PS1="~ $PS1"
fi
# Indicate that we have been sourced
export ST_BUILD_SOURCED=1
+11
View File
@@ -0,0 +1,11 @@
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
# Description: Build variables
# Author: Chloe M.
#
ST_PROJECT_ROOT=$(pwd)
ST_TARGET_ARCH=amd64
ST_BOOT_PROTOCOL=limine
+52
View File
@@ -0,0 +1,52 @@
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
# Description: Build flags and such
# Author: Chloe M.
#
PROMPT := printf "%s\t\t%s\n"
CC_PREFIX =
ifeq ($(ST_TARGET_ARCH), amd64)
CC_TARGET = x86_64-unknown-elf
else
CC_TARGET =
endif
CC = \
clang
LD = \
ld
SYS_CFLAGS = \
-nostdlib \
-nostdinc \
-ffreestanding \
-fexceptions \
-target $(CC_TARGET)\
-mcmodel=kernel \
-Wno-attributes \
-Wno-multichar \
-fno-stack-protector\
-D_ST_MULTICORE \
ifeq ($(ST_TARGET_ARCH),amd64)
SYS_CFLAGS += \
-mno-sse \
-mno-sse2 \
-mno-sse3 \
-mno-avx \
-mno-avx2 \
-mno-80387 \
-mno-3dnow \
-mno-mmx
endif
PASSDOWN_ARGS = \
ARCH=$(ST_TARGET_ARCH) \
SYS_CC=$(CC) \
SYS_LD=$(LD) \
SYS_CFLAGS="$(SYS_CFLAGS)"\
ARCH_TARGET=$(ARCH_TARGET)
+17
View File
@@ -0,0 +1,17 @@
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
# Description: OS core build script
# Author: Chloe M.
#
.SILENT:
include ../mk/stos.mk
.PHONY: all
all: machine
.PHONY: machine
machine:
cd arch/$(ST_TARGET_ARCH)/; $(MAKE) $(PASSDOWN_ARGS)
+30
View File
@@ -0,0 +1,30 @@
#
# Copyright (c) 2026, Chloe M.
# Provided under the BSD-3 clause
#
# Description: AMD64 port build script
# Author: Chloe M.
#
.SILENT:
include ../../../mk/stos.mk
ASMFILES = $(shell find . -name "*.S")
ASMOFILES = $(ASMFILES:.S=.S.o)
KERNEL_PATH = \
$(ST_PROJECT_ROOT)/artifacts/stoskrnl.sys
CFLAGS = \
$(SYS_CFLAGS)
.PHONY: all
all: bin
.PHONY: bin
bin: $(ASMOFILES)
$(PROMPT) "LD" $(KERNEL_PATH)
$(SYS_LD) -Tdevel/link.ld $(ASMOFILES) -o $(KERNEL_PATH)
%.S.o: %.S
$(PROMPT) "AS" $<
$(SYS_CC) -c $< $(CFLAGS) -o $@
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Low-level processor init
* Author: Chloe M.
*/
.text
.globl _start
_start:
cli /* Just in case */
xor %rbp, %rbp /* Terminate callstack */
mfence /* Flush caches */
1: cli /* Disable interrupts */
hlt /* Suspend processor */
+66
View File
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Kernel linker script
* Author: Chloe M.
*/
OUTPUT_FORMAT(elf64-x86-64)
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
PHDRS {
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ;
rodata PT_LOAD FLAGS((1 << 2)) ;
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ;
}
SECTIONS
{
. = 0xFFFFFFFF80000000;
__KernelStart = .;
.text : {
*(.text .text.*)
} :text
. += CONSTANT(MAXPAGESIZE);
.rodata : {
*(.rodata .rodata.*)
} :rodata
. += CONSTANT(MAXPAGESIZE);
.driver : {
__driver_start = .;
KEEP(*(.driver .driver));
__driver_end = .;
}
. += CONSTANT(MAXPAGESIZE);
.font : {
KEEP(*(.font .font));
}
. += CONSTANT(MAXPAGESIZE);
.data : {
*(.data)
} :data
.bss : {
*(COMMON)
*(.bss .bss.*)
} :data
__KernelEnd = .;
. += CONSTANT(MAXPAGESIZE);
/DISCARD/ : {
*(.eh_frame .eh_frame.*)
*(.note .note.*)
}
}