aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2004-07-28 04:36:33 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2004-07-28 04:36:33 +0200
commite09e58867154b8aae0a3ac26a9b1c05962f5a355 (patch)
tree9b30ea58ba216bba2025301e61eebeabbf4ec9ec /Makefile
parente321b2ec2eb2993b3d0116e5163c78ad923e3c54 (diff)
downloadhistory-e09e58867154b8aae0a3ac26a9b1c05962f5a355.tar.gz
kbuild: Introduce source symlink in /lib/modules/.../
Traditionally when building a kernel the source and the output files are mixed. When building a kernel using the O= syntax to save output files in a separate directory a way is needed to locate the kernel source. The implemented solution is a new symlink 'source' being added to /lib/modules/.../ used to locate source for an installed kernel. The original symlink build points to the directory containing the output files. Please note that when the kernel is build with source and output files mixed the two symlinks 'build' and 'source' will point to the same directory, thus no changes compared to before. Two options was considered: a) Adding a new symlink pointing to the output files "object" => All external modules have to specify O= to build => External modules grepping in .config or .h files in include/asm needs to be updated => External modules that do grep in source code and ordinary header files just works b) Let the build symlink point to the output files and introduce a new symlink "source" pointing to the kernel source => External module can be build without specifying O= => External modules grepping in .config or .h files in include/asm just works => External modules that do grep in source code and ordinary header files needs to be updated Based on the above option b) is considered the least painfull alternative. So to sum up: - If a distro does not use separate output dir => no change - If a distro uses separate output dir => - Trivial external module just builds - Non-trivial (build-wise) external modules are probarly broken Without this patch - If a distro does not use separate output dir => no change - If a distro uses separate output dir => - Trivial external modules had to specify O= to build, and the directory being pointed at was not obvious - grep in .config or include files in asm/ required knowledge where to locate output files Preferred syntax for building external modules are the following: make -C /lib/modules/`uname -r`/build M=`pwd` [Substituting 'M=...' with 'SUBDIRS=... modules' give same effect]. When the kernel is built using separate output directory the above invocation of make will invoke the generated Makefile located in the output directory - that again will invoke the Makefile located in the kernel source tree root. Patch includes contributions from: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 6 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 3723c9ef5c3bd5..b9bf1fbaf1ff52 100644
--- a/Makefile
+++ b/Makefile
@@ -769,9 +769,13 @@ _modinst_:
sleep 1; \
fi
@rm -rf $(MODLIB)/kernel
- @rm -f $(MODLIB)/build
+ @rm -f $(MODLIB)/source
@mkdir -p $(MODLIB)/kernel
- @ln -s $(TOPDIR) $(MODLIB)/build
+ @ln -s $(srctree) $(MODLIB)/source
+ @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
+ rm -f $(MODLIB)/build ; \
+ ln -s $(objtree) $(MODLIB)/build ; \
+ fi
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a