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
+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.*)
}
}