mirror of
https://github.com/torvalds/linux
synced 2024-10-16 00:10:42 +00:00
kbuild: check asm symlink when building a kernel
We often hit the situation where the asm symlink in include/ points to the wrong architecture. In 9 out of 10 cases thats because we forgot to set ARCH but sometimes we just reused the same tree for another ARCH. For the merged x86 tree we need to create a new symlink but this is not obvious. So with the following patch we check if the symlink points to the correct architecture and error out if this is not the case. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
d85714d81c
commit
fc333b2df3
24
Makefile
24
Makefile
|
@ -903,14 +903,24 @@ prepare: prepare0
|
||||||
|
|
||||||
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
|
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
|
||||||
|
|
||||||
# FIXME: The asm symlink changes when $(ARCH) changes. That's
|
# The asm symlink changes when $(ARCH) changes.
|
||||||
# hard to detect, but I suppose "make mrproper" is a good idea
|
# Detect this and ask user to run make mrproper
|
||||||
# before switching between archs anyway.
|
|
||||||
|
|
||||||
include/asm:
|
include/asm: FORCE
|
||||||
@echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'
|
$(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
|
||||||
$(Q)if [ ! -d include ]; then mkdir -p include; fi;
|
if [ -L include/asm ]; then \
|
||||||
@ln -fsn asm-$(SRCARCH) $@
|
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
|
# Generate some files
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue