From 938773d9cc062fd028f6560b1127a2ecd23f61c3 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 27 Jan 2026 01:22:42 +0000 Subject: Fixed constant hex/oct bug + Fixed some of the examples (work in progress) + added bootloader example (I will add some docs) --- examples/bootloader/Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/bootloader/Makefile (limited to 'examples/bootloader/Makefile') diff --git a/examples/bootloader/Makefile b/examples/bootloader/Makefile new file mode 100644 index 0000000..5ee3da9 --- /dev/null +++ b/examples/bootloader/Makefile @@ -0,0 +1,29 @@ + +CC = gcc +ZC = ../../zc +LD = ld +OBJCOPY = objcopy + +CFLAGS = -m32 -ffreestanding -fno-pie -fno-stack-protector -nostdlib -O2 -Wall +LDFLAGS = -m elf_i386 -T linker.ld + +all: boot.bin + +boot.bin: boot.o kernel.o + $(LD) $(LDFLAGS) -o boot.elf boot.o kernel.o + $(OBJCOPY) -O binary boot.elf boot.bin + truncate -s 1024 boot.bin + @echo "Bootloader built: boot.bin (Size: $$(stat -c %s boot.bin) bytes)" + +boot.o: boot.S + $(CC) $(CFLAGS) -c boot.S -o boot.o + +kernel.o: kernel.c + $(CC) $(CFLAGS) -c kernel.c -o kernel.o + +kernel.c: kernel.zc + $(ZC) transpile --freestanding kernel.zc + mv out.c kernel.c + +clean: + rm -f *.o *.bin *.elf kernel.c -- cgit v1.2.3