From 793fbcd03cc830f09746e8d96b70cd17f41b4a69 Mon Sep 17 00:00:00 2001 From: Thomas Oltmann Date: Fri, 4 Jul 2025 03:10:55 +0200 Subject: [PATCH] First sign of life --- .gitignore | 5 +++++ Makefile | 21 +++++++++++++++++++++ Readme.md | 2 ++ boot16.S | 14 ++++++++++++++ config.default.mk | 5 +++++ fernlader.ld | 6 ++++++ run-qemu.sh | 2 ++ 7 files changed, 55 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 Readme.md create mode 100644 boot16.S create mode 100644 config.default.mk create mode 100644 fernlader.ld create mode 100755 run-qemu.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f5d9c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +config.mk + +*.o +boot.bin +boot.elf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b953e39 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +-include config.mk + +.PHONY: all clean + +all: boot.bin + +clean: + rm -f *.o + rm -f boot.elf boot.bin + +config.mk: | config.default.mk + cp config.default.mk $@ + +boot.bin: boot.elf + objcopy -O binary --only-section=.text boot.elf $@ + +boot.elf: boot16.o fernlader.ld + $(LD) $(LDFLAGS) -o $@ boot16.o + +.S.o: + $(CC) $(CFLAGS) -c -o $@ $(@:.o=.S) diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..2110f08 --- /dev/null +++ b/Readme.md @@ -0,0 +1,2 @@ +# fernlader -- bootboot-compliant PXE bootloader + diff --git a/boot16.S b/boot16.S new file mode 100644 index 0000000..e5ac141 --- /dev/null +++ b/boot16.S @@ -0,0 +1,14 @@ + // vim: et:sw=12:ts=12:sts=12 + + .code16 + .global _start + .text + +_start: + xor %bx, %bx + mov $0x0E, %ah + mov $'A', %al + int $0x10 + +1: hlt + jmp 1b diff --git a/config.default.mk b/config.default.mk new file mode 100644 index 0000000..576b634 --- /dev/null +++ b/config.default.mk @@ -0,0 +1,5 @@ +CC = cc +LD = ld + +CFLAGS = -no-pie -fno-pic +LDFLAGS = -Tfernlader.ld diff --git a/fernlader.ld b/fernlader.ld new file mode 100644 index 0000000..989ace6 --- /dev/null +++ b/fernlader.ld @@ -0,0 +1,6 @@ +SECTIONS { + . = 0x7C00; + .text : { + *(*) + } +} diff --git a/run-qemu.sh b/run-qemu.sh new file mode 100755 index 0000000..0cc4dc7 --- /dev/null +++ b/run-qemu.sh @@ -0,0 +1,2 @@ +#!/bin/sh +qemu-system-x86_64 -netdev user,id=n1,net=10.0.0.5/24,tftp=netboot,bootfile=/boot.bin -device virtio-net-pci,netdev=n1