diff options
-rw-r--r-- | meta/classes/kernel.bbclass | 30 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto.inc | 1 |
2 files changed, 31 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 | ||
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc index 98a48ec44a..d979662a50 100644 --- a/meta/recipes-kernel/linux/linux-yocto.inc +++ b/meta/recipes-kernel/linux/linux-yocto.inc | |||
@@ -55,6 +55,7 @@ do_install_append(){ | |||
55 | } | 55 | } |
56 | 56 | ||
57 | # extra tasks | 57 | # extra tasks |
58 | addtask kernel_version_sanity_check after do_kernel_checkout before do_compile | ||
58 | addtask kernel_link_images after do_compile before do_install | 59 | addtask kernel_link_images after do_compile before do_install |
59 | addtask validate_branches before do_patch after do_kernel_checkout | 60 | addtask validate_branches before do_patch after do_kernel_checkout |
60 | addtask kernel_configcheck after do_configure before do_compile | 61 | addtask kernel_configcheck after do_configure before do_compile |