2019-05-24 09:51:45 -05:00
|
|
|
export PLAT=i386
|
|
|
|
export CC = $(shell cat psinfo/$(PLAT)/cc.txt)
|
|
|
|
export AS = $(shell cat psinfo/$(PLAT)/as.txt)
|
|
|
|
export AR = $(shell cat psinfo/$(PLAT)/ar.txt)
|
|
|
|
export NASM = $(shell cat psinfo/$(PLAT)/nasm.txt)
|
2019-04-22 08:39:46 -05:00
|
|
|
EMU = $(shell cat psinfo/$(PLAT)/emu.txt)
|
2019-02-09 12:52:45 -06:00
|
|
|
GDB = $(shell cat psinfo/$(PLAT)/gdb.txt)
|
2019-05-24 09:51:45 -05:00
|
|
|
LINK_OBJ = $(wildcard kernel/kernel.a libc/libc.a cpu/$(PLAT)/boot.o)
|
|
|
|
export CFLAGS = -Wextra -Wall -Wno-unused-parameter -g -ffreestanding
|
2019-05-01 09:39:23 -05:00
|
|
|
QFLAGS = -hda ext2.img -m 2G -boot d -cdrom os.iso -serial vc #-chardev socket,id=s1,port=3000,host=localhost -serial chardev:s1
|
2019-02-09 12:52:45 -06:00
|
|
|
|
2019-03-31 13:10:40 -05:00
|
|
|
.PHONY: sysroot
|
|
|
|
|
2019-02-09 12:52:45 -06:00
|
|
|
all: os.iso
|
|
|
|
|
|
|
|
run: os.iso
|
2019-05-22 14:18:29 -05:00
|
|
|
@$(EMU) $(QFLAGS) -monitor stdio
|
2019-02-09 12:52:45 -06:00
|
|
|
|
2019-05-24 09:51:45 -05:00
|
|
|
debug: os.iso kernel.elf
|
2019-05-22 14:18:29 -05:00
|
|
|
@$(EMU) -s $(QFLAGS) &
|
|
|
|
@$(GDB) -ex "target remote localhost:1234" -ex "symbol-file kernel/kernel.elf"
|
2019-02-09 12:52:45 -06:00
|
|
|
|
2019-05-24 09:51:45 -05:00
|
|
|
os.iso: kernel.elf initrd/* initrd/init
|
2019-05-22 14:18:29 -05:00
|
|
|
@cp kernel/kernel.elf iso/boot
|
2019-05-23 17:38:26 -05:00
|
|
|
@cd initrd; tar -f ../iso/boot/initrd.tar -c *
|
2019-05-24 09:51:45 -05:00
|
|
|
@grub-mkrescue -o $@ iso > /dev/null 2>/dev/null
|
2019-02-09 12:52:45 -06:00
|
|
|
|
2019-05-24 09:51:45 -05:00
|
|
|
initrd/init: kernel/start.o
|
|
|
|
@$(MAKE) -C init
|
2019-05-24 09:00:04 -05:00
|
|
|
@cp init/init initrd/init
|
2019-03-17 18:04:50 -05:00
|
|
|
|
2019-05-24 09:51:45 -05:00
|
|
|
.PHONY: kernel.elf
|
2019-02-09 12:52:45 -06:00
|
|
|
|
2019-05-24 09:51:45 -05:00
|
|
|
kernel.elf:
|
|
|
|
@$(MAKE) -C kernel
|
|
|
|
@$(MAKE) -C libc
|
|
|
|
@$(CC) -z max-page-size=4096 -Xlinker -n -T kernel/cpu/$(PLAT)/linker.ld -o $@ $(CFLAGS) -nostdlib $(LINK_OBJ) -lgcc
|
2019-02-09 12:52:45 -06:00
|
|
|
|
|
|
|
clean:
|
2019-05-24 09:51:45 -05:00
|
|
|
@$(MAKE) clean -C kernel
|
|
|
|
@$(MAKE) clean -C libc
|
|
|
|
@$(MAKE) clean -C kernel/cpu
|