-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: aarch64 <gutierrezaverruz0@hotmail.com>
- Loading branch information
1 parent
59753cf
commit d635b4c
Showing
71 changed files
with
2,475 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,58 @@ | ||
include toolchain.mk | ||
include build_scripts/config.mk | ||
|
||
SOURCES_ASM := $(wildcard $(addsuffix /*.asm, $(SRC_DIRS))) | ||
OBJECTS_ASM := $(patsubst %.asm, %.asm.o, $(SOURCES_ASM)) | ||
.PHONY: all floppy_image kernel bootloader clean always | ||
|
||
SOURCES_C := $(wildcard $(addsuffix /*.c, $(SRC_DIRS))) | ||
OBJECTS_C := $(patsubst %.c, %.c.o, $(SOURCES_C)) | ||
all: floppy_image | ||
|
||
all: $(OBJECTS_ASM) $(OBJECTS_C) link | ||
include build_scripts/toolchain.mk | ||
|
||
%.asm.o: %.asm | ||
@mkdir -p $(BUILD_DIR) | ||
@$(ASM) $(ASMFLAGS) -o $@ $< | ||
@mv $@ $(notdir $@/build) | ||
@echo -e "${MGTA}--> Compiled:${NC} ${CSV}" $< "${NC}" | ||
# | ||
# Floppy image | ||
# | ||
floppy_image: $(BUILD_DIR)/xnix_floppy.img | ||
|
||
%.c.o: %.c | ||
@mkdir -p $(BUILD_DIR) | ||
@$(CC) $(CFLAGS) -I./include -c $< -o $@ | ||
@mv $@ $(notdir $@/build) | ||
@echo -e "${MGTA}--> Compiled:${NC} ${CSV}" $< "${NC}" | ||
$(BUILD_DIR)/xnix_floppy.img: bootloader kernel | ||
@dd if=/dev/zero of=$@ bs=512 count=2880 >/dev/null | ||
@mkfs.fat -F 12 -n "xnix" $@ >/dev/null | ||
@dd if=$(BUILD_DIR)/stage1.bin of=$@ conv=notrunc >/dev/null | ||
@mcopy -i $@ $(BUILD_DIR)/stage2.bin "::stage2.bin" | ||
@mcopy -i $@ $(BUILD_DIR)/kernel.bin "::kernel.bin" | ||
@echo "--> Created: " $@ | ||
|
||
link: | ||
@mkdir -p $(BUILD_DIR) | ||
@$(LD) $(LDFLAGS) -o $(BUILD_DIR)/$(OUTELF) $(addprefix build/, *.o) | ||
@echo -e "\n${MGTA}--> Created:${NC} ${BOLD}XnixOS" "${NC}" | ||
# | ||
# Bootloader | ||
# | ||
bootloader: stage1 stage2 | ||
|
||
run: | ||
@qemu-system-i386 -kernel $(BUILD_DIR)/$(OUTELF) | ||
stage1: $(BUILD_DIR)/stage1.bin | ||
|
||
clean: | ||
@rm -rf build | ||
$(BUILD_DIR)/stage1.bin: always | ||
@$(MAKE) -C boot/stage1 BUILD_DIR=$(abspath $(BUILD_DIR)) | ||
|
||
stage2: $(BUILD_DIR)/stage2.bin | ||
|
||
$(BUILD_DIR)/stage2.bin: always | ||
@$(MAKE) -C boot/stage2 BUILD_DIR=$(abspath $(BUILD_DIR)) | ||
|
||
mkiso: | ||
@mkdir -p $(ISO_DIR)/boot/grub | ||
@cp -r boot/grub.cfg $(ISO_DIR)/boot/grub/ | ||
@cp -r $(BUILD_DIR)/$(OUTELF) $(ISO_DIR)/boot/ | ||
@grub2-mkrescue -o $(OUTELF).iso $(ISO_DIR) | ||
# | ||
# Kernel | ||
# | ||
kernel: $(BUILD_DIR)/kernel.bin | ||
|
||
$(BUILD_DIR)/kernel.bin: always | ||
@$(MAKE) -C kernel BUILD_DIR=$(abspath $(BUILD_DIR)) | ||
|
||
# | ||
# Always | ||
# | ||
always: | ||
@mkdir -p $(BUILD_DIR) | ||
|
||
# | ||
# Clean | ||
# | ||
clean: | ||
@rm -rf $(BUILD_DIR) | ||
|
||
run: | ||
qemu-system-i386 -fda $(BUILD_DIR)/xnix_floppy.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
BUILD_DIR?=build/ | ||
ASM?=nasm | ||
|
||
.PHONY: all clean | ||
|
||
all: stage1 | ||
|
||
stage1: $(BUILD_DIR)/stage1.bin | ||
|
||
$(BUILD_DIR)/stage1.bin: boot.asm | ||
@$(ASM) $< -f bin -o $@ | ||
@echo "--> Created stage1.bin" | ||
|
||
clean: | ||
@rm -f $(BUILD_DIR)/stage1.bin |
Oops, something went wrong.