summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-05-20 09:07:56 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-05-20 09:07:56 +0200
commitd1e408a2f7931732bc98809d36c28c47563fdbd3 (patch)
treef6c2b3ed49516df57fa6ef75650bcf498e92d5a2 /src/Makefile
parent45212640af40bed34a21c9b0b0640e17e945ed5c (diff)
downloadabaos-d1e408a2f7931732bc98809d36c28c47563fdbd3.tar.gz
abaos-d1e408a2f7931732bc98809d36c28c47563fdbd3.tar.bz2
precomputing MAGIC in makefile, magic.asm and stage2 magic check are in different assembly units, so we cannot use date and time
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index affe3e3..1b77e89 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,6 +4,7 @@ LD := ld
NASMFLAGS := -f elf32
NASM := nasm
OBJCOPY := objcopy
+MAGIC = $(shell printf '%x' `date +%s`)
all: image.bin kernel.sym
@@ -19,7 +20,7 @@ image.bin: boot.bin kernel.bin magic.bin
cat image.tmp magic.bin > image.bin
boot.bin: boot.asm gdt.asm stage1_functions.asm stage2_functions.asm switch_mode.asm
- $(NASM) boot.asm -f bin -o boot.bin
+ $(NASM) boot.asm -DMAGIC='"$(MAGIC)"' -f bin -o boot.bin
kernel.bin: kernel.elf
$(OBJCOPY) -O binary kernel.elf kernel.bin
@@ -33,7 +34,7 @@ kernel.elf: kernel.o console.o vga.o serial.o port.o port_asm.o interrupts.o int
interrupts.o interrupts_asm.o string.o stdlib.o
magic.bin: magic.asm
- $(NASM) magic.asm -f bin -o magic.bin
+ $(NASM) magic.asm -DMAGIC='"$(MAGIC)"' -f bin -o magic.bin
kernel.o: kernel.c
$(CC) $(CFLAGS) -c -o kernel.o kernel.c