@@ -10,6 +10,11 @@ BIN_DIR = bin
1010DISKIMG_DIR = diskimgs
1111DISKIMG_NAME = kintsugi_floppy_i386.img
1212HDDIMG_NAME = kintsugi_hdd_i386.img
13+ ISO_NAME = KintsugiOS.iso
14+
15+ # Tools for ISO creation
16+ MKISOFS = genisoimage
17+ XORRISO = xorriso
1318
1419CFLAGS = -g -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -Wall -Wextra -ffreestanding -I$(SRC_DIR ) /kernel/include
1520ASMFLAGS_BIN = -f bin
@@ -69,10 +74,26 @@ $(DISKIMG_DIR)/$(HDDIMG_NAME):
6974 @mkdir -p $(DISKIMG_DIR )
7075 @dd if=/dev/zero of=$@ bs=512 count=10000 # ~5MB disk
7176
77+ check-iso-tools :
78+ @if ! command -v $(MKISOFS ) > /dev/null 2>&1 && ! command -v $(XORRISO ) > /dev/null 2>&1 ; then \
79+ echo " Error: Neither genisoimage nor xorriso found. Install one of them to create ISO." ; \
80+ exit 1; \
81+ fi
82+
83+ $(DISKIMG_DIR ) /$(ISO_NAME ) : $(DISKIMG_DIR ) /$(DISKIMG_NAME ) check-iso-tools
84+ @printf " $( BLUE) [ISO] Creating ISO image %-50s -> %s$( RESET) \n" " $( DISKIMG_DIR) /$( DISKIMG_NAME) " " $@ "
85+ @if command -v $(MKISOFS ) > /dev/null 2>&1 ; then \
86+ $(MKISOFS ) -quiet -V ' KINTSUGI_OS' -input-charset iso8859-1 -o $@ -b $(DISKIMG_NAME ) -hide boot.catalog -boot-load-size 4 -no-emul-boot $(DISKIMG_DIR ) ; \
87+ elif command -v $(XORRISO ) > /dev/null 2>&1 ; then \
88+ $(XORRISO ) -as mkisofs -b $(DISKIMG_NAME ) -o $@ $(DISKIMG_DIR ) ; \
89+ fi
90+
7291diskimg : $(DISKIMG_DIR ) /$(DISKIMG_NAME )
7392
7493hddimg : $(DISKIMG_DIR ) /$(HDDIMG_NAME )
7594
95+ iso : $(DISKIMG_DIR ) /$(ISO_NAME )
96+
7697run_bin : $(BIN_DIR ) /kintsugios.bin
7798 @printf " $( GREEN) [QEMU] Run bin %-50s$( RESET) \n" " $( BIN_DIR) /kintsugios.bin"
7899 @qemu-system-i386 -fda $(BIN_DIR ) /kintsugios.bin
@@ -85,6 +106,10 @@ run: $(DISKIMG_DIR)/$(DISKIMG_NAME) $(DISKIMG_DIR)/$(HDDIMG_NAME)
85106 @printf " $( GREEN) [QEMU] Run with HDD %-50s$( RESET) \n" " $<"
86107 @qemu-system-i386 -fda $< -hda $(DISKIMG_DIR ) /$(HDDIMG_NAME ) -boot a -m 16
87108
109+ run_iso : $(DISKIMG_DIR ) /$(ISO_NAME ) $(DISKIMG_DIR ) /$(HDDIMG_NAME )
110+ @printf " $( GREEN) [QEMU] Run ISO %-50s$( RESET) \n" " $<"
111+ @qemu-system-i386 -hda ${DISKIMG_DIR} /$(HDDIMG_NAME ) -cdrom $< -boot d -m 16
112+
88113debug_fda : $(DISKIMG_DIR ) /$(DISKIMG_NAME )
89114 @printf " $( GREEN) [QEMU] Debug img %-50s$( RESET) \n" " $<"
90115 @qemu-system-i386 -fda $< -boot a -s -S -m 16
@@ -93,8 +118,12 @@ debug: $(DISKIMG_DIR)/$(DISKIMG_NAME) $(DISKIMG_DIR)/$(HDDIMG_NAME)
93118 @printf " $( GREEN) [QEMU] Debug with HDD %-50s$( RESET) \n" " $<"
94119 @qemu-system-i386 -fda $< -hda $(DISKIMG_DIR ) /$(HDDIMG_NAME ) -boot a -s -S -m 16
95120
121+ debug_iso : $(DISKIMG_DIR ) /$(ISO_NAME )
122+ @printf " $( GREEN) [QEMU] Debug ISO %-50s$( RESET) \n" " $<"
123+ @qemu-system-i386 -cdrom $< -boot d -s -S -m 16
124+
96125clean :
97126 @printf " $( RED) [RM] Clean $( BIN_DIR) and $( DISKIMG_DIR) $( RESET) \n"
98127 @rm -rf $(BIN_DIR ) /* $(DISKIMG_DIR ) /*
99128
100- .PHONY : all diskimg hddimg run run_bin run_hdd debug debug_hdd clean
129+ .PHONY : all diskimg hddimg iso run run_bin run_fda run_iso debug debug_fda debug_iso clean check-iso-tools
0 commit comments