diff options
author | California Sullivan <california.l.sullivan@intel.com> | 2016-09-16 16:48:24 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-21 21:58:05 +0100 |
commit | 0eacf03de18b7eeb3460a4d102dd5932cd73cd06 (patch) | |
tree | 5d5c9af207277dbfc1bd4cf42ea1e4f21d9531f5 /meta/classes/kernel.bbclass | |
parent | c2908e1d1f170f4b588c070e912449c3537f8fb2 (diff) | |
download | poky-0eacf03de18b7eeb3460a4d102dd5932cd73cd06.tar.gz |
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>
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r-- | meta/classes/kernel.bbclass | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index bfb7350604..25a153cd20 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass | |||
@@ -327,6 +327,36 @@ kernel_do_install() { | |||
327 | } | 327 | } |
328 | do_install[prefuncs] += "package_get_auto_pr" | 328 | do_install[prefuncs] += "package_get_auto_pr" |
329 | 329 | ||
330 | # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile | ||
331 | do_kernel_version_sanity_check() { | ||
332 | # The Makefile determines the kernel version shown at runtime | ||
333 | # Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile | ||
334 | VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//) | ||
335 | PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//) | ||
336 | SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//) | ||
337 | EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//) | ||
338 | |||
339 | # Build a string for regex and a plain version string | ||
340 | reg="^${VERSION}\.${PATCHLEVEL}" | ||
341 | vers="${VERSION}.${PATCHLEVEL}" | ||
342 | if [ -n "${SUBLEVEL}" ]; then | ||
343 | # Ignoring a SUBLEVEL of zero is fine | ||
344 | if [ "${SUBLEVEL}" = "0" ]; then | ||
345 | reg="${reg}(\.${SUBLEVEL})?" | ||
346 | else | ||
347 | reg="${reg}\.${SUBLEVEL}" | ||
348 | vers="${vers}.${SUBLEVEL}" | ||
349 | fi | ||
350 | fi | ||
351 | vers="${vers}${EXTRAVERSION}" | ||
352 | reg="${reg}${EXTRAVERSION}" | ||
353 | |||
354 | if [ -z `echo ${PV} | grep -E "${reg}"` ]; then | ||
355 | bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source." | ||
356 | fi | ||
357 | exit 0 | ||
358 | } | ||
359 | |||
330 | addtask shared_workdir after do_compile before do_compile_kernelmodules | 360 | addtask shared_workdir after do_compile before do_compile_kernelmodules |
331 | addtask shared_workdir_setscene | 361 | addtask shared_workdir_setscene |
332 | 362 | ||