summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* classes: Update classes to match new bitbake class scope functionalityRichard Purdie2022-08-121-821/+0
| | | | | | | | | Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes: Add SPDX license identifiersRichard Purdie2022-08-121-0/+2
| | | | | | | | | | | | 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. (From OE-Core rev: 081a391fe09a21265881e39a2a496e4e10b4f80b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes: Add copyright statements to files without oneRichard Purdie2022-08-121-0/+4
| | | | | | | | | Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. (From OE-Core rev: 880c1ea3edc8edef974e65b2d424fc36809ea034) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: pass LD also in savedefconfigMartin Jansa2022-07-251-1/+1
| | | | | | | | | | | | | | * similar to: https://git.openembedded.org/openembedded-core/commit/?id=66c1f4b0abd3483759f9e4141a80f982eaf8ccfd https://git.openembedded.org/openembedded-core/commit/?id=36fe2efc91fec5a52374a2dc4814a69076a2d28e but for savedefconfig task * otherwise with ld-is-gold it will fail with: gold linker is not supported as it is not capable of linking the kernel proper. (From OE-Core rev: f0c9e1bf35289afa63f040bbc13ca1755e4db0f9) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Do not overwrite recipe's custom postinstRaphael Teller2022-05-231-1/+1
| | | | | | | | | | | | | Allow recipe to set a custom postinst for kernel image. Use prependVar in order to allow custom postinst to be ran after default postinst, potentially modifying the installed file/symlink. (From OE-Core rev: 579906b9f4ea32c8d4e0e11a87ee6c9e27cdf0dc) Signed-off-by: Raphael Teller <raphael.teller@se.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: add missing path to search for debug filesAndrej Valek2022-05-151-0/+1
| | | | | | | | | | | | Since explicit debug package creation via ${KERNEL_PACKAGE_NAME}-dbg has been added to kernel, it has to cover all PACKAGE_DEBUG_SPLIT_STYLE options. For ex. when the variable "debug-file-directory" package search path has to be set explicitly, otherwise it will not find any files. (From OE-Core rev: 9c39da147683dcaaa244b3ddc4531c4408ad5c9e) Signed-off-by: Andrej Valek <andrej.valek@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Delete unused KERNEL_LOCALVERSION variableAlex Kiernan2022-04-141-2/+0
| | | | | | | | | | | | | | | | | | This has been unused since: commit fb61dc1430f81ae2ee59766ffab8404fd79ff1b1 Author: Richard Purdie <richard@openedhand.com> Date: Mon Jan 8 21:05:18 2007 +0000 kernel.bbclass: Drop KERNEL_RELEASE variable git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1123 311d38ba-8fff-0310-9ca6-ca027cbcb966 (From OE-Core rev: 320da1c2b9add9fecd74e7f33ddc5418b326c786) Signed-off-by: Alex Kiernan <alexk@zuma.ai> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Fix the do_strip() malfunctionKevin Hao2022-04-121-1/+1
| | | | | | | | | | | | The BB variable can't be referenced directly in a python function, this misusage of the variable reference causes strip function to be always skipped. Fixed: b9c3db4953e4 ("kernel.bbclass: Use KERNEL_IMAGEDEST instead of hardcoded boot path") (From OE-Core rev: c405cb4f421a8c964fa59123ee41879ebd5f829c) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Use KERNEL_IMAGEDEST instead of hardcoded boot pathAlessio Igor Bogani2022-04-031-8/+7
| | | | | | | | | | | The behaviour doesn't change because KERNEL_IMAGEDEST is defined as 'boot' in the same file (line 215). (From OE-Core rev: b9c3db4953e4e7b423ba9ec5b618fd990c378bc1) Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: avoid config changes based on the availability of paholeMichael Olbrich2022-03-261-2/+2
| | | | | | | | | | | | | | | | | | | CONFIG_PAHOLE_HAS_SPLIT_BTF shows up in the config only when pahole is installed on the host system. As a result, the config changes depending on whether pahole is installed or not. Set PAHOLE=false to ensure that it is never found. If this is actually needed in the future, then we can add an option for it and create a host package for pahole. (From OE-Core rev: 43b0eca2f3fc41a0d2ba7c7679687a3e0eb54b45) Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> [afa: ported from PTXdist 0c0cec2288 to OE-core] Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: make kernel-base recommend kernel-image, not dependRoss Burton2022-02-211-1/+1
| | | | | | | | | | | | | | | As kernel modules depend on the base kernel package, and the base kernel recipe depends on the kernel image, it's impossible to build file system images which contain kernel modules but not the kernel itself, such as an initramfs. Change the RDEPENDS to RRECOMMENDS so that the disk images can set PACKAGE_EXCLUDE = "kernel-image-*" to remove the kernel. (From OE-Core rev: 1c90b27d2c65cfb4f9debf0272820b6a95942f76) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Allow initramfs to be built from a separate multiconfigAlejandro Hernandez Samaniego2022-01-261-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There may be a case where we want to build an initramfs image that doesnt inherit the same DISTRO_FEATURES (or others) from the main image being built. For example we may want our initramfs not to inherit a certain conf or feature, say we want to use musl for a smaller footprint, but if we are using TCLIBC=glibc for our DISTRO (and inherently our main image), the initramfs image would inherit that conf and be forced to use glibc, growing in size as a side effect, currently avoiding this is not supported. Allow the kernel class to create a multiconfig dependency (mcdepends) vs depends for do_bundle_initramfs and define our INITRAMFS_IMAGE from a separate multiconfig via two new variables: INITRAMFS_MULTICONFIG and INITRAMFS_DEPLOY_DIR_IMAGE which define the multiconfig where the initramfs image should be coming from and its deploy directory respectively, these two keep a default definition which preserves current behavior (do_bundle_initramfs uses depends). Example usage: - Create and use multiconfig initramfscfg.conf and set TCLIBC=musl there, along with its TMPDIR. - Add the following to our DISTRO.conf: INITRAMFS_MULTICONFIG = "initramfscfg" and set INITRAMFS_DEPLOY_DIR_IMAGE to the DEPLOY_DIR_IMAGE of the initramfscfg multiconfig (hence our main kernel will be able to grab it from there and bundle it). This will result in our musl based initramfs bundled in our main kernel and our main image to be glibc based. (From OE-Core rev: 2d317b2685211f1b0d102705a63c0000df96f45f) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alhe@linux.microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: use common strip()Saul Wold2022-01-131-25/+19
| | | | | | | | | | | | | | | Re-use the runstrip() code from oe.packaging, for the kernel stripping process. Since runstrip() is python the kernel do_strip() need to be converted to Python also. The stripped kernel image will be used for deployment in do_deploy(). This will allow the package.bbclass to split an unstripped kernel binary for the debug information and extended packagedata. The extended package data is used by create-spdx. (From OE-Core rev: e8d9caede5f08154ca615fdaba676b7a4ae05b01) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: add -dbg packageSaul Wold2021-12-221-1/+1
| | | | | | | | | | Adding the dbg package allows the package bbclass to parse the debug information which can then be used by the create_spdx bbclass (From OE-Core rev: b35b68e4ec4a82ada20ab861d29f96cdcb21dec2) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/kernel*: add variables to allow changing artifact extensionPaul Eggleton2021-12-221-5/+5
| | | | | | | | | | | | Allow .bin suffix to be removed (or changed) in the various artifact filenames. Removing this extension is useful when trying to remove symlinks and present only unversioned image files (especially for the FIT image). (From OE-Core rev: cbecc3cf06eb7359fedf3c6af281cc72178cad18) Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/kernel*: allow disabling symlink creationPaul Eggleton2021-12-221-4/+12
| | | | | | | | | | | | | Allow setting any of the *_LINK_NAME variables to empty string in order to disable creating symlinks for kernel artifacts, as you can already for filesystem images with IMAGE_LINK_NAME. Additionally, for the image type named symlinks, add a KERNEL_IMAGETYPE_SYMLINK boolean variable which you can set to 0 to disable those symlinks as well. (From OE-Core rev: d7341f1f22c32ff6cc95d7127f26f87d7fc9c6bd) Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: improve transformation from KERNEL_IMAGETYPE_FOR_MAKEMike Crowe2021-12-091-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 526bdd88ccd758204452579333ba188e29270bde the imageType loop in kernel_do_deploy was changed to use KERNEL_IMAGETYPE_FOR_MAKE rather than KERNEL_IMAGETYPES. This broke the special handling for fitImage immediately below because KERNEL_IMAGETYPE_FOR_MAKE never contains fitImage. It has always been my understanding that KERNEL_IMAGETYPE_FOR_MAKE controlled what was passed to make, but KERNEL_IMAGETYPE controlled what was installed/deployed. When the two are different then it's the responsibility of whoever set KERNEL_IMAGETYPE_FOR_MAKE to ensure that whatever comes out of the kernel build system has been transformed in to the requested form by the time of installation. This is what happens for kernel.bbclass's own support for vmlinux.gz. I think this means that for KERNEL_IMAGETYPE vmlinux.gz, kernel.bbclass is responsible for generating vmlinux.gz.initramfs[1] so that kernel_do_deploy can deploy it. This means that the change in 526bdd88ccd758204452579333ba188e29270bde can be reverted, fixing KERNEL_IMAGETYPE = "fitImage". In addition, it ought to be possible for recipes and other classes that use kernel.bbclass to hook into this mechanism by setting KERNEL_IMAGETYPE_FOR_MAKE and performing their own transformations. do_bundle_initramfs calls kernel_do_compile and we don't want it to transform vmlinux to vmlinux.gz at that point, since it will fight against the careful renaming and preserving that do_bundle_initramfs does. Let's separate the transformation out of kernel_do_compile to a new do_transform_kernel task that can be run at the right time. This means that it's also logical to perform the equivalent translation for the kernel with the initramfs in a separate do_transform_bundled_initramfs task too. This leaves two clear customisation points for recipes and other classes to hook into the process and perform their transformations: do_transform_kernel and do_transform_bundled_initramfs. (I care about this because our recipes that use kernel.bbclass also set KERNEL_IMAGETYPE_FOR_MAKE and transform vmlinux into a form suitable for our bootloader after do_compile and do_bundle_initramfs into the format matching KERNEL_IMAGETYPE. I'm unable to successfully bundle an initramfs after 526bdd88ccd758204452579333ba188e29270bde, but I didn't want to just revert that change to reintroduce the bug that it was fixing.) I can't say that I'm entirely happy with this change, but I'm unsure what to do to improve it. I find the way that both the bare kernel and the one with the initramfs both get deployed to be confusing, and a waste of build time. I would like to not actually generate a publishable kernel image at all during do_compile when an initramfs is in use, but I suspect that this would affect valid use cases that I'm not aware of. (From OE-Core rev: 10a4a132e87e835726bf5da81a60f6f509b90765) Signed-off-by: Mike Crowe <mac@mcrowe.com> [1] It could be argued that this should be vmlinux.initramfs.gz, but that would require another special case in kernel_do_deploy and the filename is only visible within this class and the recipes that use it anyway. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: export native PKGCONFIG variablesBruce Ashfield2021-11-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | In a similar manner to cml1.bbclass, we export the pkg-config variables to allow a direct call to pkg-config access to the native sysroot versus the target sysroot. The kernel doesn't use pkg-config for target configuration, and has many explicit calls to pkg-config, without the possibility of easy override to pkg-config-native. The calls to pkg-config could be made cross friendly via replacement with make variables, but until that effort is undertaken upstream, we need a bridge approach. In particular, this is required for dtschema validation, which is a requirement in kernel 5.16+ (From OE-Core rev: 9172d61c57e23682c3d2c25701cbd53c84d01a27) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: provide virtual/kernel for all kernelsBruce Ashfield2021-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we allow the kernel package name to be varied, we should allow those packages to provide virtua/kernel, which allows them to be used as primary kernels. This change drops the use of regex, since any regex would enforce naming (and limit what can be a provider) and add complexity./ There are currently no recipes that I found, that inherit kernel that are not kernel recipes (kernel-base, etc, provide other facilities), so making this provides simpler shouldn't cause problems. Multiple kernel providers can be dealt with in the same way as any multiple provider. [YOCTO: #13172] (From OE-Core rev: 365dc1471a1b67c45de58aadf29844a9ff83d30f) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> squash with provider Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Rework kernel make flag to variable mappingsRichard Purdie2021-10-161-2/+2
| | | | | | | | | | | | | | | In 2017 we added changes to pass the BUILD_CFLAGS into the kernel via BUILD_CC. This isn't really correct and the upstream kernel now has places to pass build cflags, ldflags and more. Update our kernel make flags to correctly use the kernel's variables. This addresses concerns raised by kernel developers. If this breaks some usecase please report it so we can work out how to fix it properly. (From OE-Core rev: 7fd06a57a1d91d8534721923f6e3951ec8220cec) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Add KERNEL_DEBUG_TIMESTAMPS variableRichard Purdie2021-10-161-2/+4
| | | | | | | | | | | | | Change the "binary reproducibility" configuration within the kernel to work off a separate variable, defaulting to reproducible builds. This allows kernel developers wanting timestamps in their images to enable it easily and clearly without changing the rest of the reproduciblity code which they likely don't need to change anyway. (From OE-Core rev: 0725ca18af7a2835aeb9616592a45ead2ee87987) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: remove unnecessary dead codeRasmus Villemoes2021-09-281-13/+2
| | | | | | | | | | | | | | | | | | | | | | | The grep pattern seems to have been wrong ever since we stopped adding the -ffile-prefix-map via a patch in commit 20aea61385e, because the actual upstream gcc produces -ffile-prefix-map=<old>=<new> and not -ffile-prefix-map=<old=new> Besides, these *-prefix-map options are already used when building the kernel due to the setting of KERNEL_CC, and the kernel build system itself also probes for and uses at least -fmacro-prefix-map (hence taking care of __FILE__ etc., but not necessarily things that go in .debug_info sections). (From OE-Core rev: 5d56de8cd653d2a3a7f4c104d50c14e22d412f66) Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* base/kernel: Support zstd-compressed squashfs and cpio initramfsZoltán Böszörményi2021-09-011-2/+8
| | | | | | | | | | Enable zstd PACKAGECONFIG knob for squashfs-tools and add support for zstd compressed initramfs and squashfs. (From OE-Core rev: fa146049eec5f9730781830270cc9dc55a2146f7) Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Use unexpanded EXTENDPKGVRichard Purdie2021-09-011-4/+3
| | | | | | | | | | EXTENDPKGV can contain AUTOINC so use an expanded form in the variables allowing for later expansion during packaging to avoid race issues over the variable and the build failures that can result. (From OE-Core rev: 1f93d2426d22c74893e8daec9bb939133c5737c2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Use full versions for inter-package dependenciesZoltán Böszörményi2021-08-271-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | If the kernel configuration enables module signing but no key is provided, then the kernel generates one during the kernel build. The current runtime-dependency references (with only package names without full versions) allow mixed package installations from different rebuilds of the same kernel version. This creates an issue because then the modules either don't work or taint the kernel. Tighten RDEPENDS with the full package version, i.e. use (= ${EXTENDPKGV}) markers for inter-package dependencies. The kernel will pull in the kernel-modules subpackage of the same exact version automatically if KERNEL_SPLIT_MODULES="0" is set. Otherwise the situation is the same as with the old default with one subpackage per kernel module where they have to be upgraded manually. (From OE-Core rev: 56428d15803733e14d6f1faf5f77eb933ef966f3) Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Allow opt-out of split kernel modulesZoltán Böszörményi2021-08-271-0/+7
| | | | | | | | | | | | | | | | | | For some use cases, a monolithic kernel-modules package containing all modules built from the kernel sources may be preferred. For one, download time is shorter and installation time is faster. Set KERNEL_SPLIT_MODULES="0" for this in. The default is one subpackage per module. Also, adapt kernel.bbclass to KERNEL_SPLIT_MODULES != "1" case Extra RDEPENDS and other inter-package references are needed in this case. (From OE-Core rev: 4b13409d82e9d576e32b978f7a42a143127ab894) Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Convert to new override syntaxRichard Purdie2021-08-021-30/+30
| | | | | | | | | | | | 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 "_". (From OE-Core rev: 42344347be29f0997cc2f7636d9603b1fe1875ae) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Fix interaction when packaging disabledRichard Purdie2021-06-271-0/+2
| | | | | | | | | | When packaging is disabled using the nopackages class, ensure we don't add to PACKAGES. This fixes builds where we have an unpackaged kernel alongside a packaged kernel. (From OE-Core rev: 2522daf22e2c27dd9c7926feda0345978217c6c3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: fix do_sizecheck() comparisonAndrea Adami2021-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | The routine do_sizecheck() was historically needed by legacy devices with limited flash memory. The lowest extreme is probably with Zaurus collie having exactly 1024*1024 = 1048576 bytes for the kernel partition. In the years the KERNEL_IMAGE_MAXSIZE has been converted to kilobytes thus rounded so we have now KERNEL_IMAGE_MAXSIZE_collie = "1024". The effect is that now the check fails because we hit curiously this | WARNING: This kernel zImage (size=1024(K) > 1024(K)) is too big for... even though zImage is 1047288 bytes (kernel + kexecboot-klibc-initramfs). Fix this case using test -gt (greater) instead of -ge (greater or equal). (From OE-Core rev: 254ca956d63b4ce6aa294213b60bb943f9f3a9e6) Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: fix deployment for initramfs imagesAwais Belal2021-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The do_bundle_initramfs() only processes kernel image types that are found in KERNEL_IMAGETYPE_FOR_MAKE whereas the build system can generate other types that are not directly supported by the kernel build system. In which case when we come to the deploy phase not all the images mentioned in KERNEL_IMAGETYPES would have a respective initramfs bundled image. An example is using vmlinux.gz in KERNEL_IMAGETYPES and enabling initramfs and then we see install: cannot stat 'arch/arm64/boot/vmlinux.gz.initramfs': No such file or directory So we align the deploy phase with bundle initramfs phase and pick up relevant initramfs bundled images using KERNEL_IMAGETYPE_FOR_MAKE instead of KERNEL_IMAGETYPES. (From OE-Core rev: 526bdd88ccd758204452579333ba188e29270bde) Signed-off-by: Awais Belal <awais_belal@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: skip installing fitImage when using Initramfs bundlesAbdellatif El Khlifi2021-01-201-1/+15
| | | | | | | | | | | | | | | | | | | | When including an initramfs bundle inside a FIT image, the fitImage is created after the install task by do_assemble_fitimage_initramfs. This happens after the generation of the initramfs bundle (done by do_bundle_initramfs). So, at the level of the install task we should not try to install the fitImage. The fitImage is still not generated yet. After the generation of the fitImage, the deploy task copies the fitImage from the build directory to the deploy folder. Change-Id: I3eaa6bba1412f388f710fa0f389f66631c1c4826 (From OE-Core rev: 1b67fd9ac74935fa41e960478c54e45422339138) Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: set COMPATIBLE_HOST to *-linuxRoss Burton2020-12-241-0/+2
| | | | | | | | | | | The target system triple contains whether the target is Linux or not, so use it to avoid situations where you can attempt to build a kernel for systems which don't support Linux. (From OE-Core rev: b1eeeab21a81990321468ddbdd1745ea24d1828d) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: relocate copy of module.lds to module compilation taskBruce Ashfield2020-11-181-1/+4
| | | | | | | | | | | | | | | | | | | | There were two copies of this patch floating around, and the merged variant has the copy in the wrong place. module.lds is only created during modules_prepare, and that target is not invoked during our main build of the kernel. We aren't about to change the kernel build (there's no need), so we move the copy into the compile_kernelmodules task. After that runs, we have module.lds availble to copy. This has been tested against clean kernel + out of tree module builds, and the dependencies are correct that the file is copied before the out of tree module build starts. (From OE-Core rev: 7d94f9209ebaaf59ea001239a889dd7f928a0e7c) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: Set proper LD in KERNEL_KCONFIG_COMMANDWonmin Jung2020-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With 'ld-is-gold' and linux kernel 5.4 or later, menuconfig task for kernel recipes will fail with: $ bitbake -c menuconfig virtual/kernel ... scripts/kconfig/mconf Kconfig scripts/Kconfig.include:43: gold linker 'x86_64-poky-linux-ld' not supported /OE/build/tmp/work-shared/qemux86-64/kernel-source/scripts/kconfig/Makefile:29: recipe for target 'menuconfig' failed make[2]: *** [menuconfig] Error 1 /OE/build/tmp/work-shared/qemux86-64/kernel-source/Makefile:606: recipe for target 'menuconfig' failed make[1]: *** [menuconfig] Error 2 /OE/build/tmp/work-shared/qemux86-64/kernel-source/Makefile:185: recipe for target '__sub-make' failed make: *** [__sub-make] Error 2 Command failed. This is because that the KERNEL_LD variable already set in kernel-arch.bbclass isn't used by do_menuconfig function of cml1.bbclass. To fix this issue specify LD variable while calling the kernel menuconfig command through KERNEL_KCONFIG_COMMAND. (From OE-Core rev: 1faf66ce0b1f8f5165277161e07e25e672370c3f) Signed-off-by: Wonmin Jung <wonmin82@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel: provide module.lds for out of tree builds in v5.10+Bruce Ashfield2020-11-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream commit 596b0474d3d [kbuild: preprocess module linker script], adds a dependency on module.lds for external module building. Since module.lds is generated as part of 'modules_prepare', we must make it available with the other kernel artifacts in the kernel shared workdir, otherwise out of tree builds fail. This fixes errors like: | make[4]: *** No rule to make target 'scripts/module.lds', needed by 'build/tmp/work/qemuarm64-poky-linux/cryptodev-module/1.11-r0/git/cryptodev.ko'. Stop. | make[4]: *** Waiting for unfinished jobs.... We also ensure that kernel-devsrc has a copy to support on target module builds that are often prepared with 'make scripts prepare'. Those targets won't regenerate it, so the build fails. If 'make modules_prepare' is used, the file will be regenerated and overwrite our copy (as expected). (From OE-Core rev: 0fc66a0b64953aae38d0124b57615fffaec8de52) Signed-off-by: Pan, Kris <kris.pan@intel.com> Signed-off-by: Lili Li <lili.li@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: ensure symlink_kernsrc task gets run even with externalsrcRasmus Villemoes2020-09-281-1/+4
| | | | | | | | | | | | | | | | | | | | | Commit c5dfc2586b41 (kernel.bbclass: run do_symlink_kernsrc before do_patch) fixed a race between do_symlink_kernsrc and do_populate_lic. However, I missed the fact that when externalsrc.bbclass is in use, the do_patch task doesn't exist, meaning that do_symlink_kernsrc now doesn't get run at all, breaking the build. We need this task to run regardless of whether do_patch exists or not, so reinstate the configure->symlink_kernsrc dependency explicitly. Fixes: c5dfc2586b41 (kernel.bbclass: run do_symlink_kernsrc before do_patch) Reported-by: Chanho Park <parkch98@gmail.com> (From OE-Core rev: a2b50b74d609ce079ab36b82d4c7c3539fb56485) Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: use camelCase notation for bash variables in do_deployMartin Jansa2020-09-171-7/+7
| | | | | | | | | | | * to match other variables there like deployDir imageType [YOCTO #12937] (From OE-Core rev: 13c5d1b686255d385d200cbd06b7000080809fc7) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: eliminate (initramfs_)symlink_name variablesMartin Jansa2020-09-171-4/+2
| | | | | | | | | | | | * they are used only once, we can use the value directly * notice that .bin extension isn't part of the variable values [YOCTO #12937] (From OE-Core rev: 22874b43de45e86418f683eb9d4394d7a8a08033) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: use bash variables like imageType, base_name without {}Martin Jansa2020-09-171-10/+10
| | | | | | | | | | | | * just to make sure it looks like bash variable not bitbake variable in run.do_* scripts [YOCTO #12937] (From OE-Core rev: 9a16dc2ac3d5e8ea95a575c377d3ad1602c1db12) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Move away from calling package_get_auto_prMark Hatle2020-08-281-1/+4
| | | | | | | | | | | | | | | | | | | ...instead we call read_subpackage_metadata. Calling package_get_auto_pr *should* result in the same PKGV AUTOINC replacement. However, it will also end up changing PKGR differently then do_package as the BB_TASKHASH used will be for the wrong task. Generally this won't cause any real-world issue, but it could cause problems. Moving to read_subpackage_metadata ensures that the values used in do_package will be read in and used for kernel deployment. (From OE-Core rev: 86142dad13935a0d9af4a4177e05ff5c39003db7) Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Remove do_install[prefunc] no longer neededMark Hatle2020-08-261-1/+0
| | | | | | | | | | Prior work has refactored the do_install task multiple times, and any references to PKGV and PKGR (even indirect ones) have been removed. (From OE-Core rev: 36fe4db8ae827a93abe9fce6740459d215411965) Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: run do_symlink_kernsrc before do_patchRasmus Villemoes2020-08-261-1/+1
| | | | | | | | | | | | | | | | | | | There's a race between do_symlink_kernsrc and do_populate_lic, since the latter is ordered "after do_patch"; so the two may run in parallel. In some cases, that actually causes do_populate_lic to fail if it happens to look for a license file somewhere under ${S} in the short window after shutil.move and before the symlink has been created. Fix that by simply ordering symlink_kernsrc before do_patch. Any task that pokes around in ${S} looking for files should be ordered after do_patch, so this should also fix similar latent races with other ad hoc tasks. (From OE-Core rev: c5dfc2586b4135cc86e91bb04fed837daf505676) Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Configuration for environment with HOSTCXXZhang Qiang2020-08-131-0/+2
| | | | | | | | | | | | | | | | | | | When compiling xilinx-zynq board linux-kernel-dev(v5.8) if "GCC_PLUGINS=y", The following error will appear: "HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o fatal error: gmp.h: No such file or directory" the GCC_PLUGINS depend on return result of gcc-plugin.sh execution however in gcc-plugin.sh use HOSTCC to detect the feature of GNU extension of gcc, this will result that HOSTCC can compile the file successfully, but HOSTCXX is used in the actual compilation process. (From OE-Core rev: 740d87766cb87f75c477666d97cb0480c10217f4) Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: make dependency on lzop-native conditionalTimon Ulrich2020-07-081-1/+2
| | | | | | | | | a native lzop is only needed when an lzo compressed initramfs is actually present (From OE-Core rev: 1217ddf070261c5fe523729b2a833bd38f1e4ccd) Signed-off-by: Timon Ulrich <t.ulrich@anapur.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: add gzip-native to do_deploy dependenciesMatt Madison2020-07-081-1/+1
| | | | | | | | | | | | | | | When a modules tarball is created during kernel_do_deploy, the tarball is compressed using gzip, but gzip-native is not a dependency so the build host's gzip is being used for this. Using gzip-native will, by default, use pigz instead of single-threaded gzip, making this task less of a bottleneck for builds with a large modules package. (From OE-Core rev: 1243aad78601e9a5c0a3471c8a105c429536599d) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/kernel: Use a copy of image for kernel*.rpm if fs doesn't support ↵Yanfei Xu2020-07-051-3/+19
| | | | | | | | | | | | | | | symlinks Some filesystems don't support symlink, then you will get failure when you install or update the kernel rpm package. Now we use a copy of image for these filesystems instead of symlink. Suggested-by: Bruce Ashfield <bruce.ashfield@gmail.com> Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org> (From OE-Core rev: bb946b8cdbd01408bfa0ba8e53f9e09931dfb29d) Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: add lz4 dependency and fix the call to lz4Timon Ulrich2020-07-051-1/+2
| | | | | | | | | | | | If the initramfs image is type lz4, then a native lz4 is needed. Additionally an output filename needs to be specified when calling lz4, otherwise STDOUT will be used implicitly. (From OE-Core rev: c83a7aec59defbbc049d44ba34a7a409ada4fa19) Signed-off-by: Timon Ulrich <t.ulrich@anapur.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* deploy.bbclass: Clean DEPLOYDIR before do_deployDaniel Klauer2020-06-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | do_deploy should clean up ${DEPLOYDIR} before running, just like do_install cleans up ${D} before running. This reduces the risk of DEPLOYDIR being accidentally contaminated by files from previous runs, possibly even with different config, in case of incremental builds. It is convenient to have this in deploy.bbclass, so it doesn't have to be duplicated in every recipe, considering for example meta-freescale, which has 23 affected recipes. All recipes using deploy.bbclass (grep -r 'inherit .*deploy') in poky, meta-openembedded and meta-freescale look like they either benefit from this or are at least not affected negatively by it. The only exception I've noticed was uboot-sign.bbclass, which was however fixed by the previous patch. (From OE-Core rev: 7083a7d56f4d90c81d2e6652ee291d20fd908bbe) Signed-off-by: Daniel Klauer <daniel.klauer@gin.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* kernel.bbclass: Fix Module.symvers supportLili Li2020-06-281-1/+1
| | | | | | | | | | | | | | | | | | Starting from v5.8-rc1 commit 269a535ca931 (modpost: generate vmlinux.symvers and reuse it for the second modpost"), kernel will generate new vmlinux.symvers instead of dumping all the vmlinux symbols into Module.symvers in the first pass. Error log: 'run.do_shared_workdir.16614' failed with exit code 1: DEBUG: cp: cannot stat 'Module.symvers': No such file or directory This change will check the file Module.symvers existence before copying it. (From OE-Core rev: cd2d62a08a1dfcd890a03ee55132b6d6c65f5ab7) Signed-off-by: Lili Li <lili.li@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* linux-modules.tgz: fix file permissions to rootLi Wang2020-05-221-0/+1
| | | | | | | | | | the files of linux-modules should be same permissions with rootfs.tar.bz2, because it is a part of rootfs when used to install. (From OE-Core rev: 71e141906069c6f754199512741f6e3d5b72fee7) Signed-off-by: Li Wang <li.wang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>