]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
feat: include doom.elf in initrd when built
authorTulio A M Mendes <[email protected]>
Thu, 12 Feb 2026 08:13:01 +0000 (05:13 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 02:44:55 +0000 (23:44 -0300)
The Makefile now conditionally includes user/doom/doom.elf in the
initrd as bin/doom.elf if it exists. This allows DOOM to be
launched from the AdrOS shell via: /bin/doom.elf -iwad /path/to/doom1.wad

The DOOM build is optional — the main kernel build is unaffected
if doomgeneric has not been cloned.

Makefile

index 76d1edcfab36e46c1bb1fbf2534e3c4cf8077629..ab2640104a70e2364c34e58ce2af114143e079a8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -68,6 +68,7 @@ ifeq ($(ARCH),x86)
     MKDIR_ELF := user/mkdir.elf
     RM_ELF := user/rm.elf
     LDSO_ELF := user/ld.so
+    DOOM_ELF := user/doom/doom.elf
     INITRD_IMG := initrd.img
     MKINITRD := tools/mkinitrd
 endif
@@ -174,8 +175,17 @@ $(RM_ELF): user/rm.c user/linker.ld
 $(LDSO_ELF): user/ldso.c user/linker.ld
        @i686-elf-gcc -m32 -I include -ffreestanding -fno-pie -no-pie -nostdlib -Wl,-T,user/linker.ld -o $(LDSO_ELF) user/ldso.c
 
-$(INITRD_IMG): $(MKINITRD) $(USER_ELF) $(ECHO_ELF) $(SH_ELF) $(CAT_ELF) $(LS_ELF) $(MKDIR_ELF) $(RM_ELF) $(LDSO_ELF)
-       @./$(MKINITRD) $(INITRD_IMG) $(USER_ELF):bin/init.elf $(ECHO_ELF):bin/echo.elf $(SH_ELF):bin/sh $(CAT_ELF):bin/cat $(LS_ELF):bin/ls $(MKDIR_ELF):bin/mkdir $(RM_ELF):bin/rm $(LDSO_ELF):lib/ld.so
+INITRD_FILES := $(USER_ELF):bin/init.elf $(ECHO_ELF):bin/echo.elf $(SH_ELF):bin/sh $(CAT_ELF):bin/cat $(LS_ELF):bin/ls $(MKDIR_ELF):bin/mkdir $(RM_ELF):bin/rm $(LDSO_ELF):lib/ld.so
+INITRD_DEPS := $(MKINITRD) $(USER_ELF) $(ECHO_ELF) $(SH_ELF) $(CAT_ELF) $(LS_ELF) $(MKDIR_ELF) $(RM_ELF) $(LDSO_ELF)
+
+# Include doom.elf if it has been built
+ifneq ($(wildcard $(DOOM_ELF)),)
+INITRD_FILES += $(DOOM_ELF):bin/doom.elf
+INITRD_DEPS += $(DOOM_ELF)
+endif
+
+$(INITRD_IMG): $(INITRD_DEPS)
+       @./$(MKINITRD) $(INITRD_IMG) $(INITRD_FILES)
 
 run: iso
        @rm -f serial.log qemu.log