XanvicOS/Makefile
Vincenzo Aleksey Brocato c70d43256a Add bootloader's 2nd stage written in C and asm
Now the bootloader is divided in stage1 and stage 2, the kernel isn't loaded so it's useless (for now).
The Stage 1 of the bootloader prints some strings and loads the second stage into memory. The second stage prints a hello world message.
After this commit I'll divide the main branch into stable and coding (stable is working code, like all the commits I did until this day, coding will be the branch where I push all the code I write, so there may be a lot of errors or the code doesn't compile. I you want to use or just try XanvicOS use the stable branch)
2024-07-28 00:00:11 +02:00

60 lines
1.2 KiB
Makefile

ASM=nasm
CC=gcc
CC16=/usr/bin/watcom/binl/wcc
LD16=/usr/bin/watcom/binl/wlink
SRC_DIR=src
BUILD_DIR=build
.PHONY: all immagine_floppy kernel bootloader clean always
#Immagine floppy
immagine_floppy: $(BUILD_DIR)/main_floppy.img
$(BUILD_DIR)/main_floppy.img: bootloader kernel
dd if=/dev/zero of=$(BUILD_DIR)/main_floppy.img bs=512 count=2880
mkfs.fat -F 12 -n "XanvOS" $(BUILD_DIR)/main_floppy.img
dd if=$(BUILD_DIR)/stage1.bin of=$(BUILD_DIR)/main_floppy.img conv=notrunc
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/stage2.bin "::stage2.bin"
mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin"
mcopy -i $(BUILD_DIR)/main_floppy.img test.txt "::test.txt"
#Kernel
kernel: $(BUILD_DIR)/kernel.bin
$(BUILD_DIR)/kernel.bin: always
$(MAKE) -C $(SRC_DIR)/kernel BUILD_DIR=$(abspath $(BUILD_DIR))
#Bootloader
bootloader: stage1 stage2
stage1: $(BUILD_DIR)/stage1.bin
$(BUILD_DIR)/stage1.bin: always
$(MAKE) -C $(SRC_DIR)/bootloader/stage1 BUILD_DIR=$(abspath $(BUILD_DIR))
stage2: $(BUILD_DIR)/stage2.bin
$(BUILD_DIR)/stage2.bin: always
$(MAKE) -C $(SRC_DIR)/bootloader/stage2 BUILD_DIR=$(abspath $(BUILD_DIR))
#Always
always:
mkdir -p $(BUILD_DIR)
#Clean
clean:
rm -rf $(BUILD_DIR)/*
#Strumenti