From 8d675a7201780c1ef18c7cd22c3e53cfefe98285 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Mon, 1 May 2017 16:45:04 +0200 Subject: playing with vga struct, fixed some boot loading issues --- src/Makefile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 94fb3f1..fcde58d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ CC := gcc -CFLAGS := -std=c99 -m32 -ffreestanding -Os -g -Wall -Werror +CFLAGS := -std=c99 -m32 -ffreestanding -O0 -g -Wall -Werror LD := ld all: image.bin @@ -7,26 +7,30 @@ all: image.bin image.bin: boot.bin kernel.bin cat boot.bin kernel.bin > image.bin # truncate to correct number of sectors, we have - # 512 (boot) + N * 1024 (N currenty is 2) - truncate -s 2560 image.bin + # 512 (boot, first stage) + N * 512 (N currenty is 3) + M * 512 (M is currently 2) + truncate -s 3072 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 -kernel.bin: kernel.o - $(LD) -o kernel.bin -Ttext 0x8000 kernel.o --oformat binary +kernel.bin: kernel.o vga.o string.o + $(LD) -o kernel.bin -Ttext 0x8000 -m elf_i386 --oformat binary \ + kernel.o vga.o string.o kernel.o: kernel.c $(CC) $(CFLAGS) -O0 -c -o kernel.o kernel.c +vga.o: vga.c + $(CC) $(CFLAGS) -O0 -c -o vga.o vga.c + +string.o: string.c + $(CC) $(CFLAGS) -O0 -c -o string.o string.c + clean: -rm -f boot.bin kernel.bin image.bin *.o run-qemu: image.bin - qemu-system-i386 -m 16 -drive "file=image.bin,if=ide,format=raw" + qemu-system-i386 -m 32 -drive "file=image.bin,if=ide,format=raw" run-bochs: bochs -q -f bochs.config 'boot:floppy' 'floppya: 1_44=image.bin, status=inserted' - -functions.o: functions.c - $(CC) $(CFLAGS) -c -o functions.o functions.c -- cgit v1.2.3-54-g00ecf