summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorChloe M. <chloe@aptel.org>2026-08-20 08:36:36 +0000
committerChloe M. <chloe@aptel.org>2026-08-20 08:36:36 +0000
commitd739670937e0d411bca437cfa69f47938a7d8d9f (patch)
tree7e9cef28aa89bd9ff5f921dccd3807d26d17c211 /boot
parenta85b624c0698873155668ff91fc8edc39fb1c33e (diff)
boot/amd64: Add second stage groundwork
Signed-off-by: Chloe M. <chloe@aptel.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/arch/amd64/Makefile6
-rw-r--r--boot/arch/amd64/biosboot/Makefile16
-rw-r--r--boot/arch/amd64/biosboot/biosboot.S5
-rwxr-xr-xboot/arch/amd64/mbr/host/bootfs.sh8
4 files changed, 30 insertions, 5 deletions
diff --git a/boot/arch/amd64/Makefile b/boot/arch/amd64/Makefile
index e92fecb..5185063 100644
--- a/boot/arch/amd64/Makefile
+++ b/boot/arch/amd64/Makefile
@@ -1,5 +1,9 @@
.PHONY: all
-all: mbr
+all: biosboot mbr
+
+.PHONY: biosboot
+biosboot:
+ cd biosboot/; $(MAKE)
.PHONY: mbr
mbr:
diff --git a/boot/arch/amd64/biosboot/Makefile b/boot/arch/amd64/biosboot/Makefile
new file mode 100644
index 0000000..c782240
--- /dev/null
+++ b/boot/arch/amd64/biosboot/Makefile
@@ -0,0 +1,16 @@
+CC = clang
+CFLAGS = \
+ -ffreestanding \
+ -nostdlib \
+ -nostdinc \
+ -mno-red-zone \
+ -mno-sse \
+ -mno-sse2 \
+ -target i386-unknown-elf
+
+.PHONY: all
+all: biosboot
+
+.PHONY: biosboot
+biosboot:
+ clang -T../mbr/link.ld $(CFLAGS) biosboot.S -o biosboot.bin
diff --git a/boot/arch/amd64/biosboot/biosboot.S b/boot/arch/amd64/biosboot/biosboot.S
new file mode 100644
index 0000000..717d29d
--- /dev/null
+++ b/boot/arch/amd64/biosboot/biosboot.S
@@ -0,0 +1,5 @@
+ .code16
+_start:
+ cli
+ hlt
+ jmp _start
diff --git a/boot/arch/amd64/mbr/host/bootfs.sh b/boot/arch/amd64/mbr/host/bootfs.sh
index 0f20a83..ce1eccc 100755
--- a/boot/arch/amd64/mbr/host/bootfs.sh
+++ b/boot/arch/amd64/mbr/host/bootfs.sh
@@ -1,9 +1,9 @@
#!/bin/bash
-mkdir -p boot_root
-echo "&" >boot_root/test.txt
-rdar -i boot_root -o bootfs.rdar
+mkdir -p boot
+mv ../biosboot/biosboot.bin boot
+rdar -i boot -o bootfs.rdar
dd if=/dev/zero of=/tmp/zero count=4096 bs=1
cat mbr.bin bootfs.rdar /tmp/zero >$GLOBAL_PROJECT_ROOT/artifacts/mbr.bin
-rm -rf boot_root/
+rm -rf boot/