summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 27 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index af294e8..4f5c382 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ W += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
W += -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wconversion
W += -Wstrict-prototypes
WNO := -Wno-error=unused-parameter -Wno-error=unused-variable
-WNO += -Wno-error=infinite-recursion
+WNO += -Wno-error=unused-but-set-variable -Wno-error=infinite-recursion
CFLAGS = $(W) $(WNO) -fno-omit-frame-pointer -mcmodel=large
CFLAGS += -mgeneral-regs-only # disables SIMD instructions
@@ -27,19 +27,26 @@ K = kernel
all: kernel.iso
+FORCE:
+
$K/kernel.bin: FORCE
@$(MAKE) -C $(@D)
-FORCE:
-kernel.iso: $K/kernel.bin $K/src/grub.cfg Makefile
+isodir:
$(info [all] $@)
@mkdir -p isodir/boot/grub
- @cp $K/kernel.bin isodir/boot/kernel.bin
@cp $K/src/grub.cfg isodir/boot/grub/grub.cfg
- @grub-mkrescue -o kernel.iso isodir 2> /dev/null
+ @mkdir -p isodir/modules
+ @dd if=/dev/zero of=isodir/modules/ext2.img bs=4M count=2 > /dev/null 2>&1
+ @mkfs.ext2 isodir/modules/ext2.img > /dev/null 2>&1
+kernel.iso: $K/kernel.bin $K/src/grub.cfg Makefile isodir FORCE
+ $(info [all] $@)
+ @cp $K/kernel.bin isodir/boot/kernel.bin
+ @grub-mkrescue -o kernel.iso isodir > /dev/null 2>&1
-.PHONY: all build qemu bochs clean
+
+.PHONY: all build qemu bochs mount umount clean
QEMU = qemu-system-x86_64
BOCHS = bochs -q
@@ -50,8 +57,22 @@ qemu: kernel.iso
bochs: kernel.iso
$(BOCHS) -qf .bochsrc
+mount: isodir
+ifeq ("$(wildcard /mnt/ext2/lost+found/)","")
+ $(info [all] $@)
+ @doas mount isodir/modules/ext2.img /mnt/ext2 -o loop
+ @doas chown -R aleksa:aleksa /mnt/ext2
+endif
+
+umount:
+ifneq ("$(wildcard /mnt/ext2/lost+found/)","")
+ $(info [all] $@)
+ @doas umount /mnt/ext2
+endif
+
clean:
@find -name "*.o" -exec rm {} \;
@find -name "*.d" -exec rm {} \;
@rm -f kernel.iso $K/kernel.bin xbochs.log bx_enh_dbg.ini
@rm -rf isodir
+ @$(MAKE) umount