|
@@ -887,10 +887,7 @@ prepare2: prepare3 outputmakefile
|
|
|
|
|
|
prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
|
|
|
include/asm include/config/auto.conf
|
|
|
-ifneq ($(KBUILD_MODULES),)
|
|
|
- $(Q)mkdir -p $(MODVERDIR)
|
|
|
- $(Q)rm -f $(MODVERDIR)/*
|
|
|
-endif
|
|
|
+ $(cmd_crmodverdir)
|
|
|
|
|
|
archprepare: prepare1 scripts_basic
|
|
|
|
|
@@ -906,14 +903,24 @@ prepare: prepare0
|
|
|
|
|
|
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
|
|
|
|
|
|
-# FIXME: The asm symlink changes when $(ARCH) changes. That's
|
|
|
-# hard to detect, but I suppose "make mrproper" is a good idea
|
|
|
-# before switching between archs anyway.
|
|
|
-
|
|
|
-include/asm:
|
|
|
- @echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'
|
|
|
- $(Q)if [ ! -d include ]; then mkdir -p include; fi;
|
|
|
- @ln -fsn asm-$(SRCARCH) $@
|
|
|
+# The asm symlink changes when $(ARCH) changes.
|
|
|
+# Detect this and ask user to run make mrproper
|
|
|
+
|
|
|
+include/asm: FORCE
|
|
|
+ $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
|
|
|
+ if [ -L include/asm ]; then \
|
|
|
+ if [ "$$asmlink" != "$(SRCARCH)" ]; then \
|
|
|
+ echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
|
|
|
+ echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
|
|
|
+ exit 1; \
|
|
|
+ fi; \
|
|
|
+ else \
|
|
|
+ echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
|
|
|
+ if [ ! -d include ]; then \
|
|
|
+ mkdir -p include; \
|
|
|
+ fi; \
|
|
|
+ ln -fsn asm-$(SRCARCH) $@; \
|
|
|
+ fi
|
|
|
|
|
|
# Generate some files
|
|
|
# ---------------------------------------------------------------------------
|
|
@@ -1023,19 +1030,12 @@ _modinst_:
|
|
|
fi
|
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
|
|
|
|
|
-# If System.map exists, run depmod. This deliberately does not have a
|
|
|
-# dependency on System.map since that would run the dependency tree on
|
|
|
-# vmlinux. This depmod is only for convenience to give the initial
|
|
|
+# This depmod is only for convenience to give the initial
|
|
|
# boot a modules.dep even before / is mounted read-write. However the
|
|
|
# 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
|
|
|
_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
|
|
|
|
|
@@ -1223,8 +1223,7 @@ else # KBUILD_EXTMOD
|
|
|
KBUILD_MODULES := 1
|
|
|
PHONY += crmodverdir
|
|
|
crmodverdir:
|
|
|
- $(Q)mkdir -p $(MODVERDIR)
|
|
|
- $(Q)rm -f $(MODVERDIR)/*
|
|
|
+ $(cmd_crmodverdir)
|
|
|
|
|
|
PHONY += $(objtree)/Module.symvers
|
|
|
$(objtree)/Module.symvers:
|
|
@@ -1252,15 +1251,6 @@ _emodinst_:
|
|
|
$(Q)mkdir -p $(MODLIB)/$(install-dir)
|
|
|
$(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
|
|
|
_emodinst_post: _emodinst_
|
|
|
$(call cmd,depmod)
|
|
@@ -1344,7 +1334,7 @@ define find-sources
|
|
|
find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
|
|
|
-name $1 -print; \
|
|
|
find $(__srctree) $(RCS_FIND_IGNORE) \
|
|
|
- \( -name include -o -name arch \) -prune -o \
|
|
|
+ \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
|
|
|
-name $1 -print; \
|
|
|
)
|
|
|
endef
|
|
@@ -1493,9 +1483,11 @@ endif
|
|
|
|
|
|
# Modules
|
|
|
/ %/: prepare scripts FORCE
|
|
|
+ $(cmd_crmodverdir)
|
|
|
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
|
|
$(build)=$(build-dir)
|
|
|
%.ko: prepare scripts FORCE
|
|
|
+ $(cmd_crmodverdir)
|
|
|
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
|
|
$(build)=$(build-dir) $(@:.ko=.o)
|
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
@@ -1509,6 +1501,19 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
|
|
|
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(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
|
|
|
+
|
|
|
+# Create temporary dir for module support files
|
|
|
+cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/*
|
|
|
+
|
|
|
|
|
|
a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
|
|
|
$(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
|