From 606039e3b896435f7d52db01b8cdc7ba66d5df4f Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Tue, 11 Aug 2026 22:11:01 -0400 Subject: [PATCH 1/4] Makefile: fix bug with modules Signed-off-by: Michael Shaw --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 3a716e6..08acc5a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -65,7 +65,7 @@ endef $(foreach m,$(mod-names),$(eval $(call mod_cflags,$(m)))) .PHONY: _modules -_modules: $(mod-targets) $(subdir-m) +_modules: $(mod-targets) $(subdir-m) $(subdir-y) .PHONY: _clean _clean: $(subdir-y) $(subdir-m) From e85ba555934c94c4ece67e3df014f5cc65164a25 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Tue, 11 Aug 2026 23:13:21 -0400 Subject: [PATCH 2/4] Makefile: remove unnecessary prints Signed-off-by: Michael Shaw --- Makefile | 27 ++++++++++++++++++++++----- scripts/Makefile.build | 7 ++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 284adf6..c96fa3b 100644 --- a/Makefile +++ b/Makefile @@ -79,13 +79,11 @@ export INITRAMFS export MODULE_CFLAGS PHONY: default -default: - $(Q)compiledb -n $(MAKE) --no-print-directory $(KERNEL) - $(Q)compiledb -n $(MAKE) -C usr.bin - $(Q)$(MAKE) --no-print-directory $(KERNEL) +default: $(KERNEL) + $(Q)+$(MAKE) --no-print-directory -f scripts/Makefile.build _modules obj=. .PHONY: all -all: $(KERNEL) +all: $(KERNEL) modules $(Q)compiledb -n $(MAKE) --no-print-directory .PHONY: __build_all @@ -103,6 +101,25 @@ $(KERNEL): $(KOBJ) linker.ld modules: $(Q)$(MAKE) --no-print-directory -f scripts/Makefile.build _modules obj=. +.PHONY: modules_install +modules_install: modules + $(Q)echo " INSTALL modules" + $(Q)mkdir -p initramfs/modules + $(Q)for ko in $$(find . -path ./initramfs -prune -o -name '*.ko' -print); do \ + cp "$$ko" initramfs/modules/; \ + done + $(Q)echo -n > initramfs/modules/modules.alias + $(Q)for ko in initramfs/modules/*.ko; do \ + [ -f "$$ko" ] || continue; \ + readelf -p .modinfo "$$ko" 2>/dev/null | \ + sed -n 's/^\s*\[.*\]\s*//p' | \ + while IFS= read -r line; do \ + case "$$line" in alias=*) \ + echo "$${line#alias=} $$ko" >> initramfs/modules/modules.alias ;; \ + esac; \ + done; \ + done + .PHONY: clean clean: $(Q)$(MAKE) --no-print-directory -f scripts/Makefile.build _clean obj=. diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 08acc5a..ac53b43 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -31,9 +31,13 @@ mod-objs := $(foreach m,$(mod-names), \ deps := $(real-objs-y:.o=.d) $(mod-objs:.o=.d) ifeq ($(obj),.) +.PHONY: _all _all: $(subdir-objs-y) + @true else +.PHONY: _all _all: $(obj)/built-in.o + @true endif $(obj)/%.o: $(obj)/%.c @@ -52,7 +56,7 @@ $(obj)/built-in.o: $(real-objs-y) $(subdir-objs-y) define mod_rule $(obj)/$(1).ko: $(addprefix $(obj)/, $(or $($(1)-objs),$($(1)-y),$(1).o)) - $$(Q)echo " MODLD $$@" + $$(Q)echo " LD [M] $$@" $$(Q)$$(LD) -r -o $$@ $$^ endef @@ -66,6 +70,7 @@ $(foreach m,$(mod-names),$(eval $(call mod_cflags,$(m)))) .PHONY: _modules _modules: $(mod-targets) $(subdir-m) $(subdir-y) + @true .PHONY: _clean _clean: $(subdir-y) $(subdir-m) From 05c30a9698527dc47994187712824e0bb77a9d95 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Tue, 11 Aug 2026 23:13:59 -0400 Subject: [PATCH 3/4] gitignore: ignore .ko Signed-off-by: Michael Shaw --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fed3b0f..dcbb8c9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ edk2-ovmf/ *.cpio initramfs/ Makefile.local +*.ko From 349f3eb205fb3b3b87577c96640ee4abb4475dd4 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Tue, 11 Aug 2026 23:48:54 -0400 Subject: [PATCH 4/4] pci: move pci entry to end of driver order Signed-off-by: Michael Shaw --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index dd3491b..9b5a448 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -174,4 +174,4 @@ void pci_init() krdy("PCI ready\n"); } -DRIVER_ENTRY_PRIORITY(pci_init, 4); +DRIVER_ENTRY(pci_init);