summaryrefslogtreecommitdiffstats
path: root/scripts/nsdeps
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-10-29 13:38:08 +0100
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-11-11 12:10:01 +0100
commitbc35d4bda205d85bf8f87bb013a59afb6b87bc89 (patch)
tree80d48daefcea848af9cb83c6a520848895ce4c68 /scripts/nsdeps
parentmodpost: dump missing namespaces into a single modules.nsdeps file (diff)
downloadlinux-bc35d4bda205d85bf8f87bb013a59afb6b87bc89.tar.xz
linux-bc35d4bda205d85bf8f87bb013a59afb6b87bc89.zip
scripts/nsdeps: support nsdeps for external module builds
scripts/nsdeps is written to take care of only in-tree modules. Perhaps, this is not a bug, but just a design. At least, Documentation/core-api/symbol-namespaces.rst focuses on in-tree modules. Having said that, some people already tried nsdeps for external modules. So, it would be nice to support it. Reported-by: Steve French <smfrench@gmail.com> Reported-by: Jessica Yu <jeyu@kernel.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Tested-by: Jessica Yu <jeyu@kernel.org> Acked-by: Jessica Yu <jeyu@kernel.org> Reviewed-by: Matthias Maennich <maennich@google.com> Tested-by: Matthias Maennich <maennich@google.com>
Diffstat (limited to 'scripts/nsdeps')
-rw-r--r--scripts/nsdeps10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/nsdeps b/scripts/nsdeps
index f802c6f7b860..03a8e7cbe6c7 100644
--- a/scripts/nsdeps
+++ b/scripts/nsdeps
@@ -21,6 +21,12 @@ if [ "$SPATCH_VERSION_NUM" -lt "$SPATCH_REQ_VERSION_NUM" ] ; then
exit 1
fi
+if [ "$KBUILD_EXTMOD" ]; then
+ src_prefix=
+else
+ src_prefix=$srctree/
+fi
+
generate_deps_for_ns() {
$SPATCH --very-quiet --in-place --sp-file \
$srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2
@@ -32,7 +38,7 @@ generate_deps() {
local namespaces="$*"
local mod_source_files="`cat $mod.mod | sed -n 1p \
| sed -e 's/\.o/\.c/g' \
- | sed "s|[^ ]* *|${srctree}/&|g"`"
+ | sed "s|[^ ]* *|${src_prefix}&|g"`"
for ns in $namespaces; do
echo "Adding namespace $ns to module $mod.ko."
generate_deps_for_ns $ns "$mod_source_files"
@@ -54,4 +60,4 @@ generate_deps() {
while read line
do
generate_deps $line
-done < modules.nsdeps
+done < $MODULES_NSDEPS