Commit Graph

245 Commits

Author SHA1 Message Date
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
Andre McCurdy 61fe46da92 kernel.bbclass: dont assume ${B}/include/generated exists
Older kernels (e.g. 2.6.32) don't create an include/generated directory,
so check that the directory exists before trying to copy files from it
in do_shared_workdir().

(From OE-Core rev: 5bebaf37429c28134aeb6fd261e282e9a0397771)

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-08-11 09:28:50 -07:00
Ross Burton c713a22368 kernel: fix path assumptions in tasks
Several of the kernel class tasks were making assumptions about what directory
they were executed in.  Clarify the code by making paths absolute or passing -C
to oe_runmake.

(From OE-Core rev: d596286bc4cf19774447b136a27acf3c61aad2ff)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-16 15:09:21 +01:00
Marek Vasut 7f131b8863 kernel: Pull uImage generation into separate class
Pull the uImage image format generation from kernel.bbclass into
a separate kernel-uimage.bbclass. Introduce new KERNEL_CLASSES
variable, which allows registration of additional classes which
implement new kernel image types. The default value of is to
register kernel-uimage to preserve the original behavior.

(From OE-Core rev: 086536ac84fcc9350802c09166f600becd52a1f8)

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Koen Kooi <koen@dominion.thruhere.net>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: Ross Burton <ross.burton@intel.com>
Cc: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-26 10:57:51 +01:00
Marek Vasut 12f983b66a kernel: Pull out the linux.bin generation
Pull the generation of linux.bin image, which is then packed into uImage,
into a separate function. No functional change.

(From OE-Core rev: 2879e5423aff8df5731712b853d71a73047a2fd7)

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Koen Kooi <koen@dominion.thruhere.net>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: Ross Burton <ross.burton@intel.com>
Cc: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-26 10:57:51 +01:00
Marek Vasut 88d79fee80 kernel: Rework do_uboot_mkimage
Rework the function so part it's internals can be re-used by fitImage
image type. The name of the temporary file , linux.bin , is recycled
a little more as it's now used for both the case where it is gzip
compressed and where it is not. This should be fine, since the file
is temporary and removed after the uImage was created anyway.

There is no functional change here.

(From OE-Core rev: 63e3816b161f8659850d6123a53bdf128780e13d)

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Koen Kooi <koen@dominion.thruhere.net>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: Ross Burton <ross.burton@intel.com>
Cc: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-26 10:57:51 +01:00
Marek Vasut 92864a9830 kernel: Clean up KERNEL_IMAGETYPE_FOR_MAKE
Remove the lambda function setting KERNEL_IMAGETYPE_FOR_MAKE and instead
set it in the anonymous python function. This also allows us to handle
image types which are not supported directly by kernel, but require some
other kernel target to be built. This is the case for example with the
fitImage, which is the uImage successor.

There is no functional change.

(From OE-Core rev: a1690131691507bbf5853540229b3ad775b836bf)

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Koen Kooi <koen@dominion.thruhere.net>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: Ross Burton <ross.burton@intel.com>
Cc: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-26 10:57:51 +01:00
Richard Purdie f5f2467e4b kernel/rm_work: Improve interaction
The do_shared_workdir task does leave behind the necessary information in
shared-work after it completes. We don't make this a "full" sstate task
however since that means tarring up and copying what is usually a large
amount of data which would be better extracted straight from the original
SCM.

The issue with rm_work occurs since it removes the do_shared_workdir stamp
meaning subsequent builds will add it back if they need to touch any kernel
modules for example. This ends up triggering a near enough complete kernerl
rebuild since if configure reruns, populate_sysroot has to rerun.

This change promotes the task to have a "setscene" variant but it doesn't use
any of the sstate class lifting to generate the sstate file. The sstate function
will therefore never get called since the sstate object will never exist.

We can add the task to the list of tasks rm_work promotes to a setscene variant
and unwanted rebuilds of the kernel should be avoided.

(From OE-Core rev: 55b4f7fd217f0c65d457c731150340c18fb3fa19)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-15 17:44:59 +01:00
Ed Bartosh 02d0a003d6 kernel.bbclass: Fix race condition
Race condition between do_compile_kernelmodules and do_shared_workdir
tasks occurs when do_compile_kernelmodules changes files in
include/generated/* while do_shared_workdir tries to copy them to
shared working directory.

Fixed race by moving do_shared_workdir after do_compile but before
do_compile_kernelmodules.

[YOCTO #7321]

(From OE-Core rev: b4ec689f71fe9504559c1921c893f5e096d6b744)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-07 13:40:36 +01:00
Richard Purdie 3f15d8a807 kernel: Fix depmod for multilib
Using populate_sysroot for this data was a nice idea but flawed as it
doesn't work in multilib builds. Instead we can use PKGDATA_DIR since
this is consistent over multilib builds. It also turns out to be
slightly neater code too. Hopefully this resolves the problem once and
for all.

(From OE-Core rev: 6cccae3ca54c1177a1d91d23c3e151d74e735ee9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-29 15:36:52 +00:00
Richard Purdie 11ef55a93b kernel/image/depmodwrapper: Fixups for depmod
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>
2015-01-23 14:32:02 +00:00
Vincent Génieux 9839638238 fix '[[: not found' error message using dash
Remove bash specific syntax '[[ test ]]' replaced with '[ test ]'.

Fixes [YOCTO #7112]

(From OE-Core rev: f2ff849d5936d3dc5e24301e0620da265df50fea)

Signed-off-by: Vincent Génieux <vincent2014@startigen.fr>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-23 11:36:29 +00:00
Darren Hart 34f3d55950 kernel.bbclass: Update cleandirs to remove new kernel staging dirs
Fixes [YOCTO 6818]

Update do_unpack[cleandirs] to include the STAGING_KERNEL_BUILDDIR, and
add the same set of updated cleandirs for do_clean.

(From OE-Core rev: 0726f8099c1407eea9e53a62be94defbab32265e)

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
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-16 23:08:18 +00:00
Bruce Ashfield 46cdaf1c7b kernel: move source and build output to work-shared
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>
2015-01-16 23:08:18 +00:00
Otavio Salvador 92725ad46f kernel.bbclass: When linux/version.h exists, copy it
Old Linux kernel versions rely on linux/version.h for modules; this
needs to be published for external modules to use. Copy it when
available.

(From OE-Core rev: 78226efe72c8221206594c70fa1d8742d4097af1)

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>
2015-01-16 23:08:18 +00:00
Martin Jansa cc73622d52 kernel.bbclass: fix do_unpack function when S ends with slash
* slash at the end causes os.symlink(kernsrc, s) to use s as
  directory name and fails with:

ERROR: Error executing a python function in /OE/build/owpb/webos-ports/meta-smartphone/meta-samsung/recipes-kernel/linux/linux-samsung-tuna_git.bb:

The stack trace of python calls that resulted in this exception/failure was:
File: 'base_do_unpack', lineno: 26, function: <module>
     0022:        subprocess.call(d.expand("mv /OE/build/owpb/webos-ports/tmp-glibc/work/maguro-webos-linux-gnueabi/linux-samsung-tuna/3_3.0.72+gitrAUTOINC+f8ed73f94a-r12/git/ /OE/build/owpb/webos-ports/tmp-glibc/sysroots/maguro/usr/src/kernel"), shell=True)
     0023:        os.symlink(kernsrc, s)
     0024:
     0025:
 *** 0026:base_do_unpack(d)
     0027:
File: 'base_do_unpack', lineno: 23, function: base_do_unpack
     0019:        bb.utils.mkdirhier(kernsrc)
     0020:        bb.utils.remove(kernsrc, recurse=True)
     0021:        import subprocess
     0022:        subprocess.call(d.expand("mv /OE/build/owpb/webos-ports/tmp-glibc/work/maguro-webos-linux-gnueabi/linux-samsung-tuna/3_3.0.72+gitrAUTOINC+f8ed73f94a-r12/git/ /OE/build/owpb/webos-ports/tmp-glibc/sysroots/maguro/usr/src/kernel"), shell=True)
 *** 0023:        os.symlink(kernsrc, s)
     0024:
     0025:
     0026:base_do_unpack(d)
     0027:
Exception: OSError: [Errno 2] No such file or directory

ERROR: Function failed: base_do_unpack
ERROR: Logfile of failure stored in: /OE/build/owpb/webos-ports/tmp-glibc/work/maguro-webos-linux-gnueabi/linux-samsung-tuna/3_3.0.72+gitrAUTOINC+f8ed73f94a-r12/temp/log.do_unpack.17042
ERROR: Task 0 (/OE/build/owpb/webos-ports/meta-smartphone/meta-samsung/recipes-kernel/linux/linux-samsung-tuna_git.bb, do_unpack) failed with exit code '1'

(From OE-Core rev: dba30c2395792b553b69ce0b44cc75ff2dbdb317)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-07 14:30:21 +00:00