Updated Makefile to allow debugging. Update gitignore.
This commit is contained in:
parent
bfa3f3030f
commit
760069bbb9
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,4 +3,5 @@
|
||||
*.stage2
|
||||
*.sector
|
||||
*.o
|
||||
img.d/
|
||||
img.d/
|
||||
build/
|
12
Makefile
12
Makefile
@ -1,5 +1,5 @@
|
||||
CFLAGS = -std=gnu11 -m32 -mgeneral-regs-only -nostdlib -fno-builtin -fno-exceptions -fno-leading-underscore -fno-pie -fno-stack-protector -Wno-pointer-to-int-cast
|
||||
CXXFLAGS = -m32 -fno-use-cxa-atexit -mgeneral-regs-only -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -fpermissive -fno-pie -fno-stack-protector -I.
|
||||
CFLAGS = -g -std=gnu11 -m32 -mgeneral-regs-only -nostdlib -fno-builtin -fno-exceptions -fno-leading-underscore -fno-pie -fno-stack-protector -Wno-pointer-to-int-cast
|
||||
CXXFLAGS = -g -m32 -fno-use-cxa-atexit -mgeneral-regs-only -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -fpermissive -fno-pie -fno-stack-protector -I.
|
||||
LDFLAGS =
|
||||
|
||||
DISK_IMG_FILES = build/kernel/kernel.bin hello.txt alpha.txt
|
||||
@ -12,6 +12,9 @@ STAGE2_OBS = build/c_code_entry.o build/boot_stage2/io.o build/boot_stage2/atapi
|
||||
run: disk.img
|
||||
qemu-system-x86_64 disk.img
|
||||
|
||||
debug: disk.img
|
||||
qemu-system-x86_64 -s -S disk.img & gdb --command=gdbscript
|
||||
|
||||
disk.img: clean prepare build/boot/boot.bin build/boot_stage2/boot.bin $(DISK_IMG_FILES)
|
||||
dd if=/dev/zero of=disk.img count=43 bs=100k
|
||||
dd if=build/boot/boot.bin of=disk.img conv=notrunc
|
||||
@ -43,7 +46,10 @@ build/boot_stage2/%.o: src/boot_stage2/%.c
|
||||
gcc $(CFLAGS) -o $@ -c $<
|
||||
|
||||
# Kernel
|
||||
build/kernel/kernel.bin: src/kernel/kernel.ld $(KERNEL_OBJS)
|
||||
build/kernel/kernel.bin: build/kernel/kernel.elf
|
||||
objcopy -O binary build/kernel/kernel.elf build/kernel/kernel.bin
|
||||
|
||||
build/kernel/kernel.elf: src/kernel/kernel.ld $(KERNEL_OBJS)
|
||||
ld $(LDFLAGS) -T $< $(KERNEL_OBJS)
|
||||
|
||||
build/boot_stage2/stage2.o: src/boot_stage2/main.c
|
||||
|
2
gdbscript
Normal file
2
gdbscript
Normal file
@ -0,0 +1,2 @@
|
||||
target remote localhost:1234
|
||||
symbol-file build/kernel/kernel.elf
|
@ -1,7 +1,7 @@
|
||||
OUTPUT_FORMAT(binary)
|
||||
OUTPUT_FORMAT(elf32-i386)
|
||||
OUTPUT_ARCH(i386:i386)
|
||||
|
||||
OUTPUT(build/kernel/kernel.bin)
|
||||
OUTPUT(build/kernel/kernel.elf)
|
||||
|
||||
SECTIONS {
|
||||
. = 0xc0000000;
|
||||
|
Loading…
x
Reference in New Issue
Block a user