From 05734c710a0cc5db3dc4430a25d1b65829d874d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kala=C5=A1=20=28Floxen=29?= Date: Mon, 13 Jul 2026 21:56:40 +0200 Subject: [PATCH] =?UTF-8?q?Build:=20zapojen=20bootlog=20objekt=20a=20gener?= =?UTF-8?q?ov=C3=A1n=C3=AD=20po=C4=8Dtu=20sektor=C5=AF=20j=C3=A1dra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eea58fb..260986d 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ KERNEL_OBJS := \ $(BUILD)/arch/x86_64/interrupts.o \ $(BUILD)/arch/x86_64/cpu.o \ $(BUILD)/kernel/main.o \ + $(BUILD)/kernel/bootlog.o \ $(BUILD)/kernel/panic.o \ $(BUILD)/kernel/printk.o \ $(BUILD)/kernel/memory.o \ @@ -54,8 +55,16 @@ $(BUILD): $(BUILD)/boot/boot.bin: boot/boot.asm | $(BUILD) $(AS) -f bin $< -o $@ -$(BUILD)/boot/stage2.bin: boot/stage2.asm boot/disk.asm | $(BUILD) - $(AS) -I boot/ -f bin $< -o $@ +$(BUILD)/boot/kernel_sectors.inc: $(BUILD)/kernel.bin | $(BUILD) + mkdir -p $(dir $@) + @size=$$(wc -c < $(BUILD)/kernel.bin); \ + sectors=$$(( (size + 511) / 512 )); \ + if [ $$sectors -lt 1 ]; then sectors=1; fi; \ + echo "; auto-generated from build/kernel.bin" > $@; \ + echo "KERNEL_SECTORS equ $$sectors" >> $@ + +$(BUILD)/boot/stage2.bin: boot/stage2.asm boot/disk.asm $(BUILD)/boot/kernel_sectors.inc | $(BUILD) + $(AS) -I boot/ -I $(BUILD)/boot/ -f bin $< -o $@ $(BUILD)/arch/x86_64/%.o: arch/x86_64/%.asm | $(BUILD) $(AS) -f elf64 $< -o $@