diff options
author | Marvin Borner | 2020-08-09 23:42:57 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-09 23:42:57 +0200 |
commit | f42aa2d995704c748c370d3e7b3684512361bc09 (patch) | |
tree | 2abf158ad5cc128d083789f9aea1145f0cfe0e6d | |
parent | f163a5d5f6802f63092229f0f9326e5fb44b7908 (diff) |
Some build process changes
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | apps/Makefile | 3 | ||||
-rw-r--r-- | kernel/Makefile | 7 | ||||
-rwxr-xr-x | run | 6 |
4 files changed, 12 insertions, 5 deletions
@@ -3,6 +3,7 @@ all: compile clean compile: + @$(MAKE) clean --no-print-directory -C lib/ @$(MAKE) libc --no-print-directory -C lib/ @echo "Compiled libc" @$(MAKE) clean --no-print-directory -C lib/ diff --git a/apps/Makefile b/apps/Makefile index d6c3789..29136d0 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -5,6 +5,9 @@ CC = ../cross/opt/bin/i686-elf-gcc LD = ../cross/opt/bin/i686-elf-ld OC = ../cross/opt/bin/i686-elf-objcopy +# Flags to make the binary smaller TODO: Remove after indirect pointer support! +CSFLAGS = -mpreferred-stack-boundary=2 -fno-asynchronous-unwind-tables -Os + CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -ffreestanding -ffunction-sections -fno-builtin -std=c99 -m32 -pedantic-errors -I../lib/inc/ -fPIE -Duserspace all: $(COBJS) diff --git a/kernel/Makefile b/kernel/Makefile index 1d47ffd..fa6d790 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -26,7 +26,7 @@ CFLAGS = $(CSFLAGS) -Wall -Wextra -nostdlib -nostdinc -ffreestanding -fno-builti ASFLAGS = -f elf32 -O3 -all: compile +all: compile bootloader %.o: %.c @$(CC) -c $(CFLAGS) $< -o $@ @@ -34,8 +34,11 @@ all: compile %_asm.o: %.asm @$(AS) $(ASFLAGS) $< -o $@ -compile: $(COBJS) +bootloader: @mkdir -p ../build/ @$(AS) -f bin entry.asm -o ../build/boot.bin + +compile: $(COBJS) + @mkdir -p ../build/ @$(LD) -N -ekernel_main -Ttext 0x00050000 -o ../build/kernel.bin -L../build/ $+ -lk --oformat binary @$(CC) $(CFLAGS) -o ../build/debug.o -L../build/ $+ -lk @@ -82,7 +82,7 @@ make_build() { mkdir -p build/ rm -rf build/* - echo "Building..." + printf "\nBuilding...\n" make # Create disk image @@ -105,11 +105,11 @@ make_build() { } make_test() { - qemu_with_flags -hdb build/disk.img + qemu_with_flags -drive file=build/disk.img,format=raw,index=1,media=disk } make_debug() { - qemu_with_flags -hdb build/disk.img -s -S + qemu_with_flags -drive file=build/disk.img,format=raw,index=1,media=disk -s -S } make_disasm() { |