Build updates
This commit is contained in:
parent
860d7d2f64
commit
ba6f8a3498
66
Makefile
66
Makefile
|
@ -1,50 +1,66 @@
|
|||
ARCHDIR=../arch/i686
|
||||
ARCHDIR=arch/i686
|
||||
|
||||
CFLAGS?=
|
||||
|
||||
CFLAGS=-O2 \
|
||||
INCLUDEDIR=include
|
||||
|
||||
CFLAGS:=-O2 \
|
||||
-std=gnu99 \
|
||||
-ffreestanding \
|
||||
-Wall -Wextra \
|
||||
-I $(INCLUDEDIR)
|
||||
-I$(INCLUDEDIR) \
|
||||
$(CFLAGS)
|
||||
|
||||
|
||||
KERNEL_OBJS=kernel.o
|
||||
LIB_OBJS=bootstrap.o \
|
||||
tty.o\
|
||||
strlib.o\
|
||||
interrupt.o
|
||||
KERNEL_OBJS=kernel/kernel.o
|
||||
LIB_OBJS=\
|
||||
$(ARCHDIR)/bootstrap.o \
|
||||
$(ARCHDIR)/tty.o\
|
||||
$(ARCHDIR)/strlib.o\
|
||||
$(ARCHDIR)/interrupt.o\
|
||||
|
||||
OBJS=$(KERNEL_OBJS) $(LIB_OBJS)
|
||||
|
||||
LDFLAGS=$(OBJS) \
|
||||
-ffreestanding \
|
||||
-O2 \
|
||||
-nostdlib \
|
||||
-lgcc
|
||||
|
||||
|
||||
INCLUDEDIR=../include
|
||||
|
||||
.SUFFIXES: .c .o .s
|
||||
|
||||
all:
|
||||
$(MAKE) run-grub-qemu
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
rm myos.bin
|
||||
rm myos.iso
|
||||
|
||||
debug:
|
||||
mkdir build || true
|
||||
cp Makefile build
|
||||
$(MAKE) -C build test-kernel-qemu
|
||||
cp -r isodir build
|
||||
CFLAGS=-g $(MAKE) -C build debug-grub-qemu
|
||||
|
||||
architecture:
|
||||
i686-elf-as $(ARCHDIR)/bootstrap.s -o bootstrap.o
|
||||
.c.o:
|
||||
i686-elf-gcc -c $< -o $@ $(CFLAGS)
|
||||
|
||||
i686-elf-gcc -c $(ARCHDIR)/tty.c -o tty.o $(CFLAGS)
|
||||
i686-elf-gcc -c $(ARCHDIR)/interrupt.c -o interrupt.o $(CFLAGS)
|
||||
i686-elf-gcc -c $(ARCHDIR)/strlib.c -o strlib.o $(CFLAGS)
|
||||
.s.o:
|
||||
i686-elf-as $< -o $@
|
||||
|
||||
kernel:
|
||||
i686-elf-gcc -c ../kernel/kernel.c -o kernel.o $(CFLAGS)
|
||||
|
||||
|
||||
myos-bin: architecture kernel
|
||||
myos.bin: $(OBJS)
|
||||
i686-elf-gcc -T $(ARCHDIR)/linker.ld -o myos.bin $(LDFLAGS)
|
||||
|
||||
grub-file --is-x86-multiboot myos.bin
|
||||
|
||||
test-kernel-qemu: myos-bin
|
||||
qemu-system-i386 -kernel myos.bin
|
||||
run-grub-qemu: myos.bin
|
||||
cp myos.bin isodir/boot/myos.bin
|
||||
grub-mkrescue -o myos.iso isodir
|
||||
qemu-system-i386 myos.iso
|
||||
|
||||
debug-grub-qemu: myos.bin
|
||||
cp myos.bin isodir/boot/myos.bin
|
||||
grub-mkrescue -o myos.iso isodir
|
||||
qemu-system-i386 -S -gdb tcp::9000 myos.iso
|
||||
|
||||
|
||||
|
|
3
isodir/boot/grub/grub.cfg
Normal file
3
isodir/boot/grub/grub.cfg
Normal file
|
@ -0,0 +1,3 @@
|
|||
menuentry "myos" {
|
||||
multiboot /boot/myos.bin
|
||||
}
|
BIN
isodir/boot/myos.bin
Executable file
BIN
isodir/boot/myos.bin
Executable file
Binary file not shown.
Loading…
Reference in a new issue