lesson 14

This commit is contained in:
Carlos Fenollosa
2014-10-20 23:21:20 +02:00
parent 4299cf991b
commit 968211392d
4 changed files with 13 additions and 8 deletions

View File

@@ -12,9 +12,13 @@ CFLAGS = -g
os-image.bin: boot/bootsect.bin kernel.bin
cat $^ > os-image.bin
kernel.bin: kernel.elf
kernel.bin: boot/kernel_entry.o ${OBJ}
i386-elf-ld -o $@ -Ttext 0x1000 $^ --oformat binary
# Used for debugging purposes
kernel.elf: boot/kernel_entry.o ${OBJ}
i386-elf-ld -o $@ -Ttext 0x1000 $^
run: os-image.bin
qemu-system-i386 -fda os-image.bin
@@ -22,10 +26,6 @@ debug: os-image.bin kernel.elf
qemu-system-i386 -s -fda os-image.bin &
${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf"
# To build the kernel: make all objects first
kernel.elf: boot/kernel_entry.o ${OBJ}
i386-elf-ld -o $@ -Ttext 0x1000 $^
# To make an object, always compile from its .c
%.o: %.c ${HEADERS}
${CC} ${CFLAGS} -ffreestanding -c $< -o $@