build: Add initial build files
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
12
host/build.sh
Executable file
12
host/build.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
# Provided under the BSD-3 clause
|
||||||
|
#
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd src/; make -j1
|
||||||
|
}
|
||||||
|
|
||||||
|
build
|
||||||
11
src/Makefile
Normal file
11
src/Makefile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
# Provided under the BSD-3 clause
|
||||||
|
#
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: m1x
|
||||||
|
|
||||||
|
.PHONY: m1x
|
||||||
|
m1x:
|
||||||
|
cd m1x/; make
|
||||||
13
src/m1x/Makefile
Normal file
13
src/m1x/Makefile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
# Provided under the BSD-3 clause
|
||||||
|
#
|
||||||
|
|
||||||
|
include ../mk/default.mk
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: arch
|
||||||
|
|
||||||
|
.PHONY: arch
|
||||||
|
arch:
|
||||||
|
cd arch/$(ARCH_TARGET)/; make $(PASSDOWN_ARGS)
|
||||||
34
src/m1x/arch/x86_64/Makefile
Normal file
34
src/m1x/arch/x86_64/Makefile
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
# Provided under the BSD-3 clause
|
||||||
|
#
|
||||||
|
|
||||||
|
MISC_OFILES = $(shell find ../../ -name "*.o")
|
||||||
|
|
||||||
|
ASMFILES = $(shell find . -name "*.S" | grep -v "boot")
|
||||||
|
ASMOFILES = $(ASMFILES:.S=.S.o)
|
||||||
|
CFILES = $(shell find . -name "*.c")
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
DFILES = $(shell find . -name "*.d")
|
||||||
|
|
||||||
|
KERN_BIN = ../../m1x.sys
|
||||||
|
|
||||||
|
LD = ../../../$(SYS_LD)
|
||||||
|
CC = ../../../$(SYS_CC)
|
||||||
|
|
||||||
|
CFLAGS = \
|
||||||
|
$(SYS_CFLAGS) \
|
||||||
|
-D_KERNEL \
|
||||||
|
-I../../target/ \
|
||||||
|
-I../../include/ \
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: $(OFILES) $(ASMOFILES)
|
||||||
|
$(LD) $(MISC_OFILES) -Tconf/link.ld -o $(KERN_BIN) $(LDFLAGS)
|
||||||
|
|
||||||
|
%.S.o: %.S
|
||||||
|
$(CC) -c $< $(CFLAGS) -o $@
|
||||||
|
|
||||||
|
-include $(DFILES)
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c $< $(CFLAGS) -I../../inc/ -MMD -o $@
|
||||||
43
src/m1x/arch/x86_64/conf/link.ld
Normal file
43
src/m1x/arch/x86_64/conf/link.ld
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
.text : {
|
||||||
|
*(.text .text.*)
|
||||||
|
} :text
|
||||||
|
|
||||||
|
. += CONSTANT(MAXPAGESIZE);
|
||||||
|
|
||||||
|
.rodata : {
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
} :rodata
|
||||||
|
|
||||||
|
. += CONSTANT(MAXPAGESIZE);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
*(.data)
|
||||||
|
} :data
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
*(COMMON)
|
||||||
|
*(.bss .bss.*)
|
||||||
|
} :data
|
||||||
|
|
||||||
|
. += CONSTANT(MAXPAGESIZE);
|
||||||
|
|
||||||
|
/DISCARD/ : {
|
||||||
|
*(.eh_frame .eh_frame.*)
|
||||||
|
*(.note .note.*)
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/m1x/arch/x86_64/cpu/locore.S
Normal file
15
src/m1x/arch/x86_64/cpu/locore.S
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
.globl _start
|
||||||
|
_start:
|
||||||
|
cli
|
||||||
|
cld
|
||||||
|
|
||||||
|
xor %rbp, %rbp
|
||||||
|
|
||||||
|
1: hlt
|
||||||
|
jmp 1b
|
||||||
Reference in New Issue
Block a user