summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIan M. <ian@aptel.org>2026-09-11 03:45:03 +0000
committerIan M. <ian@aptel.org>2026-09-11 03:46:03 +0000
commit4f97daf67e0baaf64251b5643af5c9552c522156 (patch)
treea9a45abcf288fa538b03fb566d2ee5c069b2af4e /test
initial commit
Signed-off-by: Ian M. <ian@aptel.org>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile36
-rw-r--r--test/link.ld27
-rw-r--r--test/test.c5
3 files changed, 68 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..2cfdf95
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2026, Apollo Telephone Laboratories.
+# Provided under the BSD-3 clause.
+#
+
+IMG_PATH = sboot.img
+
+CC = clang
+LD = ld.lld
+OBJCOPY = llvm-objcopy
+
+CFLAGS = \
+ -Wall \
+ -pedantic \
+ -ffreestanding \
+ -mno-red-zone \
+ -mno-avx \
+ -mno-avx2 \
+ -mno-sse2 \
+ -nostdlib \
+ -nostdinc
+
+.PHONY: all
+all: test
+ rm -f $(IMG_PATH)
+ mkfs.fat -C $(IMG_PATH) 4096
+ mmd -i $(IMG_PATH) ::/EFI
+ mmd -i $(IMG_PATH) ::/EFI/BOOT
+ mcopy -i $(IMG_PATH) kernel.bin ::
+ mcopy -i $(IMG_PATH) ../BOOTX64.EFI ::EFI/BOOT
+
+.PHONY: test
+test:
+ $(CC) -c $(CFLAGS) test.c -o test.o
+ $(LD) -Tlink.ld test.o -o kernel.sys
+ $(OBJCOPY) -O binary kernel.sys kernel.bin
diff --git a/test/link.ld b/test/link.ld
new file mode 100644
index 0000000..2899d94
--- /dev/null
+++ b/test/link.ld
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2026, Apollo Telephone Laboratories.
+ * Provided under the BSD-3 clause.
+ */
+
+ENTRY(main)
+
+SECTIONS {
+ . = 0xFFFFFFFF80000000;
+
+ .text : {
+ *(.text .text.*)
+ }
+
+ .data : {
+ *(.data .data.*)
+ }
+
+ .rodata :{
+ *(.rodata .rodata.*)
+ }
+
+ .bss : {
+ *(COMMON)
+ *(.bss .bss.*)
+ }
+}
diff --git a/test/test.c b/test/test.c
new file mode 100644
index 0000000..66b8c19
--- /dev/null
+++ b/test/test.c
@@ -0,0 +1,5 @@
+void
+main(void)
+{
+ for (;;);
+}