summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
diff options
context:
space:
mode:
authorCalifornia Sullivan <california.l.sullivan@intel.com>2016-09-16 16:48:24 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-21 21:58:05 +0100
commit0eacf03de18b7eeb3460a4d102dd5932cd73cd06 (patch)
tree5d5c9af207277dbfc1bd4cf42ea1e4f21d9531f5 /meta/classes/kernel.bbclass
parentc2908e1d1f170f4b588c070e912449c3537f8fb2 (diff)
downloadpoky-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.bbclass30
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}
328do_install[prefuncs] += "package_get_auto_pr" 328do_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
331do_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
330addtask shared_workdir after do_compile before do_compile_kernelmodules 360addtask shared_workdir after do_compile before do_compile_kernelmodules
331addtask shared_workdir_setscene 361addtask shared_workdir_setscene
332 362