- mkdir -p $(2)/etc/modules.d; \
- ( \
- [ "$$$$$$$$boot" = "1" ] && { \
- echo '# May be required for rootfs' ; \
- } ; \
- for mod in $$$$$$$$mods; do \
- echo "$$$$$$$$mod"; \
- done \
- ) > $(2)/etc/modules.d/$$$$$$$$priority-$(1); \
- modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$priority-$(1)"; \
+ for mod in $$$$$$$$mods; do \
+ if [ -e $(2)/$(MODULES_SUBDIR)/$$$$$$$$mod.ko ]; then \
+ mkdir -p $(2)/etc/modules.d; \
+ echo "$$$$$$$$mod" >> $(2)/etc/modules.d/$$$$$$$$priority-$(1); \
+ fi; \
+ done; \
+ if [ -e $(2)/etc/modules.d/$$$$$$$$priority-$(1) ]; then \
+ if [ "$$$$$$$$boot" = "1" ]; then \
+ mkdir -p $(2)/etc/modules-boot.d; \
+ ln -s ../modules.d/$$$$$$$$priority-$(1) $(2)/etc/modules-boot.d/; \
+ fi; \
+ modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$priority-$(1)"; \
+ fi; \