mirror of
https://git.yoctoproject.org/poky
synced 2026-02-22 17:39:39 +01:00
Some distros may want to provide alternate kernel "flavors" via feeds or
within bootable images. For example, readily available builds which
provide certain diagnostic features can enable developers and testers to
more quickly resolve issues by avoiding lengthy kernel builds.
This change allows for building multiple flavors of the kernel and
module packages by templatizing kernel package names via a new
KERNEL_PACKAGE_NAME variable in kernel.bbclass. It defaults to the old
name of "kernel", but can be overridden by certain recipes providing
alternate kernel flavors.
To maintain compatibility, recipes providing alternate kernel flavors
cannot be the "preferred provider" for virtual/kernel. This is because
OE puts the preferred provider's build and source at
"tmp-glibc/work-shared/$MACHINE/kernel-build-artifacts/" and
"tmp-glibc/work-shared/$MACHINE/kernel-source/" instead of
"tmp-glibc/work/*/$PN/" like other recipes. Therefore, recipes using the
default KERNEL_PACKAGE_NAME="kernel" follows the old semantics -- build
in the old location and may be preferred provider -- while recipes using
all other KERNEL_PACKAGE_NAME's build from the normal WORKDIR and don't
provide "virtual/kernel".
Testing:
1. Add `KERNEL_PACKAGE_NAME_pn-linux-yocto-tiny = "tiny-linux"`
to local.conf so that linux-yocto-tiny may build alongside
the main kernel (linux-yocto).
2. `bitbake linux-yocto linux-yocto-tiny` to build both kernel flavors.
3. Verified image and modules IPKs exist for both:
tmp-glibc/deploy/ipk/qemux86/kernel-* for linux-yocto
tmp-glibc/deploy/ipk/qemux86/tiny-linux* for linux-yocto-tiny
4. Verified linux-yocto is the "preferred provider", and was built in
shared directory: tmp-glibc/work-shared/qemux86/kernel-*
5. Add `CORE_IMAGE_BASE_INSTALL_append_pn-core-image-base = "tiny-linux"`
to local.conf to install both kernel flavors in core-image-base.
6. `bitbake core-image-base` to build an image.
7. Verified image contains two bzImage's under /boot/, with
"yocto-standard" (linux-yocto recipe) selected to boot via symlink.
Discussion threads:
http://lists.openembedded.org/pipermail/openembedded-core/2015-December/thread.html#114122
http://lists.openembedded.org/pipermail/openembedded-core/2017-July/thread.html#139130
[YOCTO #11363]
(From OE-Core rev: 6c8c899849d101fd1b86aad0b8eed05c7c785924)
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Gratian Crisan <gratian.crisan@ni.com>
Coauthored-by: Haris Okanovic <haris.okanovic@ni.com>
Coauthored-by: Josh Hernstrom <josh.hernstrom@ni.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
70 lines
2.2 KiB
PHP
70 lines
2.2 KiB
PHP
SUMMARY = "Linux kernel"
|
|
SECTION = "kernel"
|
|
LICENSE = "GPLv2"
|
|
|
|
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
|
|
|
|
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)"
|
|
|
|
INC_PR = "r4"
|
|
|
|
# Skip processing of this recipe if it is not explicitly specified as the
|
|
# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required
|
|
# by the use of AUTOREV SRCREVs, which are the default for this recipe.
|
|
python () {
|
|
if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != d.getVar("PN", True):
|
|
d.delVar("BB_DONT_CACHE")
|
|
raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN")))
|
|
}
|
|
|
|
DEPENDS += "xz-native bc-native"
|
|
DEPENDS_append_aarch64 = " libgcc"
|
|
KERNEL_CC_append_aarch64 = " ${TOOLCHAIN_OPTIONS}"
|
|
KERNEL_LD_append_aarch64 = " ${TOOLCHAIN_OPTIONS}"
|
|
|
|
DEPENDS_append_nios2 = " libgcc"
|
|
KERNEL_CC_append_nios2 = " ${TOOLCHAIN_OPTIONS}"
|
|
KERNEL_LD_append_nios2 = " ${TOOLCHAIN_OPTIONS}"
|
|
|
|
KERNEL_FEATURES_append_qemuall=" features/debug/printk.scc"
|
|
|
|
# A KMACHINE is the mapping of a yocto $MACHINE to what is built
|
|
# by the kernel. This is typically the branch that should be built,
|
|
# and it can be specific to the machine or shared
|
|
# KMACHINE = "UNDEFINED"
|
|
|
|
# The distro or local.conf should set this, but if nobody cares...
|
|
LINUX_KERNEL_TYPE ??= "standard"
|
|
|
|
# KMETA ?= ""
|
|
KBRANCH ?= "master"
|
|
KMACHINE ?= "${MACHINE}"
|
|
SRCREV_FORMAT ?= "meta_machine"
|
|
|
|
# LEVELS:
|
|
# 0: no reporting
|
|
# 1: report options that are specified, but not in the final config
|
|
# 2: report options that are not hardware related, but set by a BSP
|
|
KCONF_AUDIT_LEVEL ?= "1"
|
|
KCONF_BSP_AUDIT_LEVEL ?= "0"
|
|
KMETA_AUDIT ?= "yes"
|
|
|
|
LINUX_VERSION_EXTENSION ??= "-yocto-${LINUX_KERNEL_TYPE}"
|
|
|
|
# Pick up shared functions
|
|
inherit kernel
|
|
inherit kernel-yocto
|
|
|
|
B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build"
|
|
|
|
do_install_append(){
|
|
if [ -n "${KMETA}" ]; then
|
|
rm -rf ${STAGING_KERNEL_DIR}/${KMETA}
|
|
fi
|
|
}
|
|
|
|
# extra tasks
|
|
addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile
|
|
addtask validate_branches before do_patch after do_kernel_checkout
|
|
addtask kernel_configcheck after do_configure before do_compile
|