From: Duje Mihanović Date: Thu, 16 Sep 2021 14:48:26 +0000 (+0200) Subject: Also compile kernel as ELF for easier disassembly X-Git-Tag: 0.1.0~18 X-Git-Url: https://git.dujemihanovic.xyz/repo?a=commitdiff_plain;h=9ef60208fec0c672248023d467f57eecd6e7214f;p=nameless-os.git Also compile kernel as ELF for easier disassembly --- diff --git a/Makefile b/Makefile index 8d4b365..ce6fccc 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CC = i686-elf-gcc KERNEL_OBJ = kernel/entry.o kernel/arch/x86/tty/tty.o kernel/kernel.o -all: boot.img +all: boot.img kernel/kernel.elf boot.img: boot/x86/boot kernel/kernel.bin cat boot/x86/boot kernel/kernel.bin > $@ @@ -14,7 +14,7 @@ boot/x86/boot: boot/x86/boot.s boot/x86/a20.s boot/x86/protected.s boot/x86/prin $(AS) -f bin boot/x86/boot.s -o $@ kernel/kernel.bin: ${KERNEL_OBJ} - $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} --oformat=binary + $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} kernel/entry.o: kernel/entry.s $(AS) -f elf kernel/entry.s -o $@ @@ -25,6 +25,9 @@ kernel/arch/x86/tty/tty.o: kernel/arch/x86/tty/tty.c kernel/kernel.o: kernel/kernel.c $(CC) -g -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/kernel.c +kernel/kernel.elf: kernel/kernel.bin + $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} --oformat=elf32-i386 + clean: rm boot/x86/boot kernel/kernel.bin ${KERNEL_OBJ} boot.img diff --git a/kernel/arch/x86/tty/tty.c b/kernel/arch/x86/tty/tty.c index c1bb0a5..d3ef87b 100644 --- a/kernel/arch/x86/tty/tty.c +++ b/kernel/arch/x86/tty/tty.c @@ -1,7 +1,7 @@ #define VGA_WIDTH 80 #define VGA_HEIGHT 25 -char *video_memory = (char *) 0xB8000; /* VGA VRAM starts at 0xB8000 */ +volatile char *video_memory = (char *) 0xB8000; /* VGA VRAM starts at 0xB8000 */ static int cursor_x = 0; static int cursor_y = 0;