diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-27 01:22:42 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-27 01:22:42 +0000 |
| commit | 938773d9cc062fd028f6560b1127a2ecd23f61c3 (patch) | |
| tree | 403aacd629975440ba23a645975c34a141d634ee /examples/bootloader/Makefile | |
| parent | 2f47bdf7f49f05bd421e4182635f489c8cae01b3 (diff) | |
Fixed constant hex/oct bug + Fixed some of the examples (work in progress) + added bootloader example (I will add some docs)
Diffstat (limited to 'examples/bootloader/Makefile')
| -rw-r--r-- | examples/bootloader/Makefile | 29 |
1 files changed, 29 insertions, 0 deletions
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 |
