Commit 50a8ec31 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: disable depmod in cross-compile kernel build

When building embedded systems in a cross-compile environment and
populating a target's file system image, we don't want to run the
depmod on the host as we may be building for a completely different
architecture. Since there's no such thing as a cross-depmod, we
just disable running depmod in the cross-compile case and we just
run depmod on the target at bootup.

Inspired by patches from Christian, Armin and Deepak.

This solves: http://bugzilla.kernel.org/show_bug.cgi?id=3881Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Cc: Christian Bjølevik <nafallo@magicalforest.se>
Cc: Deepak Saxena <dsaxena@mvista.com> and
Cc: Armin Kuster <akuster@mvista.com>,
parent 6f67a004
...@@ -1030,19 +1030,12 @@ _modinst_: ...@@ -1030,19 +1030,12 @@ _modinst_:
fi fi
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a # This depmod is only for convenience to give the initial
# dependency on System.map since that would run the dependency tree on
# vmlinux. This depmod is only for convenience to give the initial
# boot a modules.dep even before / is mounted read-write. However the # boot a modules.dep even before / is mounted read-write. However the
# boot script depmod is the master version. # boot script depmod is the master version.
ifeq "$(strip $(INSTALL_MOD_PATH))" ""
depmod_opts :=
else
depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
PHONY += _modinst_post PHONY += _modinst_post
_modinst_post: _modinst_ _modinst_post: _modinst_
if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi $(call cmd,depmod)
else # CONFIG_MODULES else # CONFIG_MODULES
...@@ -1259,15 +1252,6 @@ _emodinst_: ...@@ -1259,15 +1252,6 @@ _emodinst_:
$(Q)mkdir -p $(MODLIB)/$(install-dir) $(Q)mkdir -p $(MODLIB)/$(install-dir)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# Run depmod only is we have System.map and depmod is executable
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
$(DEPMOD) -ae -F System.map \
$(if $(strip $(INSTALL_MOD_PATH)), \
-b $(INSTALL_MOD_PATH) -r) \
$(KERNELRELEASE); \
fi
PHONY += _emodinst_post PHONY += _emodinst_post
_emodinst_post: _emodinst_ _emodinst_post: _emodinst_
$(call cmd,depmod) $(call cmd,depmod)
...@@ -1516,6 +1500,16 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) ...@@ -1516,6 +1500,16 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
cmd_rmfiles = rm -f $(rm-files) cmd_rmfiles = rm -f $(rm-files)
# Run depmod only is we have System.map and depmod is executable
# and we build for the host arch
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_depmod = \
if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \
$(DEPMOD) -ae -F System.map \
$(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \
$(KERNELRELEASE); \
fi
a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
$(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment