Compare commits

...
Author SHA1 Message Date
349f3eb205
pci: move pci entry to end of driver order
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-08-11 23:48:54 -04:00
05c30a9698
gitignore: ignore .ko
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-08-11 23:13:59 -04:00
e85ba55593 Makefile: remove unnecessary prints
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-08-11 23:13:21 -04:00
606039e3b8 Makefile: fix bug with modules
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-08-11 22:11:01 -04:00
4 changed files with 31 additions and 8 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ edk2-ovmf/
*.cpio
initramfs/
Makefile.local
*.ko

View file

@ -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=.

View file

@ -174,4 +174,4 @@ void pci_init()
krdy("PCI ready\n");
}
DRIVER_ENTRY_PRIORITY(pci_init, 4);
DRIVER_ENTRY(pci_init);

View file

@ -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
@ -65,7 +69,8 @@ endef
$(foreach m,$(mod-names),$(eval $(call mod_cflags,$(m))))
.PHONY: _modules
_modules: $(mod-targets) $(subdir-m)
_modules: $(mod-targets) $(subdir-m) $(subdir-y)
@true
.PHONY: _clean
_clean: $(subdir-y) $(subdir-m)