summaryrefslogtreecommitdiffstats
path: root/meta/classes/module.bbclass
AgeCommit message (Collapse)Author
2022-08-12classes: Update classes to match new bitbake class scope functionalityRichard Purdie
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add SPDX license identifiersRichard Purdie
As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-30Convert to new override syntaxRichard Purdie
This is the result of automated script conversion: scripts/contrib/convert-overrides.py <oe-core directory> converting the metadata to use ":" as the override character instead of "_". Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-16module.bbclass: Add INSTALL_FW_PATH for out-of-tree modulesWes Lindauer
This same variable was added to the make line in kernel.bbclass in 0decf1cc1c35dd70f3b822e3b4291a810a319ba0. With the addition of the usrmerge feature, out-of-tree modules could use this same variable. Signed-off-by: Wes Lindauer <wesley.lindauer@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-24make-mod-scripts: change how some kernel module tools are builtJoe Slater
Remove do_make_scripts() from module-base.bbclass and put functionality in a recipe. This will build the scripts only once instead of each time an external module is built. [YOCTO #12228] Signed-off-by: Joe Slater <jslater@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30module.bbclass: move make scripts earlierCalifornia Sullivan
Some out of tree modules require the scripts for configuration. For example, backport-iwlwifi. Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30module.bbclass: Add devshell supportStefan Wiehler
Adds development shell support for out-of-tree kernel modules by reproducing the build environment of the compile task. Signed-off-by: Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-21kernel: use ${nonarch_base_libdir} for kernel modules installation.Amarnath Valluri
Replace hardcoded '/lib' in kernel modules installation path with ${nonarch_base_libdir}, which is meant exactly for this. Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2017-03-08module.bbclass: Add inherit of pkgconfigPeter Kjellerstedt
This is needed for the make_scripts task. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-23Switch to Recipe Specific SysrootsRichard Purdie
This patch is comparatively large and invasive. It does only do one thing, switching the system to build using recipe specific sysroots and where changes could be isolated from it, that has been done. With the current single sysroot approach, its possible for software to find things which aren't in their dependencies. This leads to a determinism problem and is a growing issue in several of the market segments where OE makes sense. The way to solve this problem for OE is to have seperate sysroots for each recipe and these will only contain the dependencies for that recipe. Its worth noting that this is not task specific sysroots and that OE's dependencies do vary enormously by task. This did result in some implementation challenges. There is nothing stopping the implementation of task specific sysroots at some later point based on this work but that as deemed a bridge too far right now. Implementation details: * Rather than installing the sysroot artefacts into a combined sysroots, they are now placed in TMPDIR/sysroot-components/PACKAGE_ARCH/PN. * WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by hardlinking in files from the sysroot-component trees. These new directories are known as RECIPE_SYSROOT and RECIPE_SYSROOT_NATIVE. * This construction is primarily done by a new do_prepare_recipe_sysroot task which runs before do_configure and consists of a call to the extend_recipe_sysroot function. * Other tasks need things in the sysroot before/after this, e.g. do_patch needs quilt-native and do_package_write_deb needs dpkg-native. The code therefore inspects the dependencies for each task and adds extend_recipe_sysroot as a prefunc if it has populate_sysroot dependencies. * We have to do a search/replace 'fixme' operation on the files installed into the sysroot to change hardcoded paths into the correct ones. We create a fixmepath file in the component directory which lists the files which need this operation. * Some files have "postinstall" commands which need to run against them, e.g. gdk-pixbuf each time a new loader is added. These are handled by adding files in bindir with the name prefixed by "postinst-" and are run in each sysroot as its created if they're present. This did mean most sstate postinstalls have to be rewritten but there shouldn't be many of them. * Since a recipe can have multiple tasks and these tasks can run against each other at the same time we have to have a lock when we perform write operations against the sysroot. We also have to maintain manifests of what we install against a task checksum of the dependency. If the checksum changes, we remove its files and then add the new ones. * The autotools logic for filtering the view of m4 files is no longer needed (and was the model for the way extend_recipe_sysroot works). * For autotools, we used to build a combined m4 macros directory which had both the native and target m4 files. We can no longer do this so we use the target sysroot as the default and add the native sysroot as an extra backup include path. If we don't do this, we'd have to build target pkg-config before we could built anything using pkg-config for example (ditto gettext). Such dependencies would be painful so we haven't required that. * PKDDATA_DIR was moved out the sysroot and works as before using sstate to build a hybrid copy for each machine. The paths therefore changed, the behaviour did not. * The ccache class had to be reworked to function with rss. * The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the -initial data does have to be filtered out from the main recipe sysroots. Putting "-initial" in a normal recipe name therefore remains a bad idea. * The logic in insane needed tweaks to deal with the new path layout, as did the debug source file extraction code in package.bbclass. * The logic in sstate.bbclass had to be rewritten since it previously only performed search and replace on extracted sstate and we now need this to happen even if the compiled path was "correct". This in theory could cause a mild performance issue but since the sysroot data was the main data that needed this and we'd have to do it there regardless with rss, I've opted just to change the way the class for everything. The built output used to build the sstate output is now retained and installed rather than deleted. * The search and replace logic used in sstate objects also seemed weak/incorrect and didn't hold up against testing. This has been rewritten too. There are some assumptions made about paths, we save the 'proper' search and replace operations to fixmepath.cmd but then ignore this. What is here works but is a little hardcoded and an area for future improvement. * In order to work with eSDK we need a way to build something that looks like the old style sysroot. "bitbake build-sysroots" will construct such a sysroot based on everything in the components directory that matches the current MACHINE. It will allow transition of external tools and can built target or native variants or both. It also supports a clean task. I'd suggest not relying on this for anything other than transitional purposes though. To see XXX in that sysroot, you'd have to have built that in a previous bitbake invocation. * pseudo is run out of its components directory. This is fine as its statically linked. * The hacks for wayland to see allarch dependencies in the multilib case are no longer needed and can be dropped. * wic needed more extensive changes to work with rss and the fixes are in a separate commit series * Various oe-selftest tweaks were needed since tests did assume the location to binaries and the combined sysroot in several cases. * Most missing dependencies this work found have been sent out as separate patches as they were found but a few tweaks are still included here. * A late addition is that extend_recipe_sysroot became multilib aware and able to populate multilib sysroots. I had hoped not to have to add that complexity but the meta-environment recipe forced my hand. That implementation can probably be neater but this is on the list of things to cleanup later at this point. In summary, the impact people will likely see after this change: * Recipes may fail with missing dependencies, particularly native tools like gettext-native, glib-2.0-native and libxml2.0-native. Some hosts have these installed and will mask these errors * Any recipe/class using SSTATEPOSTINSTFUNCS will need that code rewriting into a postinst * There was a separate patch series dealing with roots postinst native dependency issues. Any postinst which expects native tools at rootfs time will need to mark that dependency with PACKAGE_WRITE_DEPS. There could well be other issues. This has been tested repeatedly against our autobuilders and oe-selftest and issues found have been fixed. We believe at least OE-Core is in good shape but that doesn't mean we've found all the issues. Also, the logging is a bit chatty at the moment. It does help if something goes wrong and goes to the task logfiles, not the console so I've intentionally left this like that for now. We can turn it down easily enough in due course. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-05module.bbclass: allow to override location of Module.symversAndré Draszik
Requiring all build systems for external kernel modules to place Module.symvers directly into ${B}/. is quite an artificial assumption/requirement. It doesn't have to end up there, but could easily end up somewhere below ${B}. Allow to override the location below ${B} Note that we still don't make use of multiple Module.symvers in case there are any generated by one single kernel module build, but this is no change in behaviour from before and could be added if there really is a demand for that. Reported-by: Denys Dmytriyenko <denis@denix.org> Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-16meta: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-09-08module.bbclass: use Module.symvers for dependantsAndré Draszik
When compiling multiple external kernel modules, where one depends on the other, there are two problems at the moment: 1) we get compile time warnings from the kernel build system due to missing symbols (from modpost). 2) Any modules generated are missing dependency information (in the .modinfo elf section) for any dependencies outside the current source tree and outside the kernel itself. This is expected, but the kernel build system has a way to deal with this - the dependent module is expected to specify KBUILD_EXTRA_SYMBOLS (as a space-separated list) to point to any and all Module.symvers of kernel modules that are dependencies. While 1) by itself is not really a big issue, 2) prevents the packaging process from generating cross-source tree package dependencies. As a first step to solve the missing dependencies in packages created, we: 1) install Module.symvers of all external kernel module builds (into a location that is automatically packaged into the -dev package) 2) make use of KBUILD_EXTRA_SYMBOLS and pass the location of all Module.symvers of all kernel-module-* packages we depend on This solves both problems mentioned above. Signed-off-by: André Draszik <git@andred.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-02classes/module: allow substitution of the modules_install target namePaul Eggleton
Quite a few external kernel modules I've found floating around don't have a modules_install target, but they do have an install target that basically differs only in name. To make it easier to build these just make this a MODULES_INSTALL_TARGET variable that you can set from the recipe - the alternative would be copy-and-paste the do_install definition from this class which is potentially fragile. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-05-14module/module-base/lttng-modules: Improve kernel module dependenciesRichard Purdie
If we have DEPENDS = "virtual/kernel" is means that the kernel module depends on the kernel's do_populate_sysroot task. This is not entirely desireable since that depends on do_install which depends on do_compile_kernelmodules and so on. In a situation where rm_work in involved this can cause some pretty length build cycles after the kernel workdir has been cleaned up by rm_work. As well as removing this, take the opportunity to clean up duplicated dependency lines, tweak the dependency of make_scripts for the same reason and generally try and make things more readable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-16kernel: move source and build output to work-sharedBruce Ashfield
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of moving the kernel source and build artefacts out of sstate control and into a shared location. This changed triggered some workflow issues, as well as bugs related to the kernel source containing build output, and hence being dirty and breaking kernel rebuilds. To solve these issues, and to make it clear that the kernel is not under sstate control, we move the source and build outputs to: work-shared/MACHINE/kernel-source work-shared/MACHINE/kernel-build-artifacts Where kernel-build-artifacts is the kernel build output and kernel-source is kept "pristine". The build-artifacts contain everything that is required to build external modules against the kernel source, and includes the defconfig, the kernel-abiversion, System.map files and output from "make scripts". External module builds should either pass O= on the command line, or set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass takes care of setting KBUILD_OUTPUT, so most existing external module recipes are transparently adapted to the new source/build layout. recipes that depend on the kernel source must have a depedency on the do_shared_workdir task: do_configure[depends] += "virtual/kernel:do_shared_workdir" With this dependency added, the STAGING_KERNEL_DIR will be populated and available to the rest of the build. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-16module.bbclass: Add KERNEL_SRC in EXTRA_OEMAKEOtavio Salvador
When the sstate hash changes for do_configure task, the do_configure default implementation triggers the 'clean' to be run. For it to succeed we need to have KERNEL_SRC defined in EXTRA_OEMAKE. Fixes following error: ,---- | DEBUG: Executing shell function do_configure | NOTE: make -e MAKEFLAGS= clean | make -C M=.../tmp/work/... clean | make[1]: *** M=.../tmp/work/...: No such file or directory. Stop. | Makefile:20: recipe for target 'clean' failed | make: *** [clean] Error 2 | ERROR: oe_runmake failed `---- Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-04kernel: extract functions for kernel modules to separate bbclassMartin Jansa
* this way we can reuse the same functionality also for external modules including module_autoload_foo and module_conf_foo functionality * MODULE_PACKAGES variable was removed (splited modules are now returned by do_split_packages * KERNEL_MODULES_META_PACKAGE is used to append all splitted packages to RDEPENDS. In kernel.bbclass it's old "kernel-modules" in module.bbclass it defaults to ${PN} for upgrade path from single PN with all modules to PN depending on all new kernel-module-* Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-01module.bbclass: Create a new depmodwrapper to assist cross-installsMark Hatle
Previously the build path to STAGING_KERNEL_DIR was being embedded into the package post install scripts. We avoid this behavior by generating a special depmodwrapper script. This script contains that hard-coded path, ensuring that re-use of the sstate-cache (and/or packages) will always run through the wrapper generated by the current build with a checksum that includes STAGING_KERNEL_DIR. [ YOCTO #3962 ] Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-01module.bbclass: Allow for modules to be packaged seperate from ${PN}Saul Wold
This patch will allow recipes that provide kernel modules to package the module or modules in specific packages. That list is contained in MODULE_PACKAGES, this defaults to to preserve the current behavior. The package can also define MODULE_FILES to specify files. [YOCTO #3803] (From OE-Core rev: c1ff0467bf03a3342846f0d9dde74e34b740798f) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-29module.bbclass: Don't add pkg_postinst/pkg_prerm to all packages in recipeSaul Wold
The code in module.bbclass was appending the pkg_postinst and pkg_prerm to all packages that are part of a given recipe, meaning that the -lic, -dev, -doc, ... packages all got the scriptlet This change uses only which macthes with the RDEPENDS and FILES already used in module.bbclass. The failure was that rootfs creation would fail due to the -lic package being installed before the kernel and the script would fail. [YOCTO #3803] Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-18module.bbclass: do not use update-modules anymoreLaurentiu Palcu
update-modules is obsolete. The bbclass was updated not to use it anymore. [YOCTO #3598] Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-14module.bbclass: make sure do_make_scripts() executes after do_patch()Tom Zanussi
If do_make_scripts() executes before do_unpack()/do_patch(), the build fails because it can't cd into the workdir of a recipe using this class, so make sure do_make_scripts() doesn't run before the package has been unpacked and patched. Fixes [YOCTO #3589]. Signed-off-by: Tom Zanussi <tom.zanussi@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-10-18module.bbclass: Move do_make_scripts() to module-basePhil Blundell
It's sometimes useful to have this function available to recipes which don't wish to use module.bbclass for whatever reason. Signed-off-by: Phil Blundell <pb@pbcl.net> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2012-10-18kernel.bbclass, module.bbclass: Make update-modules optionalPhil Blundell
The update-modules mechanism is something of a historical relic and it isn't entirely clear that it has a great deal of value nowadays. Also, it causes a problem when building a read-only rootfs since update-modules itself refuses to configure offline. Allow DISTROs to circumvent this whole thing by declaring (via DISTRO_FEATURES) that they don't wish to use update-modules. This is backfilled for existing distributions and will have to be marked as CONSIDERED by those who actually don't want it. Signed-off-by: Phil Blundell <pb@pbcl.net> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2012-04-24{kernel, module}.bbclass: don't run depmod for module packages during do_rootfsAndreas Oberritter
* depmod already gets executed by pkg_postinst_kernel-image. * If you build a module using module.bbclass, pkg_postinst returns 1 in do_rootfs, causing pkg_postinst to run again on first boot. To improve this situation, I copied pkg_postinst from kernel.bbclass to module.bbclass. This was rejected by Koen, because he doesn't like the code from kernel.bblcass, which uses ${STAGING_DIR_KERNEL}. Richard then suggested that calling depmod during do_rootfs wasn't necessary at all, because it already gets done by kernel-image. Signed-off-by: Andreas Oberritter <obi@opendreambox.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-10-20module.bbclass: add lock to prevent error bulding ext modulesAnders Darander
When external modules are built, files in $STAGING_KERNEL_DIR/scripts/basic will/can get rebuilt. This raises a potential race condition. Prevent this by adding a lock around the do_make_scripts() function. Further, make sure that the kernel has been installed to the sysroot, prior to executing this new task. Signed-off-by: Anders Darander <anders@chargestorm.se>
2011-03-21kernel/bbclass: rework kernel and module classes to allow for building ↵Darren Hart
out-of-tree modules The existing infrastructure uses an external build tree which references the kernel source in the work dir. If run with rm work, building external modules will fail. This patch places a configured source tree in sysroots. Striking a balance between minimal size and minimal maintenance is difficult. A fully configured tree is about 500MB after a clean. This version leans on the side of caution and removes only the obviously unecessary parts of the source tree to conserve space, resulting in about 170MB. The arch directories would be some additional pruning we could do. Given examples from the devel package from distributions, I suspect this size could be reduced to 75MB or so, but at the cost of a much more complex recipe which is likely to require a great deal more maintenance to keep current with kernel releases. Care is also taken to clean the hostprogs in scripts, and the modules are responsible for building them as needed. Although it is unclear to me if this is really necessary, especially considering that modules put these bits back as soon as they compile. If we are not generating an sstate package, I suspect we can ignore these. Please try this with your modules and let me know how it does. I tried to take non linux-yocto kernel recipes into account, but I have only tested with linux-yocto and the hello-mod recipe so far. Signed-off-by: Darren Hart <dvhart@linux.intel.com> Acked-by: Koen Kooi <koen@dominion.thruhere.net> Acked-by: Gary Thomas <gary@mlbassoc.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-04module: build hostprogs for each moduleDarren Hart
This fixes [BUGID #241] The kernel hostprogs are built for the host architecture. They should not be deployed to the target, and they should not be included in an sstate package which might get reused on a host of a different architecture. As we don't build many out-of-tree modules, this patch takes the approach of building the hostprogs as part of the module compile process with a do_compile_prepend() routine in module.bbclass. We don't have to clean the hostprogs as modules depend on the kernel being populate_staging, so its done with the staging directory by the time we run. Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Gary Thomas <gary@mlbassoc.com>
2008-05-21module.bbclass: Fix external module version dependenciesRichard Purdie
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4518 311d38ba-8fff-0310-9ca6-ca027cbcb966
2008-01-08module*.bbclass: set AR to KERNEL_AR during building of kernel modulesMarcin Juszkiewicz
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3422 311d38ba-8fff-0310-9ca6-ca027cbcb966
2007-09-01module.bbclass: PARALLEL_INSTALL_MODULES is dead codeRichard Purdie
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2639 311d38ba-8fff-0310-9ca6-ca027cbcb966
2007-06-13module.bbclass: make all modules depend on update-modulesMarcin Juszkiewicz
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1925 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-08-27classes: Sync with OERichard Purdie
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@651 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-07-21Rename /openembedded/ -> /meta/Richard Purdie
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966