Squash commits for public release

This commit is contained in:
2025-02-12 09:54:05 -05:00
commit 7118adc514
1108 changed files with 80873 additions and 0 deletions

20
build/boot/x86/BUILD.gn Normal file
View File

@@ -0,0 +1,20 @@
if (target_arch == "x86") {
action("bootx86") {
script = "make_boot_drive.py"
sources = [
"$root_build_dir/stage1.bin",
"$root_build_dir/stage2.bin",
]
outputs = [ "$root_build_dir/os-image.bin" ]
args = [
rebase_path("$root_build_dir/stage1.bin", root_build_dir),
rebase_path("$root_build_dir/stage2.bin", root_build_dir),
rebase_path("$root_build_dir/os-image.bin", root_build_dir),
]
deps = [
"stage1:stage1",
"stage2:stage2",
]
}
}

View File

@@ -0,0 +1,42 @@
_pa_base = 0x1000;
ENTRY(_pa_base)
SECTIONS
{
. = _pa_base;
bootloader_start = .;
.text ALIGN(4K) :
{
*(.xos_boot_text)
*(.text)
*(.text.*)
}
.rodata :
{
*(.rodata)
*(.rodata.*)
}
.data :
{
*(.data)
*(.data.*)
}
.bss :
{
*(.bss)
*(.bss.*)
*(COMMON)
}
.stack ALIGN(4K) :
{
STACK_PHYZ_BASE = .;
. += 0x1000;
STACK_PHYZ_TOP = .;
}
}

View File

@@ -0,0 +1,7 @@
import sys
inf = sys.argv[1]
outf = sys.argv[2]
reli = sys.argv[3]
import subprocess
output = subprocess.check_output("cat {0} {1} > {2}".format(inf, outf, reli), shell=True)

View File

@@ -0,0 +1,21 @@
action("stage1") {
script = "compile_stage1.py"
sources = [ "//boot/x86/stage1/boot.s" ]
outputs = [ "$root_build_dir/stage1.bin" ]
inputs = [
"//boot/x86/stage1/boot.s",
"//boot/x86/stage1/utils16/disk_load.s",
"//boot/x86/stage1/utils16/print.s",
"//boot/x86/stage1/utils16/smm.s",
"//boot/x86/stage1/utils16/switch_to_pm.s",
"//boot/x86/stage1/utils32/gdt.s",
"//boot/x86/stage1/utils32/print.s",
]
args = [
rebase_path("//boot/x86/stage1/boot.s", root_build_dir),
rebase_path(root_build_dir, root_build_dir),
rebase_path("//", root_build_dir),
]
}

View File

@@ -0,0 +1,7 @@
import sys
inf = sys.argv[1]
outf = sys.argv[2]
reli = sys.argv[3]
import subprocess
output = subprocess.check_output("nasm {0} -f bin -i {2} -o {1}/stage1.bin".format(inf, outf, reli), shell=True)

View File

@@ -0,0 +1,48 @@
linker_script =
rebase_path("//build/boot/$target_arch/boot_link.ld", root_build_dir)
executable("stage2") {
output_name = "stage2.bin"
sources = [
"//boot/libboot/crypto/sha256.c",
"//boot/libboot/crypto/signature.c",
"//boot/libboot/crypto/uint2048.c",
"//boot/libboot/crypto/validate.c",
"//boot/libboot/devtree/devtree.c",
"//boot/libboot/elf/elf_lite.c",
"//boot/libboot/fs/ext2_lite.c",
"//boot/libboot/log/log.c",
"//boot/libboot/mem/alloc.c",
"//boot/libboot/mem/mem.c",
"//boot/x86/stage2/drivers/ata.c",
"//boot/x86/stage2/drivers/port.c",
"//boot/x86/stage2/drivers/uart.c",
"//boot/x86/stage2/mem/vm.c",
"//boot/x86/stage2/stage2.c",
"//boot/x86/stage2/stage2_entry.s",
]
include_dirs = [ "//boot" ]
ldflags = [
"-T$linker_script",
"--oformat",
"binary",
"-Map=stage2.map",
]
cflags = [
"-ffreestanding",
"-Werror",
"-Wno-address-of-packed-member",
"-mno-80387",
"-mno-mmx",
"-mno-sse",
"-mno-sse2",
]
asmflags = [
"-f",
"elf",
]
}