30 lines
1014 B
Makefile
30 lines
1014 B
Makefile
ASM=nasm
|
|
|
|
SRC_DIR=source
|
|
BUILD_DIR=disk_images
|
|
DATA_DIR=data
|
|
|
|
# Floppy image
|
|
# Fat12
|
|
floppy_image: $(BUILD_DIR)/crawos.img
|
|
$(BUILD_DIR)/crawos.img: bootloader kernel
|
|
dd if=/dev/zero of=$(BUILD_DIR)/crawos.img bs=512 count=2880 # Use dd to make a disk image
|
|
mkfs.fat -F 12 -n "CRAWOS" $(BUILD_DIR)/crawos.img # Format the disk image with fat12
|
|
dd if=$(BUILD_DIR)/boot.bin of=$(BUILD_DIR)/crawos.img conv=notrunc # Put boot.bin inside the disk image
|
|
mcopy -i $(BUILD_DIR)/crawos.img $(BUILD_DIR)/kernel.bin "::kernel.bin" # Put kernel.bin inside the disk image
|
|
for filename in $(DATA_DIR)/*; do mcopy -i $(BUILD_DIR)/crawos.img $$filename "::/$$(echo $$filename | xargs -n 1 basename)"; done
|
|
|
|
# Bootloader
|
|
bootloader: $(BUILD_DIR)/boot.bin
|
|
$(BUILD_DIR)/boot.bin:
|
|
$(ASM) $(SRC_DIR)/bootload/boot.asm -f bin -o $ $(BUILD_DIR)/boot.bin
|
|
|
|
# Kernel
|
|
kernel: $(BUILD_DIR)/kernel.bin
|
|
$(BUILD_DIR)/kernel.bin:
|
|
$(ASM) $(SRC_DIR)/kernel/kernel.asm -f bin -o $ $(BUILD_DIR)/kernel.bin
|
|
|
|
# Clean
|
|
clean:
|
|
rm -f disk-images/*
|