summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-module-split.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* kernel: drop unnecessary True options from calls to getVarAndre McCurdy2018-01-191-3/+3
| | | | | | | | | | | | | | The older style calls (plus a bashism in kernel.bbclass, fixed separately) were introduced via the recent change to add support for multiple kernel packages: http://git.openembedded.org/openembedded-core/commit/?id=6c8c899849d101fd1b86aad0b8eed05c7c785924 (From OE-Core rev: e660ef68de3b3891a26ed6e10d96dc4efaf03ffc) Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Add support for multiple kernel packagesHaris Okanovic2018-01-021-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some distros may want to provide alternate kernel "flavors" via feeds or within bootable images. For example, readily available builds which provide certain diagnostic features can enable developers and testers to more quickly resolve issues by avoiding lengthy kernel builds. This change allows for building multiple flavors of the kernel and module packages by templatizing kernel package names via a new KERNEL_PACKAGE_NAME variable in kernel.bbclass. It defaults to the old name of "kernel", but can be overridden by certain recipes providing alternate kernel flavors. To maintain compatibility, recipes providing alternate kernel flavors cannot be the "preferred provider" for virtual/kernel. This is because OE puts the preferred provider's build and source at "tmp-glibc/work-shared/$MACHINE/kernel-build-artifacts/" and "tmp-glibc/work-shared/$MACHINE/kernel-source/" instead of "tmp-glibc/work/*/$PN/" like other recipes. Therefore, recipes using the default KERNEL_PACKAGE_NAME="kernel" follows the old semantics -- build in the old location and may be preferred provider -- while recipes using all other KERNEL_PACKAGE_NAME's build from the normal WORKDIR and don't provide "virtual/kernel". Testing: 1. Add `KERNEL_PACKAGE_NAME_pn-linux-yocto-tiny = "tiny-linux"` to local.conf so that linux-yocto-tiny may build alongside the main kernel (linux-yocto). 2. `bitbake linux-yocto linux-yocto-tiny` to build both kernel flavors. 3. Verified image and modules IPKs exist for both: tmp-glibc/deploy/ipk/qemux86/kernel-* for linux-yocto tmp-glibc/deploy/ipk/qemux86/tiny-linux* for linux-yocto-tiny 4. Verified linux-yocto is the "preferred provider", and was built in shared directory: tmp-glibc/work-shared/qemux86/kernel-* 5. Add `CORE_IMAGE_BASE_INSTALL_append_pn-core-image-base = "tiny-linux"` to local.conf to install both kernel flavors in core-image-base. 6. `bitbake core-image-base` to build an image. 7. Verified image contains two bzImage's under /boot/, with "yocto-standard" (linux-yocto recipe) selected to boot via symlink. Discussion threads: http://lists.openembedded.org/pipermail/openembedded-core/2015-December/thread.html#114122 http://lists.openembedded.org/pipermail/openembedded-core/2017-July/thread.html#139130 [YOCTO #11363] (From OE-Core rev: 6c8c899849d101fd1b86aad0b8eed05c7c785924) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Gratian Crisan <gratian.crisan@ni.com> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com> Coauthored-by: Gratian Crisan <gratian.crisan@ni.com> Coauthored-by: Haris Okanovic <haris.okanovic@ni.com> Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Revert "kernel-module-split: rrecommend kernel-image instead of rdepend"Martin Hundebøll2017-09-121-6/+1
| | | | | | | | | | | | | | | | | This reverts commit e0ed52c51464855e9a6a37ea49df7efde7e91076. Commit e0ed52c514 ('kernel-module-split: rrecommend kernel-image instead of rdepend') changed kernel modules to rrecommend kernel-image instead of rdepend on kernel. This broke existing setups, where the kernel is omitted by setting RDEPEND_kernel-base = "". Revert the patch, as the existing way of omitting kernel-image in images works just fine. (From OE-Core rev: c315b1e036b1252f35abda921c49327c950a9570) Signed-off-by: Martin Hundebøll <mnhu@prevas.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: rrecommend kernel-image instead of rdependMartin Hundebøll2017-08-231-1/+6
| | | | | | | | | | | | | | | | Hard depending on the kernel makes it impossible to install kernel modules without getting the kernel image installed too. This is inconvenient in e.g. initramdisks, where the kernel is loaded from outside the initramdisk. Making the kernel modules rrecommend kernel-image-<version> instead of rdepending on it, makes it possible to install kernel modules without the kernel image by setting "kernel-image" in BAD_RECOMMENDATIONS. (From OE-Core rev: 5dd7ddb66a6846d9bb59dc7833e8318992d0e645) Signed-off-by: Martin Hundebøll <mnhu@prevas.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: Fix return value checks from subprocess.call()'sMikko Rapeli2017-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Python function subprocess.call() returns the return value of the executed process. If return values are not checked, errors may go unnoticed and bad things can happen. Change all callers of subprocess.call() which do not check for the return value to use subprocess.check_call() which raises CalledProcessError if the subprocess returns with non-zero value. https://docs.python.org/2/library/subprocess.html#using-the-subprocess-module All users of the function were found with: $ git grep "subprocess\.call" | \ egrep -v 'if.*subprocess\.call|=\ +subprocess\.call|return.*subprocess\.call' Tested similar patch on top of yocto jethro. Only compile tested core-image-minimal on poky master branch. (From OE-Core rev: 578c8205fd14c48c6d30ef2889d86f1b4aee060a) Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: use ${nonarch_base_libdir} for kernel modules installation.Amarnath Valluri2017-03-221-1/+1
| | | | | | | | | | Replace hardcoded '/lib' in kernel modules installation path with ${nonarch_base_libdir}, which is meant exactly for this. (From OE-Core rev: 22f5ba7154fcbe826d0a3283740903312b2aab46) Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: Allow custom suffix for package namesAndreas Oberritter2017-02-071-1/+3
| | | | | | | | | | This makes it possible to restore the behaviour changed by commit 78cde87 "kernel-module-split: Append KERNEL_VERSION string to kernel module name". (From OE-Core rev: 4aabdddf67859cd8518e5cb672fb391c859817e0) Signed-off-by: Andreas Oberritter <obi@opendreambox.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: remove remaining True option to getVar callsMing Liu2017-01-311-2/+2
| | | | | | | | | | | | | | | | This is a complementary fix to commit 7c552996: [ meta: remove True option to getVar calls ] it intended to remove all True option to getVar calls, but there are still some remaining. Search made with the following regex: getVar ?\((.*), True\) (From OE-Core rev: 87d03ffe03d6f01e360bfd51714be96e62506e0a) Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: Add PACKAGE_WRITE_DEPS for postinstRichard Purdie2017-01-201-0/+2
| | | | | | | | The postinstall needs kmod-native and depmodwrapper-cross, mark these dependencies. (From OE-Core rev: 0e4f5eb4f8443ed98d7c8aaf0b999c5618b7cf25) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Revert "kernel: Modify kernel modules installation path."Jason Wessel2017-01-201-1/+1
| | | | | | | | | | | | | This reverts commit 0ccb2efe9837e2915c093341a662dffc1df00866. The OVS fails to function and the kernel modules cannot be found by any of the kernel tools such as depmod because they are installed into the wrong directory in multilib 64bit/32bit bulids. (From OE-Core rev: 85cec1e3df68e932c7b210956ef5f17b85f3616f) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: Append KERNEL_VERSION string to kernel module nameOla Redell2017-01-191-1/+8
| | | | | | | | | | | | | | | | | | | | The KERNEL_VERSION string is added to kernel module package names in order to make the kernel modules for different kernel versions distinct packages instead of different versions of the same package. With this change, when a new kernel is installed together with its kernel modules (e.g. by upgrade of the packages kernel and kernel-modules) using some package manager such as apt-get or rpm, the kernel modules for the older kernel will not be removed. This enables a fall back to the older kernel if the new one fails. Also, for backwards compatibility and to enable kernel version agnostic dependencies to kernel modules, create a virtual package with the old (shorter) kernel module package name using RPROVIDES. (From OE-Core rev: 78cde87bb6e71ec5b603426879267874900d09f3) Signed-off-by: Ola Redell <ola.redell@retotech.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Modify kernel modules installation path.Amarnath Valluri2017-01-161-1/+1
| | | | | | | | | | Use ${base_libdir}/modules inplace of /lib/modules for kernel modules installation path. (From OE-Core rev: 0ccb2efe9837e2915c093341a662dffc1df00866) Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: remove True option to getVar callsJoshua Lock2016-12-161-19/+19
| | | | | | | | | | | | | 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\) (From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split.bbclass: no need for running depmodAndré Draszik2016-09-091-72/+1
| | | | | | | | | | | | With the recent changes, executing depmod is not needed anymore. This simplifies and removes a lot of unnecessary code. (From OE-Core rev: 8296e258b36a6238605e068e13c1982b1d12fe53) Signed-off-by: André Draszik <git@andred.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split.bbclass: generate dependencies across recipesAndré Draszik2016-09-091-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | The information retrieved via depmod is incomplete with regards to kernel modules that are dependencies, in particular where two kernel modules are built from different source trees / recipes, which leads to incomplete dependency information for packages created. So far, our packages created didn't contain dependencies on packages created by other recipes, as we solely use depmod for that, and depmod can only work well after *all* kernel modules have been copied into one place - it doesn't work well in a staged approach. Now that all .ko have correct dependency information at packaging time, we can use that information to properly track dependencies across recipies, and can combine the information from the .modinfo elf section with the information from depmod. (From OE-Core rev: e4af1fa3aee7f1cf00ca27944b10b886f41f2fda) Signed-off-by: André Draszik <git@andred.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split.bbclass: add a prefix for module package name patternRicardo Neri2016-07-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | When splitting kernel modules into individual packages, such packages take their names from the module name. This is OK under most of the circumstances. However, it may lead to package naming collisions if there exists two modules with the same name. Situations like this can occur when building testing modules. For instance, there exists testing versions of the modules for non-volatile memory that are built with different linker options but bear the same module name. If one wants to package such modules, it is be good to be able to name packages differently. This can be done by prefixing the package name with a KERNEL_MODULE_PACKAGE_PREFIX that can be set by the recipes that inherit from module.bbclass. Cc: Megha Dey <megha.dey@intel.com> (From OE-Core rev: 4f941e8c5ee8e95291c3beff0a2798aa13f8dfc8) Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split.bbclass: Avoid bogus recommends for modules ending with -devAndreas Oberritter2015-03-251-0/+3
| | | | | | | | | Example: lirc-dev.ko -> kernel-module-lirc-dev (From OE-Core rev: dc20323cfe6f3f5a880dfeb02e9463ffa3db1ad9) Signed-off-by: Andreas Oberritter <obi@opendreambox.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split.bbclass: fix autoloading from postinst scriptAndreas Oberritter2015-03-251-1/+1
| | | | | | | | | | When using KERNEL_MODULE_AUTOLOAD, autoload was empty, causing "modprobe None" to get appended to the postinst script. (From OE-Core rev: 2e3768075878b8fc0f7642cae89ab7b9d03fe52c) Signed-off-by: Andreas Oberritter <obi@opendreambox.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel/image/depmodwrapper: Fixups for depmodRichard Purdie2015-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | With the rpm package backend enabled, running: bitbake <image> bitbake virtual/kernel -c clean bitbake <image> -c rootfs -f results in an image with incorrect kernel module dependency information. The problem is that the System.map and kernel-abiversion files are needed for depmod and after the recent kernel changes, these are no longer in sstate. Its reasonable to require the kernel to unpack/build if you're about to build a module against it. It is not reasonable to require this just to build a rootfs. Therefore stash the needed files specifically for depmod. Also fix some STAGING_KERNEL_DIR references which were incorrect, found whilst sorting through his change. (From OE-Core rev: b851504dcf5e147c9efb1c7b6a4d22c1a1a87cd7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: move source and build output to work-sharedBruce Ashfield2015-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a) 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>
* kernel-module-split.bbclass: Allow autoloading multiple modules or modules ↵Martin Jansa2014-07-231-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | where basename != module name * new KERNEL_MODULE_AUTOLOAD syntax doesn't support modules where basename and module name don't match (usually - and _), e.g.: module_autoload_bq27x00_battery = "bq27x00-battery" * sometimes it's useful to load modules in particular order and module_autoload allowed to just list multiple modules, e.g.: module_autoload_snd-soc-neo1973-wm8753 = "snd-soc-s3c24xx snd_soc_s3c24xx_i2s snd-soc-dfbmcs320 snd-soc-wm8753 snd-soc-neo1973-wm8753" or module_autoload_g_ether = "s3c2410_udc g_ether" restore this possibility which is useful for incorrect dependencies between modules (From OE-Core rev: e9cd8ba3dda624615b68c601eac04427d9483f14) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: Fix KERNEL_MODULE_AUTOLOAD handlingRichard Purdie2014-06-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Addresses the problem: The stack trace of python calls that resulted in this exception/failure was: File: 'split_kernel_module_packages', lineno: 164, function: <module> 0160: if len(os.listdir(dir)) == 0: 0161: os.rmdir(dir) 0162: 0163: *** 0164:split_kernel_module_packages(d) 0165: File: 'split_kernel_module_packages', lineno: 150, function: split_kernel_module_packages 0146: 0147: postinst = d.getVar('pkg_postinst_modules', True) 0148: postrm = d.getVar('pkg_postrm_modules', True) 0149: *** 0150: modules = do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True))) 0151: if modules: 0152: metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True) 0153: d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules)) 0154: File: 'package.bbclass', lineno: 148, function: do_split_packages 0144: d.setVar('pkg_postrm_' + pkg, postrm) 0145: else: 0146: d.setVar('FILES_' + pkg, oldfiles + " " + newfile) 0147: if callable(hook): *** 0148: hook(f, pkg, file_regex, output_pattern, m.group(1)) 0149: 0150: d.setVar('PACKAGES', ' '.join(packages)) 0151: return split_packages 0152: File: 'split_kernel_module_packages', lineno: 109, function: frob_metadata File "split_kernel_module_packages", line 109, in frob_metadata Exception: AttributeError: 'NoneType' object has no attribute 'split' ERROR: Function failed: split_kernel_module_packages [YOCTO #6461] [a revised version of a patch from Nitin Kamble] (From OE-Core rev: f30d12b4fbfe7d6b581598efa9ceca69dcfb4294) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: Add support for KERNEL_MODULE_AUTOLOAD and ↵Richard Purdie2014-06-161-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | KERNEL_MODULE_PROBECONF The current module_autoload_* and module_conf_* variables are error both ugly and error prone. They aren't registered in the task checksums so changes to them aren't reflected in the build. This turns out to be near impossible to fix with the current variable format in any sensible way :(. This patch replace module_autoload with the list of variables in KERNEL_MODULE_AUTOLOAD which is a much simpler and usable API. An error is printed if an old style variable is encountered. It should be simple to convert to this. module_conf_* are harder to deal with since there is data associated with it, it isn't simply a flag. We need a list of variables that are set in order to be able to correctly handle the task checksum so we add KERNEL_MODULE_PROBECONF for this purpose and error if the user hasn't added a module to it when they should have. [YOCTO #5786] (From OE-Core rev: 6f8b5be646be0f3e15e215907547f11d2a23d81b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: Remove extraneous call to depmod from module postinstPhil Blundell2014-01-101-1/+3
| | | | | | | | | | | During rootfs construction, image.bbclass will call depmod after all the modules are installed. There's no need to run it from the postinst when operating in offline root mode. (From OE-Core rev: e8db81e4655ab7535db04aa3c8d7f9868ced6039) Signed-off-by: Phil Blundell <pb@pbcl.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* image/kernel-module-split/eglibc-ld.inc: Remove has_key() usageRichard Purdie2013-05-091-2/+2
| | | | | | | | | The has_key() attribute has been removed in python 3 since there is better syntax available. Use the improved syntax. (From OE-Core rev: 3dff13793e875ff58cc38c4a960caca9b6969843) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel-module-split: append space to RDEPENDSMartin Jansa2013-03-071-1/+1
| | | | | | | | | | | * it was generating invalid RDEPENDS when KERNEL_MODULES_META_PACKAGE had RDEPENDS set already without trailing space (From OE-Core rev: 5ff26f61b6860e56c255b2b6a2b0215be75b1db9) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: extract functions for kernel modules to separate bbclassMartin Jansa2013-03-051-0/+185
* 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-* (From OE-Core rev: 51928b6b5ca0a46a9dcd754483a19af58b95fa18) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>