Commit 50a8ec31c3a00594ceb7c5f1dcf2ecdaf6a5b847
1 parent
6f67a00498
Exists in
master
and in
20 other branches
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=3881 Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Christian Bjølevik <nafallo@magicalforest.se> Cc: Deepak Saxena <dsaxena@mvista.com> and Cc: Armin Kuster <akuster@mvista.com>,
Showing 1 changed file with 12 additions and 18 deletions Side-by-side Diff
Makefile
... | ... | @@ -1030,19 +1030,12 @@ |
1030 | 1030 | fi |
1031 | 1031 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1032 | 1032 | |
1033 | -# If System.map exists, run depmod. This deliberately does not have a | |
1034 | -# dependency on System.map since that would run the dependency tree on | |
1035 | -# vmlinux. This depmod is only for convenience to give the initial | |
1033 | +# This depmod is only for convenience to give the initial | |
1036 | 1034 | # boot a modules.dep even before / is mounted read-write. However the |
1037 | 1035 | # boot script depmod is the master version. |
1038 | -ifeq "$(strip $(INSTALL_MOD_PATH))" "" | |
1039 | -depmod_opts := | |
1040 | -else | |
1041 | -depmod_opts := -b $(INSTALL_MOD_PATH) -r | |
1042 | -endif | |
1043 | 1036 | PHONY += _modinst_post |
1044 | 1037 | _modinst_post: _modinst_ |
1045 | - if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi | |
1038 | + $(call cmd,depmod) | |
1046 | 1039 | |
1047 | 1040 | else # CONFIG_MODULES |
1048 | 1041 | |
... | ... | @@ -1259,15 +1252,6 @@ |
1259 | 1252 | $(Q)mkdir -p $(MODLIB)/$(install-dir) |
1260 | 1253 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1261 | 1254 | |
1262 | -# Run depmod only is we have System.map and depmod is executable | |
1263 | -quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | |
1264 | - cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ | |
1265 | - $(DEPMOD) -ae -F System.map \ | |
1266 | - $(if $(strip $(INSTALL_MOD_PATH)), \ | |
1267 | - -b $(INSTALL_MOD_PATH) -r) \ | |
1268 | - $(KERNELRELEASE); \ | |
1269 | - fi | |
1270 | - | |
1271 | 1255 | PHONY += _emodinst_post |
1272 | 1256 | _emodinst_post: _emodinst_ |
1273 | 1257 | $(call cmd,depmod) |
... | ... | @@ -1515,6 +1499,16 @@ |
1515 | 1499 | |
1516 | 1500 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) |
1517 | 1501 | cmd_rmfiles = rm -f $(rm-files) |
1502 | + | |
1503 | +# Run depmod only is we have System.map and depmod is executable | |
1504 | +# and we build for the host arch | |
1505 | +quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | |
1506 | + cmd_depmod = \ | |
1507 | + if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \ | |
1508 | + $(DEPMOD) -ae -F System.map \ | |
1509 | + $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \ | |
1510 | + $(KERNELRELEASE); \ | |
1511 | + fi | |
1518 | 1512 | |
1519 | 1513 | |
1520 | 1514 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ |