Blame view

scripts/Makefile.fwinst 2.01 KB
88ecf814c   David Woodhouse   firmware: Add fir...
1
2
3
4
  # ==========================================================================
  # Installing firmware
  #
  # We don't include the .config, so all firmware files are in $(fw-shipped-)
a4954fd77   Masahiro Yamada   kbuild: remove ob...
5
  # rather than in $(fw-shipped-y) or $(fw-shipped-m).
88ecf814c   David Woodhouse   firmware: Add fir...
6
7
8
  # ==========================================================================
  
  INSTALL := install
8bd6b2229   David Woodhouse   ihex: add ihex2fw...
9
  src := $(obj)
88ecf814c   David Woodhouse   firmware: Add fir...
10
11
12
13
14
15
  
  # For modules_install installing firmware, we want to see .config
  # But for firmware_install, we don't care, but don't want to require it.
  -include $(objtree)/.config
  
  include scripts/Kbuild.include
5f655c7a4   Masahiro Yamada   kbuild: include $...
16
  include $(src)/Makefile
88ecf814c   David Woodhouse   firmware: Add fir...
17
18
  
  include scripts/Makefile.host
44463f7dd   David Woodhouse   firmware: create ...
19
  mod-fw := $(fw-shipped-m)
38385f8f0   Masahiro Yamada   kbuild: trivial -...
20
  # If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the
88ecf814c   David Woodhouse   firmware: Add fir...
21
22
  # firmware for in-kernel drivers too.
  ifndef CONFIG_FIRMWARE_IN_KERNEL
44463f7dd   David Woodhouse   firmware: create ...
23
  mod-fw += $(fw-shipped-y)
88ecf814c   David Woodhouse   firmware: Add fir...
24
  endif
5180d5f48   Michal Marek   firmware: Simplif...
25
26
27
28
29
30
31
32
  ifneq ($(KBUILD_SRC),)
  # Create output directory if not already present
  _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
  
  firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
  # Create directories for firmware in subdirectories
  _dummy := $(foreach d,$(firmware-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
  endif
44463f7dd   David Woodhouse   firmware: create ...
33
  installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
88ecf814c   David Woodhouse   firmware: Add fir...
34
  installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
7259d936c   David Woodhouse   Update scripts/Ma...
35

88ecf814c   David Woodhouse   firmware: Add fir...
36
  quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
5180d5f48   Michal Marek   firmware: Simplif...
37
        cmd_install = mkdir -p $(@D); $(INSTALL) -m0644 $< $@
88ecf814c   David Woodhouse   firmware: Add fir...
38

5180d5f48   Michal Marek   firmware: Simplif...
39
  $(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/%
88ecf814c   David Woodhouse   firmware: Add fir...
40
  	$(call cmd,install)
7259d936c   David Woodhouse   Update scripts/Ma...
41
42
43
  PHONY +=  __fw_install __fw_modinst FORCE
  
  .PHONY: $(PHONY)
88ecf814c   David Woodhouse   firmware: Add fir...
44
45
  
  __fw_install: $(installed-fw)
759da9267   David Woodhouse   firmware: silence...
46

44463f7dd   David Woodhouse   firmware: create ...
47
  __fw_modinst: $(installed-mod-fw)
759da9267   David Woodhouse   firmware: silence...
48
  	@:
44463f7dd   David Woodhouse   firmware: create ...
49
  __fw_modbuild: $(addprefix $(obj)/,$(mod-fw))
759da9267   David Woodhouse   firmware: silence...
50
  	@:
88ecf814c   David Woodhouse   firmware: Add fir...
51

88ecf814c   David Woodhouse   firmware: Add fir...
52
  FORCE:
7259d936c   David Woodhouse   Update scripts/Ma...
53
54
55
56
57
58
59
60
61
62
63
64
  
  # Read all saved command lines and dependencies for the $(targets) we
  # may be building using $(if_changed{,_dep}). As an optimization, we
  # don't need to read them if the target does not exist; we will rebuild
  # anyway in that case.
  
  targets := $(wildcard $(sort $(targets)))
  cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
  
  ifneq ($(cmd_files),)
    include $(cmd_files)
  endif