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 \
|
-std=gnu99 \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
-Wall -Wextra \
|
-Wall -Wextra \
|
||||||
-I $(INCLUDEDIR)
|
-I$(INCLUDEDIR) \
|
||||||
|
$(CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
KERNEL_OBJS=kernel.o
|
KERNEL_OBJS=kernel/kernel.o
|
||||||
LIB_OBJS=bootstrap.o \
|
LIB_OBJS=\
|
||||||
tty.o\
|
$(ARCHDIR)/bootstrap.o \
|
||||||
strlib.o\
|
$(ARCHDIR)/tty.o\
|
||||||
interrupt.o
|
$(ARCHDIR)/strlib.o\
|
||||||
|
$(ARCHDIR)/interrupt.o\
|
||||||
|
|
||||||
OBJS=$(KERNEL_OBJS) $(LIB_OBJS)
|
OBJS=$(KERNEL_OBJS) $(LIB_OBJS)
|
||||||
|
|
||||||
LDFLAGS=$(OBJS) \
|
LDFLAGS=$(OBJS) \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
-O2 \
|
-O2 \
|
||||||
-nostdlib \
|
-nostdlib \
|
||||||
-lgcc
|
-lgcc
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o .s
|
||||||
INCLUDEDIR=../include
|
|
||||||
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
$(MAKE) run-grub-qemu
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm myos.bin
|
||||||
|
rm myos.iso
|
||||||
|
|
||||||
|
debug:
|
||||||
mkdir build || true
|
mkdir build || true
|
||||||
cp Makefile build
|
cp Makefile build
|
||||||
$(MAKE) -C build test-kernel-qemu
|
cp -r isodir build
|
||||||
|
CFLAGS=-g $(MAKE) -C build debug-grub-qemu
|
||||||
|
|
||||||
architecture:
|
.c.o:
|
||||||
i686-elf-as $(ARCHDIR)/bootstrap.s -o bootstrap.o
|
i686-elf-gcc -c $< -o $@ $(CFLAGS)
|
||||||
|
|
||||||
i686-elf-gcc -c $(ARCHDIR)/tty.c -o tty.o $(CFLAGS)
|
.s.o:
|
||||||
i686-elf-gcc -c $(ARCHDIR)/interrupt.c -o interrupt.o $(CFLAGS)
|
i686-elf-as $< -o $@
|
||||||
i686-elf-gcc -c $(ARCHDIR)/strlib.c -o strlib.o $(CFLAGS)
|
|
||||||
|
|
||||||
kernel:
|
myos.bin: $(OBJS)
|
||||||
i686-elf-gcc -c ../kernel/kernel.c -o kernel.o $(CFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
myos-bin: architecture kernel
|
|
||||||
i686-elf-gcc -T $(ARCHDIR)/linker.ld -o myos.bin $(LDFLAGS)
|
i686-elf-gcc -T $(ARCHDIR)/linker.ld -o myos.bin $(LDFLAGS)
|
||||||
|
|
||||||
grub-file --is-x86-multiboot myos.bin
|
grub-file --is-x86-multiboot myos.bin
|
||||||
|
|
||||||
test-kernel-qemu: myos-bin
|
run-grub-qemu: myos.bin
|
||||||
qemu-system-i386 -kernel 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