Sfoglia il codice sorgente

kbuild: Add new Kbuild variable KBUILD_EXTRA_SYMBOLS

This patch adds a new (Kbuild) Makefile variable KBUILD_EXTRA_SYMBOLS.
The space separated list of file names assigned to KBUILD_EXTRA_SYMBOLS
is used when calling scripts/mod/modpost during stage 2 of the Kbuild
process for non-kernel-tree modules.

Signed-off-by: Richard Hacker <lerichi@gmx.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Richard Hacker 17 anni fa
parent
commit
0d96fb20b7
2 ha cambiato i file con 16 aggiunte e 1 eliminazioni
  1. 8 1
      Documentation/kbuild/modules.txt
  2. 8 0
      scripts/Makefile.modpost

+ 8 - 1
Documentation/kbuild/modules.txt

@@ -486,7 +486,7 @@ Module.symvers contains a list of all exported symbols from a kernel build.
 	Sometimes, an external module uses exported symbols from another
 	Sometimes, an external module uses exported symbols from another
 	external module. Kbuild needs to have full knowledge on all symbols
 	external module. Kbuild needs to have full knowledge on all symbols
 	to avoid spitting out warnings about undefined symbols.
 	to avoid spitting out warnings about undefined symbols.
-	Two solutions exist to let kbuild know all symbols of more than
+	Three solutions exist to let kbuild know all symbols of more than
 	one external module.
 	one external module.
 	The method with a top-level kbuild file is recommended but may be
 	The method with a top-level kbuild file is recommended but may be
 	impractical in certain situations.
 	impractical in certain situations.
@@ -523,6 +523,13 @@ Module.symvers contains a list of all exported symbols from a kernel build.
 		containing the sum of all symbols defined and not part of the
 		containing the sum of all symbols defined and not part of the
 		kernel.
 		kernel.
 
 
+	Use make variable KBUILD_EXTRA_SYMBOLS in the Makefile
+		If it is impractical to copy Module.symvers from another
+		module, you can assign a space separated list of files to
+		KBUILD_EXTRA_SYMBOLS in your Makfile. These files will be
+		loaded by modpost during the initialisation of its symbol
+		tables.
+
 === 8. Tips & Tricks
 === 8. Tips & Tricks
 
 
 --- 8.1 Testing for CONFIG_FOO_BAR
 --- 8.1 Testing for CONFIG_FOO_BAR

+ 8 - 0
scripts/Makefile.modpost

@@ -42,6 +42,13 @@ _modpost: __modpost
 
 
 include include/config/auto.conf
 include include/config/auto.conf
 include scripts/Kbuild.include
 include scripts/Kbuild.include
+
+ifneq ($(KBUILD_EXTMOD),)
+# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
+include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
+             $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
+endif
+
 include scripts/Makefile.lib
 include scripts/Makefile.lib
 
 
 kernelsymfile := $(objtree)/Module.symvers
 kernelsymfile := $(objtree)/Module.symvers
@@ -69,6 +76,7 @@ modpost = scripts/mod/modpost                    \
  $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,)       \
  $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,)       \
  $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile)   \
  $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile)   \
  $(if $(KBUILD_EXTMOD),-I $(modulesymfile))      \
  $(if $(KBUILD_EXTMOD),-I $(modulesymfile))      \
+ $(if $(iKBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
  $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
  $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \