Back to home page

LXR

 
 

    


0001 # ==========================================================================
0002 # Installing firmware
0003 #
0004 # We don't include the .config, so all firmware files are in $(fw-shipped-)
0005 # rather than in $(fw-shipped-y) or $(fw-shipped-m).
0006 # ==========================================================================
0007 
0008 INSTALL := install
0009 src := $(obj)
0010 
0011 # For modules_install installing firmware, we want to see .config
0012 # But for firmware_install, we don't care, but don't want to require it.
0013 -include $(objtree)/.config
0014 
0015 include scripts/Kbuild.include
0016 include $(src)/Makefile
0017 
0018 include scripts/Makefile.host
0019 
0020 mod-fw := $(fw-shipped-m)
0021 # If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the
0022 # firmware for in-kernel drivers too.
0023 ifndef CONFIG_FIRMWARE_IN_KERNEL
0024 mod-fw += $(fw-shipped-y)
0025 endif
0026 
0027 ifneq ($(KBUILD_SRC),)
0028 # Create output directory if not already present
0029 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
0030 
0031 firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
0032 # Create directories for firmware in subdirectories
0033 _dummy := $(foreach d,$(firmware-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
0034 endif
0035 
0036 installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
0037 
0038 installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
0039 
0040 quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
0041       cmd_install = mkdir -p $(@D); $(INSTALL) -m0644 $< $@
0042 
0043 $(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/%
0044         $(call cmd,install)
0045 
0046 PHONY +=  __fw_install __fw_modinst FORCE
0047 
0048 .PHONY: $(PHONY)
0049 
0050 __fw_install: $(installed-fw)
0051 
0052 __fw_modinst: $(installed-mod-fw)
0053         @:
0054 
0055 __fw_modbuild: $(addprefix $(obj)/,$(mod-fw))
0056         @:
0057 
0058 FORCE:
0059 
0060 # Read all saved command lines and dependencies for the $(targets) we
0061 # may be building using $(if_changed{,_dep}). As an optimization, we
0062 # don't need to read them if the target does not exist; we will rebuild
0063 # anyway in that case.
0064 
0065 targets := $(wildcard $(sort $(targets)))
0066 cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
0067 
0068 ifneq ($(cmd_files),)
0069   include $(cmd_files)
0070 endif