$(objtree) refers to the top of the output directory of kernel builds. This commit adds the explicit $(objtree)/ prefix to build artifacts needed for building external modules. This change has no immediate impact, as the top-level Makefile currently defines: objtree := . This commit prepares for supporting the building of external modules in a different directory.
Showing the changes to scripts (6 of 11 files). Show all
Unified · Split
| @@ -205,7 +205,7 @@ if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:) · 204 unmodified lines | |||
| 205 | 205 | ||
| 206 | cmd_and_fixdep = \ | 206 | cmd_and_fixdep = \ |
| 207 | $(cmd); \ | 207 | $(cmd); \ |
| 208 | scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ | 208 | $(objtree)/scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ |
| 209 | rm -f $(depfile) | 209 | rm -f $(depfile) |
| 210 | 210 | ||
| 211 | # Usage: $(call if_changed_rule,foo) | 211 | # Usage: $(call if_changed_rule,foo) |
| @@ -34,7 +34,7 @@ subdir-asflags-y := · 33 unmodified lines | |||
| 34 | subdir-ccflags-y := | 34 | subdir-ccflags-y := |
| 35 | 35 | ||
| 36 | # Read auto.conf if it exists, otherwise ignore | 36 | # Read auto.conf if it exists, otherwise ignore |
| 37 | -include include/config/auto.conf | 37 | -include $(objtree)/include/config/auto.conf |
| 38 | 38 | ||
| 39 | include $(srctree)/scripts/Kbuild.include | 39 | include $(srctree)/scripts/Kbuild.include |
| 40 | include $(srctree)/scripts/Makefile.compiler | 40 | include $(srctree)/scripts/Makefile.compiler |
| @@ -107,7 +107,7 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $< · 66 unmodified lines | |||
| 107 | $(obj)/%.i: $(obj)/%.c FORCE | 107 | $(obj)/%.i: $(obj)/%.c FORCE |
| 108 | $(call if_changed_dep,cpp_i_c) | 108 | $(call if_changed_dep,cpp_i_c) |
| 109 | 109 | ||
| 110 | genksyms = scripts/genksyms/genksyms \ | 110 | genksyms = $(objtree)/scripts/genksyms/genksyms \ |
| 111 | $(if $(1), -T $(2)) \ | 111 | $(if $(1), -T $(2)) \ |
| 112 | $(if $(KBUILD_PRESERVE), -p) \ | 112 | $(if $(KBUILD_PRESERVE), -p) \ |
| 113 | -r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null) | 113 | -r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null) |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | PHONY := __modfinal | 6 | PHONY := __modfinal |
| 7 | __modfinal: | 7 | __modfinal: |
| 8 | 8 | ||
| 9 | include include/config/auto.conf | 9 | include $(objtree)/include/config/auto.conf |
| 10 | include $(srctree)/scripts/Kbuild.include | 10 | include $(srctree)/scripts/Kbuild.include |
| 11 | 11 | ||
| 12 | # for c_flags | 12 | # for c_flags |
| @@ -37,15 +37,15 @@ quiet_cmd_ld_ko_o = LD [M] $@ · 24 unmodified lines | |||
| 37 | cmd_ld_ko_o = \ | 37 | cmd_ld_ko_o = \ |
| 38 | $(LD) -r $(KBUILD_LDFLAGS) \ | 38 | $(LD) -r $(KBUILD_LDFLAGS) \ |
| 39 | $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ | 39 | $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ |
| 40 | -T scripts/module.lds -o $@ $(filter %.o, $^) | 40 | -T $(objtree)/scripts/module.lds -o $@ $(filter %.o, $^) |
| 41 | 41 | ||
| 42 | quiet_cmd_btf_ko = BTF [M] $@ | 42 | quiet_cmd_btf_ko = BTF [M] $@ |
| 43 | cmd_btf_ko = \ | 43 | cmd_btf_ko = \ |
| 44 | if [ ! -f vmlinux ]; then \ | 44 | if [ ! -f $(objtree)/vmlinux ]; then \ |
| 45 | printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ | 45 | printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ |
| 46 | else \ | 46 | else \ |
| 47 | LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) $(MODULE_PAHOLE_FLAGS) --btf_base vmlinux $@; \ | 47 | LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) $(MODULE_PAHOLE_FLAGS) --btf_base $(objtree)/vmlinux $@; \ |
| 48 | $(RESOLVE_BTFIDS) -b vmlinux $@; \ | 48 | $(RESOLVE_BTFIDS) -b $(objtree)/vmlinux $@; \ |
| 49 | fi; | 49 | fi; |
| 50 | 50 | ||
| 51 | # Same as newer-prereqs, but allows to exclude specified extra dependencies | 51 | # Same as newer-prereqs, but allows to exclude specified extra dependencies |
| @@ -57,8 +57,8 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \ · 5 unmodified lines | |||
| 57 | printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) | 57 | printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) |
| 58 | 58 | ||
| 59 | # Re-generate module BTFs if either module's .ko or vmlinux changed | 59 | # Re-generate module BTFs if either module's .ko or vmlinux changed |
| 60 | %.ko: %.o %.mod.o $(extmod_prefix).module-common.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE | 60 | %.ko: %.o %.mod.o $(extmod_prefix).module-common.o $(objtree)/scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),$(objtree)/vmlinux) FORCE |
| 61 | +$(call if_changed_except,ld_ko_o,vmlinux) | 61 | +$(call if_changed_except,ld_ko_o,$(objtree)/vmlinux) |
| 62 | ifdef CONFIG_DEBUG_INFO_BTF_MODULES | 62 | ifdef CONFIG_DEBUG_INFO_BTF_MODULES |
| 63 | +$(if $(newer-prereqs),$(call cmd,btf_ko)) | 63 | +$(if $(newer-prereqs),$(call cmd,btf_ko)) |
| 64 | endif | 64 | endif |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | PHONY := __modinst | 6 | PHONY := __modinst |
| 7 | __modinst: | 7 | __modinst: |
| 8 | 8 | ||
| 9 | include include/config/auto.conf | 9 | include $(objtree)/include/config/auto.conf |
| 10 | include $(srctree)/scripts/Kbuild.include | 10 | include $(srctree)/scripts/Kbuild.include |
| 11 | 11 | ||
| 12 | install-y := | 12 | install-y := |
| @@ -35,10 +35,10 @@ · 34 unmodified lines | |||
| 35 | PHONY := __modpost | 35 | PHONY := __modpost |
| 36 | __modpost: | 36 | __modpost: |
| 37 | 37 | ||
| 38 | include include/config/auto.conf | 38 | include $(objtree)/include/config/auto.conf |
| 39 | include $(srctree)/scripts/Kbuild.include | 39 | include $(srctree)/scripts/Kbuild.include |
| 40 | 40 | ||
| 41 | MODPOST = scripts/mod/modpost | 41 | MODPOST = $(objtree)/scripts/mod/modpost |
| 42 | 42 | ||
| 43 | modpost-args = \ | 43 | modpost-args = \ |
| 44 | $(if $(CONFIG_MODULES),-M) \ | 44 | $(if $(CONFIG_MODULES),-M) \ |
| @@ -119,11 +119,11 @@ include $(kbuild-file) · 74 unmodified lines | |||
| 119 | 119 | ||
| 120 | output-symdump := $(KBUILD_EXTMOD)/Module.symvers | 120 | output-symdump := $(KBUILD_EXTMOD)/Module.symvers |
| 121 | 121 | ||
| 122 | ifeq ($(wildcard Module.symvers),) | 122 | ifeq ($(wildcard $(objtree)/Module.symvers),) |
| 123 | missing-input := Module.symvers | 123 | missing-input := $(objtree)/Module.symvers |
| 124 | else | 124 | else |
| 125 | modpost-args += -i Module.symvers | 125 | modpost-args += -i $(objtree)/Module.symvers |
| 126 | modpost-deps += Module.symvers | 126 | modpost-deps += $(objtree)/Module.symvers |
| 127 | endif | 127 | endif |
| 128 | 128 | ||
| 129 | modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS)) | 129 | modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS)) |
| @@ -12,7 +12,7 @@ KERNELRELEASE=$1 · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | : ${DEPMOD:=depmod} | 13 | : ${DEPMOD:=depmod} |
| 14 | 14 | ||
| 15 | if ! test -r System.map ; then | 15 | if ! test -r "${objtree}/System.map" ; then |
| 16 | echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2 | 16 | echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2 |
| 17 | exit 0 | 17 | exit 0 |
| 18 | fi | 18 | fi |
| @@ -25,7 +25,7 @@ if [ -z $(command -v $DEPMOD) ]; then · 6 unmodified lines | |||
| 25 | exit 0 | 25 | exit 0 |
| 26 | fi | 26 | fi |
| 27 | 27 | ||
| 28 | set -- -ae -F System.map | 28 | set -- -ae -F "${objtree}/System.map" |
| 29 | if test -n "$INSTALL_MOD_PATH"; then | 29 | if test -n "$INSTALL_MOD_PATH"; then |
| 30 | set -- "$@" -b "$INSTALL_MOD_PATH" | 30 | set -- "$@" -b "$INSTALL_MOD_PATH" |
| 31 | fi | 31 | fi |