score:1
[everything below is based on kernel 4.15.0]
forming of kbuild_modname
can be understood by looking into ‘scripts’ folder of kernel sources:
from makefile.lib:
# these flags are needed for modversions and compiling, so we define them here
# $(modname_flags) defines kbuild_modname as the name of the module it will
# end up in (or would, if it gets compiled in)
# note: files that end up in two or more modules are compiled without the
# kbuild_modname definition. the reason is that any made-up name would
# differ in different configs.
name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
basename_flags = -dkbuild_basename=$(call name-fix,$(basetarget))
modname_flags = $(if $(filter 1,$(words $(modname))),\
-dkbuild_modname=$(call name-fix,$(modname)))
from makefile.build:
# default for not multi-part modules
modname = $(basetarget)
$(multi-objs-m) : modname = $(modname-multi)
$(multi-objs-m:.o=.i) : modname = $(modname-multi)
$(multi-objs-m:.o=.s) : modname = $(modname-multi)
$(multi-objs-m:.o=.lst) : modname = $(modname-multi)
$(multi-objs-y) : modname = $(modname-multi)
$(multi-objs-y:.o=.i) : modname = $(modname-multi)
$(multi-objs-y:.o=.s) : modname = $(modname-multi)
$(multi-objs-y:.o=.lst) : modname = $(modname-multi)
from kbuild.include:
# filename of target with directory and extension stripped
basetarget = $(basename $(notdir $@))
from: makefile.lib
# finds the multi-part object the current object will be linked into
modname-multi = $(sort $(foreach m,$(multi-used),\
$(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
with all that, you can basically define kbuild_modname
in ‘objects and symbols’ to be set to your module name as you define it in your makefile. things are a little bit more tricky if you have multiple modules built in a single project...
after solving that you will notice that eclipse indexer still throws out warnings at you (i assume you are building external module with module
defined in ‘objects and symbols’)
- problem description: unused static function '__exittest'
- problem description: unused static function '__inittest'
- problem description: unused declaration of function 'cleanup_module'
- problem description: unused declaration of function 'init_module'
those are symbols used by kernel module loading/unloading system so eclipse can know nothing of them. unfortunately, as of today (eclipse 4.8.0 with cdt 9.5.2) i cannot configure code analysis to exclude those symbols from warnings, so have to suppress warnings putting following to the lines of code where you define module initialization:
// @suppress("unused static function") @suppress("unused function declaration")
Source: stackoverflow.com
Related Query
- How do you make Eclipse recognize Java EE jar files so Servlets can compile?
- How do I make Eclipse recognize JUnit tests when creating a suite?
- How do I make Eclipse recognize KBUILD_MODNAME?
- How can I make Eclipse C.D.T. recognize C++11 features?
- How to make eclipse recognize the correct file extension/open the correct editor for files opened outside of the scope of a project?
- How to bring Autocomplete feature in a CQ5 Archtype Maven project and make eclipse recognize CQ classes like SlingRepository, javax.jcr.Node etc?
- How can I make eclipse recognize projects from another computer?
- How to make Tortoise recognize project checkout originaly using Eclipse Plugin for SVN?
- How to make Eclipse recognize the __far modifier?
- How do I make Eclipse recognize the Java compiler (1.6) and projects facet (1.6) do, in fact, match in GAE project?
- How make Eclipse/EGit recognize existing repository information after update?
- How to make Eclipse behave well in the Windows 7 taskbar?
- How to make an existing directory into an eclipse project
- How to make Eclipse prompt me for command line arguments
- How to make eclipse "File Search" to also search inside source jars containing some text?
- Very slow Eclipse 4.2, how to make it more responsive?
- How can I make Eclipse file search not include svn directories?
- How to have Eclipse recognize dependencies from SBT
- How to make eclipse automatically add braces to an IF statement?
- How to make war file in Eclipse
- How to make Eclipse behave well in the Windows 10 taskbar and program search?
- How do you make eclipse use an existing svn working copy?
- How can I make the Mylyn GitHub Connector for Eclipse run authenticated requests?
- Why is Eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?
- How to make a new Eclipse project template?
- How do I make Eclipse and mvn appengine:devserver talk to each other?
- How can I make hidden files display in Eclipse Project explorer when using a RSE linked folder?
- How to make Eclipse see the changes in Play! compiled templates?
- How to make the whole line change color in Eclipse when I toggle a breakpoint?
- How can I make Eclipse output std:out to a standard windows console
More Query from same tag
- In Eclipse, how do I sort the jars resolved by Ivy
- Generate getters and setters for inner class. Eclipse
- What does the command "Fix Project Properties" exactly do?
- Runtime error on the exact same code on a different computer
- Eclipse editor show variable occurrence
- Listener on open file in Eclipse
- Which Eclipse plugin enables using XML to define GUI
- unittest testcase setup new object
- Why I am getting class not found exception for Class.forName("com.mysql.jdbc.Driver");
- Eclipse error on startup: 'Android LIbrary Update' has encountered
- Conditional Breakpoint Error - Type does not implement selector max and signature
- Eclipse : Creating Web Service via Apache Axis2 & Tomcat server 7
- How to set the target version for runnable jar in Eclipse
- Android - application depending on own api - server offline
- Java Decompiler plugin in Eclipse with JavaDoc
- My first web client giving "MessageBodyWriter not found for media type..." (JSON)
- How to prevent P2 to overwrite eclipse.ini
- How to run JUnit test in Eclipse
- debugging Android application (in Eclipse)
- Other ways of setting (and unsetting) http-proxy-host for subversion (MacOS)
- In which folder should I place REST resources in a dynamic web app?
- Create and show View in a WizardPage
- JNA Win32 examples
- Sonarlink plugin not getting installed in eclipse
- Eclipse DTP is not creating a connection
- Eclipse can't detect resources - "R cannot be resolved to a variable"
- No traceback in eclipse pydev
- How to make an AVD with > 768MB RAM To emulate Galaxy devices
- Eclipse Plugin --add-exports Java 16+
- Libraries for pretty charts in SWT?