diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2023-11-07 00:34:18 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2023-11-07 13:22:17 +0000 |
commit | 92a7e8ec4639be5c0d6988353c649949d7e17f83 (patch) | |
tree | 2226dbac9d31fb5032593568a779b224f2030b1b | |
parent | f7bffb351c59cc972d9141ac2ab5ee2c40e19547 (diff) | |
download | meta-virtualization-92a7e8ec4639be5c0d6988353c649949d7e17f83.tar.gz |
kernel: allow configuration to be skipped .. but warn
Allow the kernel include file to be skipped, even if a
kernel is capable of merging and using the fragments in
the layer and kernel-cache.
Setting SKIP_META_VIRT_KERNEL_INCLUDE="t" in a kernel
bbappend, or in a configuration file will inhibit the
generated / detected include file.
BUT
If that opt-out is done, we warn, as the user has
explicitly disabled safeguards that help ensure that
subtle runtime issues aren't introduced.
BUT
If someone really knows what they are doing, they
don't want the warning to be present in each build.
So setting META_VIRT_KERNEL_CHECK_WARNING_INHIBIT="t"
will inhibit the message.
At that point, you have jumped through all the hoops
and you are free to ensure your kernel configuration
is correct using other means.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-kernel/linux/linux-%.bbappend | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/recipes-kernel/linux/linux-%.bbappend b/recipes-kernel/linux/linux-%.bbappend index 5f315787..dbae9b14 100644 --- a/recipes-kernel/linux/linux-%.bbappend +++ b/recipes-kernel/linux/linux-%.bbappend | |||
@@ -4,7 +4,35 @@ | |||
4 | LINUX_MAJOR = "${@(d.getVar('LINUX_VERSION') or "x.y").split('.')[0]}" | 4 | LINUX_MAJOR = "${@(d.getVar('LINUX_VERSION') or "x.y").split('.')[0]}" |
5 | LINUX_MINOR = "${@(d.getVar('LINUX_VERSION') or "x.y").split('.')[1]}" | 5 | LINUX_MINOR = "${@(d.getVar('LINUX_VERSION') or "x.y").split('.')[1]}" |
6 | 6 | ||
7 | 7 | KERNEL_META_TYPE = "${@'yocto' if d.getVar('SRC_URI').find('type=kmeta') > 0 and d.getVar('SKIP_META_VIRT_KERNEL_INCLUDE') == None else 'none'}" | |
8 | KERNEL_META_TYPE = "${@'yocto' if d.getVar('SRC_URI').find('type=kmeta') > 0 else 'none'}" | ||
9 | 8 | ||
10 | include ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-${KERNEL_META_TYPE}_${LINUX_MAJOR}.${LINUX_MINOR}_virtualization.inc', '', d)} | 9 | include ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'linux-${KERNEL_META_TYPE}_${LINUX_MAJOR}.${LINUX_MINOR}_virtualization.inc', '', d)} |
10 | |||
11 | python __anonymous () { | ||
12 | # Gather the variables | ||
13 | virt_enabled = bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'True', '', d ) | ||
14 | skip_kernel_include_enabled = d.getVar('SKIP_META_VIRT_KERNEL_INCLUDE') | ||
15 | kmeta_type = d.getVar('SRC_URI').find('type=kmeta') | ||
16 | inhibit_skip_kernel_check_warning = d.getVar('META_VIRT_KERNEL_CHECK_WARNING_INHIBIT') | ||
17 | |||
18 | # | ||
19 | # We warn if: | ||
20 | # - the kernel has the capability of merging fragments | ||
21 | # - virtualiation is enabled | ||
22 | # - and the user has decided to force skip the include | ||
23 | # | ||
24 | # .. because they have knowingly opted-out of our tested | ||
25 | # kernel configurations, and need to be warned. | ||
26 | # | ||
27 | # BUT, it can also be annoying to get a warning when you | ||
28 | # have explcitly opted out. So we have one more warning | ||
29 | # that indicates that the impacts are understood and this | ||
30 | # really is on purpse. If META_VIRT_KERNEL_CHECK_WARNING_INHIBIT | ||
31 | # is set, we won't do the warning. | ||
32 | # | ||
33 | if virt_enabled and kmeta_type > 0 and skip_kernel_include_enabled: | ||
34 | if not inhibit_skip_kernel_check_warning: | ||
35 | bb.warn( "You have a kernel-yocto enabled kernel, but have inhibited \ | ||
36 | virtualization kernel features. Some runtime issues may be present in \ | ||
37 | your final image" ) | ||
38 | } | ||