|
|
@ -1,3 +1,7 @@ |
|
|
|
|
|
|
|
C_SOURCES = $(wildcard kernel/*.c drivers/*.c)
|
|
|
|
|
|
|
|
HEADERS = $(wildcard kernel/*.h drivers/*.h)
|
|
|
|
|
|
|
|
OBJ = $(C_SOURCES:.c=.o)
|
|
|
|
|
|
|
|
|
|
|
|
all: os-image |
|
|
|
all: os-image |
|
|
|
|
|
|
|
|
|
|
|
run: all |
|
|
|
run: all |
|
|
@ -8,29 +12,27 @@ drun: clean run |
|
|
|
grub: eOS.iso |
|
|
|
grub: eOS.iso |
|
|
|
qemu-system-x86_64 eOS.iso
|
|
|
|
qemu-system-x86_64 eOS.iso
|
|
|
|
|
|
|
|
|
|
|
|
eOS.iso : kernel.bin src/grub/grub.cfg |
|
|
|
eOS.iso : kernel/kernel.bin grub/grub.cfg |
|
|
|
mkdir -p boot/grub
|
|
|
|
mkdir -p boot/grub
|
|
|
|
cp $< boot/eOS.bin
|
|
|
|
cp $< boot/eOS.bin
|
|
|
|
cp src/grub/grub.cfg boot/grub/grub.cfg
|
|
|
|
cp grub/grub.cfg boot/grub/grub.cfg
|
|
|
|
grub-mkrescue -o eOS.iso ./
|
|
|
|
grub-mkrescue -o eOS.iso ./
|
|
|
|
|
|
|
|
|
|
|
|
os-image: bootloader.bin kernel.bin |
|
|
|
os-image: bootloader/bootloader.bin kernel.bin |
|
|
|
cat $^ > os-image
|
|
|
|
cat $^ > os-image
|
|
|
|
|
|
|
|
|
|
|
|
kernel.bin: kernel_entry.o kernel.o |
|
|
|
kernel.bin: kernel/kernel_entry.o $(OBJ) |
|
|
|
gcc -o kernel.bin $^ -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32
|
|
|
|
gcc -o $@ $^ -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32
|
|
|
|
|
|
|
|
|
|
|
|
kernel.o : src/kernel/kernel.c |
|
|
|
%.o : %.c |
|
|
|
gcc -fno-pie -m32 -Os -ffreestanding -c $< -o $@
|
|
|
|
gcc -fno-pie -m32 -Os -ffreestanding -c $< -o $@
|
|
|
|
|
|
|
|
|
|
|
|
kernel_entry.o : src/kernel/kernel_entry.asm |
|
|
|
%.o : %.asm |
|
|
|
nasm $< -f elf -o $@
|
|
|
|
nasm $< -f elf -o $@
|
|
|
|
|
|
|
|
|
|
|
|
bootloader.bin : src/bootloader/bootloader.asm |
|
|
|
%.bin : %.asm |
|
|
|
nasm $< -f bin -o $@
|
|
|
|
nasm $< -f bin -o $@
|
|
|
|
|
|
|
|
|
|
|
|
clean: |
|
|
|
clean: |
|
|
|
rm -fr *.bin *.dis *.o os-image *.map boot/ *.iso
|
|
|
|
rm -fr *.bin *.dis *.o os-image *.map boot/ *.iso
|
|
|
|
|
|
|
|
rm -fr kernel/*.o boot/*.bin drivers/*.o
|
|
|
|
kernel.dis : kernel.bin |
|
|
|
|
|
|
|
ndisasm -b 32 $< > $@
|
|
|
|
|
|
|
|