Commit Graph

260 Commits

Author SHA1 Message Date
Nicolas Dechesne 05f7969366 kernel.bbclass: fix KERNEL_IMAGETYPE(S) for Image.gz
KERNEL_IMAGETYPES lists all the kernel images that we want to build. in
cb17b6c2a7 (kernel.bbclass: support kernel image type of vmlinux.gz), some logic
was added to support vmlinux.gz which is not a target built by kernel
makefiles (only vmlinux). It is clear that the goal of this logic is only to
support vmlinux.gz and not others compressed format (such as Image.gz) which are
valid target for kernel makefiles.

For Image.gz we should rely on the kernel makefiles and not do the compression
in kernel class.

This patch updates the logic used to filter out non supported kernel target from
KERNEL_IMAGETYPES, and make vmlinux.gz a 'special case', instead of *.gz. If
more special cases are needed in the future, we could add them in a similar way.

This patch should be a no-op for anyone using vmlinux or vmlinux.gz, and on top
of that it is fixing the build for Image.gz which was not working until now.

(From OE-Core rev: d3a89450ae918f467a99ac1c33502fc9a5eb4162)

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit cfc0c897656fe67e81a6a5dcd936dff785529f41)
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 11:57:28 +01:00
Mikko Rapeli 279e22c16b kernel.bbclass: set CVE_PRODUCT to linux_kernel if not set by recipe
It is used by NVD database CVE's like:

https://nvd.nist.gov/vuln/detail/CVE-2017-7273

Setting this in kernel.bbclass fixes CVE reporting for all users of
the class.

(From OE-Core rev: 9b27be77980fdd51423576712dfd6f4a031c3372)

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
(cherry picked from commit 2e3d325440a50265c73f7d2e782530a02458bc33)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-29 11:57:28 +01:00
Joshua Lock 607bd9ec39 kernel: predefine KBUILD_BUILD_USER and KBUILD_BUILD_HOST
By exporting KBUILD_BUILD_USER with a pre-defined value we improve the
reproducibility of the kernel and remove the requirement for whoami in the
HOSTTOOLS.
KBUILD_BUILD_HOST also helps improve the reproducibility of the kernel.

For more kernel reproducibility options see:
https://lwn.net/Articles/437864/

(From OE-Core rev: 357801a491efc067c6d4bd9a2bfa6fff460357aa)

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>
2017-06-11 23:00:58 +01:00
Ming Liu 5e3a636b20 kernel.bbclass: move in addtask kernel_link_images statement from linux-yocto.inc
Add kernel_link_images task in kernel.bbclass instead of adding it in
linux-yocto.inc, or else the recipes inheriting kernel.bbclass might
run into implicit dependency issues.

(From OE-Core rev: 3211d43d80f69d9c200a0e4f90fd37736046aafe)

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-05 23:22:12 +01:00
Ming Liu c09a0631b5 kernel.bbclass: introduce INITRAMFS_IMAGE_NAME
It defaults to ${INITRAMFS_IMAGE}-${MACHINE} if INITRAMFS_IMAGE is not
empty.

This allows the end users to be able to override the initramfs image
name with a customized value.

(From OE-Core rev: e788fb2b894852f71b1c545abde71b45b9f230dc)

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>
2017-04-01 08:14:58 +01:00
Ming Liu 35565057fa kernel.bbclass: fix a typo
In a addtask statement, do_strip should be strip.

(From OE-Core rev: 8413e26164644230615f4503ca9488b5b4021aeb)

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>
2017-04-01 08:14:58 +01:00
Amarnath Valluri 0decf1cc1c kernel: use ${nonarch_base_libdir} for kernel modules installation.
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>
2017-03-22 11:35:20 +00:00
California Sullivan 132b4d13e0 kernel.bbclass: Give sanity check function an opt-out variable
Having no opt-out method and adding the task to linux-yocto.inc was
causing issues. For example, linux-yocto-dev would often fail because
it uses AUTOREV with no way to dynamically change the PV.

Add a variable to turn off the sanity check, allowing an easy opt out,
and set the opt-out variable in linux-yocto-dev, fixing the issue with
AUTOREV.

(From OE-Core rev: 1b6a3c17874ead7ee0957e67329aa3bd019fa129)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-04 23:18:19 +00:00
Mike Crowe 0b8d85a094 kernel, license, sstate, rootfs.py: Remove deploy directory README
It isn't clear that the README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
file in the deploy directory warrants the complexity it brings elsewhere.
Let's just remove it entirely.

In particular, if two do_image_complete tasks run in parallel they risk
both trying to put their image into ${DEPLOY_DIR_IMAGE} at the same time.
Both will contain a README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
file. In theory this should be safe because "cp -alf" will just cause one
to overwrite the other. Unfortunately, coreutils cp also has a race[1]
which means that if one copy creates the file at just the wrong point the
other will fail with:

 cp: cannot create hard link ‘..../tmp-glibc/deploy/images/pantera/README_-_DO_NOT_DELETE_FILES_IN_THIS_D.txt’ to
+‘..../tmp-glibc/work/rage_against-oe-linux-gnueabi/my-own-image/1.0-r0/deploy-my-own-image-complete/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt’: File exists

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25680

(From OE-Core rev: 71e9e88847d7000781642ea6187ebd8f40dfdcfe)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:17:45 +00:00
Robert Yang 970b0321cf kernel.bbclass: do_deploy requires depmodwrapper
Fixed:
run.do_deploy.27809: line 155: depmodwrapper: command not found

(From OE-Core rev: 96b7eceefb3e99848d1c16d7c5da123056dcdc24)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-23 12:49:49 -08:00
Andrea Adami 0fce3ec656 kernel.bbclass: Make symbol to vmlinuz.bin in boot directory
The changes committed with 6e58f54be103814b6b8a85b236510633c49e6832 did only
consider the vmlinuz ELF kernel but some devices do reqire a raw vmlinuz.bin
(as for example gcw0 in meta-handheld booted by ubiboot).
Expand the above mentioned patch to consider this case.

(From OE-Core rev: 413a5faf99280f4e083358e4134aebbcfa47bb4c)

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 09:29:56 -08:00
Jussi Kukkonen fc7394fe2d kernel.bbclass: Add PACKAGE_WRITE_DEPS for postinst
The depmodwrapper dependency is not actually used by the class but
anyone using pkg_postinst_kernel-base() will need it.

(From OE-Core rev: e3f5290d8deba9b7cead73b52ac45a37228fece9)

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:53:51 +00:00
Jason Wessel 7085148116 Revert "kernel: Modify kernel modules installation path."
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>
2017-01-20 11:53:49 +00:00
Amarnath Valluri 9c2158c073 kernel: Modify kernel modules installation path.
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>
2017-01-16 18:05:12 +00:00
David Vincent de807c7820 kernel: Fix symlinks
When installing a kernel package, the symlinks created by
update-alternatives should point to a path relative to KERNEL_IMAGEDEST
and not an absolute path to '/boot'.

Failing to do so causes problems when resolving the symlink inside some
bootloaders which mount the boot partition elsewhere.

(From OE-Core rev: c7bc46b9bc29dd0953ab8d63b50fa105bb66892e)

Signed-off-by: David Vincent <freesilicon@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-22 08:50:17 +00:00
Joshua Lock c4e2c59088 meta: remove True option to getVar calls
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>
2016-12-16 10:23:23 +00:00
Andreas Oberritter c03d02f918 kernel.bbclass: fix kernel_do_compile for KERNEL_IMAGETYPE = "vmlinux.gz" on mips
The target directory didn't exist.

(From OE-Core rev: bd62851dc236a0279c735b290782602e275de5c1)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:31:30 +00:00
Andreas Oberritter fffc641a10 kernel.bbclass: do not copy bundled initramfs to /boot
These files cause warnings because they don't get packaged, now that they
don't land in kernel-vmlinux anymore.

(From OE-Core rev: a49569e3a7534779bbe3f01a0647fd076c95798d)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:31:30 +00:00
Andreas Oberritter e02affce3c kernel.bbclass: Avoid wildcards for kernel images
With multiple kernel images enabled starting with 'vmlinux', e.g.
vmlinux.gz and vmlinux.bin, all files landed inside the
kernel-vmlinux package.

On top of that, even initramfs images were included, e.g.
vmlinux.gz-initramfs-*.

(From OE-Core rev: b7f4133b44b740e8ac8e758b0d4a3ee32d326332)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:31:29 +00:00
Andreas Oberritter 4cf1310051 kernel.bbclass: Use real filenames in kernel packages
When iterating over kernel image types to set up their packaging
variables, don't use make targets but the real names.

It was surprising if both vmlinux.bin and vmlinux.gz were enabled
and only the latter had its filename extension removed from the
package name.

(From OE-Core rev: aa189f183e10588f7e8d642f351bd9b8d69f3ea9)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:31:29 +00:00
Andreas Oberritter 68b2a6320a kernel.bbclass: allow uncompressed initramfs archives
The code failed to copy the initramfs in case it was a plain
cpio archive.

(From OE-Core rev: 7dbdb4ea91aa027866da2bd46c65fe65a25c848f)

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-08 10:31:29 +00:00
Robert Yang e61b6e96b0 kernel.bbclass: let do_deploy depend on do_packagedata
The do_deploy runs depmodwrapper which requires
pkgdata/kernel-depmod/kernel-abiversion, which is generated by
PACKAGEFUNCS. So we need let do_deploy depend on do_packagedata.

This can fix the errors which happens sometimes when kernel upgrades:
DEBUG: Executing shell function do_deploy
Error: Kernel version 4.8.8-WR9.0.0.1_standard does not match kernel-abiversion (4.8.8-WR9.0.0.0_standard)

And we only see this error when kernel upgrades and rebuild, but doesn't
see it in a normal build, this is becuase depmodwrapper doesn't exit
error when kernel-depmod/kernel-abiversion doesn't exit, it just prints
an error which should go into log.do_deploy:
if [ ! -r /path/to/sysroots/qemux86-64/pkgdata/kernel-depmod/kernel-abiversion ]; then
    echo "Unable to read: /path/to/sysroots/qemux86-64/pkgdata/kernel-depmod/kernel-abiversion" >&2
else
    [foo]
fi

We can see that there is no "exit 1", I guess it was designed to let it
can run without kernel-abiversion

(From OE-Core rev: 64148a30397b8c92414262c0d414d103d2b97ddd)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:38:06 +00:00
California Sullivan 0eacf03de1 kernel.bbclass: Add kernel_version_sanity_check function
The kernel being built should match what the recipe claims it is
building. This function ensures that happens by comparing the version
information in the kernel's Makefile to the PV the recipe is using.

v2 changes:
* Match against PV instead of LINUX_VERSION
* Match against EXTRAVERSION as well (e.g., -rc4)
* Cleaned up version string building

Fixes [YOCTO #6767].

(From OE-Core rev: ec467cfaea5c8cf22c61daa8845c2e4e96449512)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-21 21:58:05 +01:00
Andre McCurdy 91347edaec kernel.bbclass: assign INITRAMFS_BASE_NAME using ?=
Default values for KERNEL_IMAGE_BASE_NAME and MODULE_IMAGE_BASE_NAME
are already assigned using ?= and anyone wanting to over-ride one is
likely to want to over-ride them all. Make the three consistent with
each other.

(From OE-Core rev: e30c6c93bb70d17244c90c2be12229148f8f6314)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-20 15:11:08 +01:00
Robert Yang b8e2bab119 meta: cleanup d.getVar(var, 1)
(From OE-Core rev: 79fe476be233015c1c90e9c3fb4572267b5551d1)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-14 22:22:07 +01:00
Jérémy Rosen 270f4232ac linux-yocto: allow overriding compiler name in KConfig
The KConfig infrastructure needs to build HOST binaries in order to
provide its infratstructure. Yocto needs to force the HOSTCC and HOSTCPP
variables to BUILD_CC and BUILD_CPP to make sure that the proper compiler
is used when compiling host binaries

(From OE-Core rev: c710401a2af6488b38565e8ef32b48ed1cd0aa69)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-14 22:22:07 +01:00
Mattias Waldo 104eb5794a kernel.bbclass: include signing keys when copying files required for module builds
The absence of signing_key.* in $kerneldir made signing of
out-of-tree kernel modules fail (silently). Add copying of these
files during the shared_workdir task.

(From OE-Core rev: 7aadc91b5ef86a89a827d59bd19e7b8272a5dd66)

Signed-off-by: Mattias Waldo <mattias.waldo@saabgroup.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03 23:45:54 +01:00
Stefan Müller-Klieser c93ee72733 kernel.bbclass: add user output to savedefconfig
In a similar manner to diffconfig, tell the bitbake user where the
defconfig will be saved to.

(From OE-Core rev: 8e4cefb093e0df9660e2a6215cfe21c6c779c23f)

Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03 23:45:53 +01:00
Stefan Müller-Klieser a2670159f4 kernel.bbclass: remove EXTRA_OEMAKE workaround
The default of EXTRA_OEMAKE is already empty since commit:

OE-Core rev: aeb653861a0ec39ea7a014c0622980edcbf653fa
bitbake.conf: Remove unhelpful default value for EXTRA_OEMAKE

(From OE-Core rev: de720a8b10de17e613a8fb20d8df2af0b84507d7)

Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03 09:58:40 +01:00
Trevor Woerner a4f0ae1113 kernel.bbclass: add lzop dependency
If the initramfs image is type lzo, then a native lzop is needed.

(From OE-Core rev: ee0640cb0c32b959ffaaac6752d582ed1d76e313)

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-10 10:46:29 +01:00
André Draszik 71d0c871c9 kernel.bbclass: explicitly set workdir in do_bundle_initramfs
bitbake rev 67a7b8b02 "build: don't use $B as the default cwd for
functions" (included in current bitbake master) breaks the assumption
that do_bundle_initramfs runs inside the build directory.

This causes kernel_do_compile() as called from within
do_bundle_initramfs() to fail, as the former is not being executed
from the correct directory anymore. (Note that kernel_do_compile()
as called from bitbake directly doesn't suffer from that problem,
as it inherits the workdir from base_do_compile() in that case.)

Set workdir explicitly.

(From OE-Core rev: 4455da22a151c2ac006af63cbd39779b21b12580)

Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-26 08:56:30 +01:00
André Draszik 820a9d0cb6 classes/kernel: fix symlink logic when bundling initramfs images
If linkpath points to the a file in KERNEL_OUTPUT_DIR, rather than
outside, then symlink creation for the bundled initramfs image files
fails.

This is because in that case $linkpath.initramfs and $realpath.initramfs
are in the same directory, KERNEL_OUTPUT_DIR, and hence are the same.
Since we just created $realpath.initramfs, creating a symlink with the
same name will fail.

Given that $linkpath is not necessarily the same as the kernel image type,
just removing this symlink creation is not the right thing to do, as
in that case kernel_do_deploy() wouldn't find the bundled file.

What we really want is a symlink from the name of the initramfs-bundled
kernel image type to the real initramfs-bundled kernel image, as that is
what is actually used later in do_deploy().

This brings the code path for when $KERNEL_OUTPUT_DIR/$type is a symlink
in line with when it is not.

(From OE-Core rev: 7585ebbbe4e95870ab7475737ed5b94255351c72)

Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-01 16:22:44 +01:00
André Draszik 83444bbe2d classes/kernel: fix symlink creation in DEPLOYDIR for bundled initramfs
If multiple kernel image types have been specified, only the very first
one would receive a symlink in DEPLOYDIR.

The reason is that we're looping over the list of image types and check
if a bundled initramfs images exists using a relative path. As part of
the loop we're changing the current directory, hence all additional
iterations fail to see the files we're looking for, and hence no symlinks
are being created.

Fix by not changing the directory and adjusting the ln invocation instead.

(From OE-Core rev: 2a6ac8ca71b669b8653eb19417faf58575385a21)

Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-01 16:22:43 +01:00
Ross Burton e2e6fe964d classes/kernel: remove path assumptions in compile_kernelmodules
do_compile_kernelmodules was assuming that the current directory was ${B} but
didn't make that explicit, so use an absolute path to ensure this always works.

(From OE-Core rev: a26ec548aabda74acfdd1e2893b98b47bc513b15)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-15 18:11:09 +01:00
He Zhe c45c94223d kernel: Make symbol link to vmlinuz in boot directory
Rename do_kernel_link_vmlinux to do_kernel_link_images and make a
symbol link to vmlinuz(if exists) for reference in arch/$arch/boot
directory.

Signen-off-by: He Zhe <zhe.he@windriver.com>

(From OE-Core rev: 6e58f54be103814b6b8a85b236510633c49e6832)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30 15:58:11 +01:00
He Zhe 0437a59e3c kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
Add KERNEL_IMAGETYPES to support building packaging and installing
multi types of kernel images, such as zImage uImage, at one time.

KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE work as before.

(From OE-Core rev: 849b67b2e4820564b5e5c9bd4bb293c44351c5f3)

Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30 15:58:11 +01:00
Paul Eggleton 55159ef056 classes/kernel: check OLDEST_KERNEL at configure time
If the kernel being built is older than OLDEST_KERNEL and we're building
with glibc, then the C library we're building is probably not going to
be compatible with the kernel and we should warn the user. (This is
easier to do here rather than when building glibc, because we don't
necessarily have the information we need to determine the kernel version
there, whereas we do here.)

Fixes [YOCTO #8653].

(From OE-Core rev: 2e66f57febe85a63ce2ab98eaf6318d47eb60939)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-20 10:20:55 +01:00
Paul Eggleton 02587c4bad classes/kernel: fix typo
KERNEL_VERISON -> KERNEL_VERSION (in a comment)

(From OE-Core rev: 3f1d813e7183750b5189ae1ee99fd2f0bdeacac7)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-20 10:20:55 +01:00
Ming Liu 5444abaaca kernel: moves KERNEL_SRC_PATH to bitbake.conf
"/usr/src/kernel" is being hard-coded in multiple recipes so far, move its
definition to bitbake.conf.

(From OE-Core rev: eb9f900527e02ca08a1de14b4ac773f513bb1ee4)

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-19 22:32:08 +01:00
Khem Raj f3a92ff7d3 kernel.bbclass: consider .csp firmware files
Fixes kernels which package sb16 firmware e.g.

directories were installed but not shipped in any package:
  /lib/firmware/sb16
  /lib/firmware/sb16/ima_adpcm_playback.csp
  /lib/firmware/sb16/ima_adpcm_init.csp
  /lib/firmware/sb16/mulaw_main.csp
  /lib/firmware/sb16/ima_adpcm_capture.csp
  /lib/firmware/sb16/alaw_main.csp

(From OE-Core rev: 826bc56e77bd9a53f6bc19548549f6d92de09911)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-28 15:55:48 +01:00
Ioan-Adrian Ratiu 3fa1c54a69 Revert "kernel/kernel-arch: Explicitly mapping between i386/x86_64 and x86 for kernel ARCH"
This reverts commit 8d310b24927d0f348fb431895f0583733db2aad0.

That commit completely breaks KBUILD_DEFCONFIG because it relies on
$ARCH to match between the target OE arch and the kernel subdirectory
containing the defconfigs. In the kernel all defconfigs for everything
x86-based (including x86_64) is stored in dir arch/x86/configs/

kernel-yocto.bbclass correctly searches for all the defconfigs inside
${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}

Commit 8d310b249 makes it search in wrong places and _only_ if you
define TARGET_ARCH = "athlon" will it search x86 which is nonsensical.

The commit further adds an if clause to hack the mungled kernel arches
back to their original values (ugh) in do_shared_workdir which is run
after do compile, but of course the build breaks before that in
do_kernel_metadata because of the KBUILD_DEFCONFIG mentioned above (so
that hack is useless).

Please fix that corner case bug in another way which does not completely
screw up the kernel arch mapping & defconfig logic. If 64bit configs are
generated in the kernel for 32bit machines because the host is asked,
then it it a bug in the kernel, it is of no use to hack around it in OE.

(From OE-Core rev: bc02a478a5d4a5de7b3943ed809d5c22711f5b1f)

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-04 23:39:02 +00:00
Richard Purdie fdac363684 kernel: Clean DEPLOYDIR before do_deploy runs
If we don't do this, the deploy sstate object contains an every
increasing number of modules tarballs and kernel images, one per
execution of "-c deploy -f".

Cleaning the directory before we start makes things much tidier.

(From OE-Core rev: 3ac195bbd4ced24e6a132cfbe5e175b95fc4664b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-26 18:05:13 +00:00
Andre McCurdy 76e35f1d76 kernel-yocto.bbclass: move do_kernel_link_vmlinux() into kernel.bbclass
Move do_kernel_link_vmlinux() from kernel-yocto.bbclass into
kernel.bbclass so that it's available to any kernel recipe.

Note that the task is not enabled by default in kernel-yocto.bbclass,
so don't enable by default in kernel.bbclass either. To enable, see
the example in linux-yocto.inc, ie:

  addtask kernel_link_vmlinux after do_compile before do_install

(From OE-Core rev: a29371848deda618a42f9a30f9856a44c2342fe6)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-18 11:47:08 +00:00
Jianxun Zhang c0e9f2d2b6 kernel/kernel-arch: Explicitly mapping between i386/x86_64 and x86 for kernel ARCH
For a bare-bone kernel recipe which specifies 32 bit x86 target,
a 64 bit .config will be generated from do_configure task when
building 32-bit qemux86, once all of these conditions are true:

* arch of host is x86_64
* kernel source tree used in build has commit ffee0de41 which
  actually chooses i386 or x86_64 defconfig by asking host when
  ARCH is "x86" (arch/x86/Makefile)
* bare-bone kernel recipe inherits directly from kernel without
  other special treatments.

Build will fail because of the mismatched kernel architecture.

The patch sets ARCH i386 or x86_64 explicitly to configure
task to avoid this host contamination. Kernel artifact is also
changed so that it can map i386 and x64 back to arch/x86 when
needed.

(From OE-Core rev: 8d310b24927d0f348fb431895f0583733db2aad0)

Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-15 15:44:56 +00:00
Richard Purdie 3341f3fbee classes: Fix do_rootfs references
After the separation of do_rootfs, some rootfs references need changing
to image_complete.

(From OE-Core rev: 59a5f596ca29b1eb8283706e3c60fbb39f9c2c23)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-11 23:26:29 +00:00
Andre McCurdy 95909bc788 kernel.bbclass: drop unnecessary 'eval' from kernel_do_configure()
KERNEL_CONFIG_COMMAND will be expanded by bitbake, so can be
used directly in kernel_do_configure()

(From OE-Core rev: f8a35d8e312df908c73724465035921856d30781)

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>
2015-12-12 23:42:52 +00:00
Jens Rehsack a9cc27e691 kernel: fix race condition between compile_kernelmodules and shared_workdir
Fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=8127 which causes
[ 1225.089323] 8189es: Unknown symbol cfg80211_scan_done (err -22)
[ 1225.095916] 8189es: no symbol version for cfg80211_remain_on_channel_expired
when loading external compiled 8189es module.

(From OE-Core rev: afcea61e8eb39234d336c706fdfd4680dea7c060)

Signed-off-by: Jens Rehsack <sno@netbsd.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-24 15:50:27 +00:00
Kevin Hao 4266cc986a kernel.bbclass: fix the bug of checking the existing sections in do_strip()
Ross reported the following waring when building edgerouter BSP:
    WARNING: Section not found: .comment

The reason is that the testing of the existing sections in do_strip()
returned the wrong value. Please see the following code in do_strip():
                for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do {
                        if [ "$headers" != *"$str"* ]; then
                                bbwarn "Section not found: $str";
                        fi

                        "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT}
                }; done

The "*" doesn't have special meaning in the if string test, so it will
return true even the $str is a substring of $headers. Fix this issue
by replacing it with "! (echo "$headers" | grep -q "^$str$")".

Reported-by: Ross Burton <ross.burton@intel.com>
(From OE-Core rev: 4965f122ca67c0ff60dc60f7885db1ed9db909b4)

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-01 07:43:37 +01:00
Markus Lehtonen baf39c800a kernel.bbclass: do not mv/link sources when externalsrc enabled
If externalsrc is enabled the 'do_unpack' task is run if the recipe has
some local source files. In the case of kernel recipe this caused the
(externalsrc) source tree to be moved/symlinked. This patch prevents the
behaviour, making sure the source tree is not moved around when
externalsrc is enabled. Instead of moving the source tree,
STAGING_KERNEL_DIR will be a symlink to it.

[YOCTO #6658]

(From OE-Core rev: 8f6c564661a3801012eb2d9a98cdc99c91712367)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-09 14:27:49 +01:00
Kevin Hao a346a3cd52 kernel.bbclass: add the runtime dependency on kernel-vmlinux for kernel-image
When a BSP uses vmlinux for boot, the kernel-image package is just
empty. But by default the kernel-vmlinux is not installed. Then the
pkg_postinst_kernel-image() would create a symlink to a non-existent
file. Fix this by adding the runtime dependency on kernel-vmlinux for
kernel-image if the KERNEL_IMAGETYPE is "vmlinux".

(From OE-Core rev: bd8b9bc716774a8f8b4b97ece5c7b2eb58aa2330)

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-03 12:43:23 +01:00