From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.windriver.com (mail.windriver.com [147.11.1.11]) by mail.openembedded.org (Postfix) with ESMTP id 9EE7C65C8A for ; Wed, 21 Sep 2016 03:11:45 +0000 (UTC) Received: from ALA-HCB.corp.ad.wrs.com (ala-hcb.corp.ad.wrs.com [147.11.189.41]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id u8L3BjnR011924 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 20 Sep 2016 20:11:45 -0700 (PDT) Received: from [128.224.162.240] (128.224.162.240) by ALA-HCB.corp.ad.wrs.com (147.11.189.41) with Microsoft SMTP Server id 14.3.294.0; Tue, 20 Sep 2016 20:11:44 -0700 To: California Sullivan , References: <1474069704-24428-1-git-send-email-california.l.sullivan@intel.com> From: Robert Yang Message-ID: <0d1aff43-c348-83bf-becd-3265f4b30df8@windriver.com> Date: Wed, 21 Sep 2016 11:11:42 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1474069704-24428-1-git-send-email-california.l.sullivan@intel.com> Cc: bruce.ashfield@windriver.com Subject: Re: [PATCH V2 1/1] kernel.bbclass: Add kernel_version_sanity_check function X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2016 03:11:47 -0000 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Hi, There is an error on autobuilder related to this patch: http://autobuilder.yocto.io:8010/builders/nightly-x86-64-lsb/builds/60/steps/BuildImages_1/logs/stdio // Robert On 09/17/2016 07:48 AM, California Sullivan wrote: > 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]. > > Signed-off-by: California Sullivan > --- > meta/classes/kernel.bbclass | 30 ++++++++++++++++++++++++++++++ > meta/recipes-kernel/linux/linux-yocto.inc | 1 + > 2 files changed, 31 insertions(+) > > diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass > index a6112e8..f894795 100644 > --- a/meta/classes/kernel.bbclass > +++ b/meta/classes/kernel.bbclass > @@ -327,6 +327,36 @@ kernel_do_install() { > } > do_install[prefuncs] += "package_get_auto_pr" > > +# Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile > +do_kernel_version_sanity_check() { > + # The Makefile determines the kernel version shown at runtime > + # Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile > + VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//) > + PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//) > + SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//) > + EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//) > + > + # Build a string for regex and a plain version string > + reg="^${VERSION}\.${PATCHLEVEL}" > + vers="${VERSION}.${PATCHLEVEL}" > + if [ -n "${SUBLEVEL}" ]; then > + # Ignoring a SUBLEVEL of zero is fine > + if [ "${SUBLEVEL}" = "0" ]; then > + reg="${reg}(\.${SUBLEVEL})?" > + else > + reg="${reg}\.${SUBLEVEL}" > + vers="${vers}.${SUBLEVEL}" > + fi > + fi > + vers="${vers}${EXTRAVERSION}" > + reg="${reg}${EXTRAVERSION}" > + > + if [ -z `echo ${PV} | grep -E "${reg}"` ]; then > + bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source." > + fi > + exit 0 > +} > + > addtask shared_workdir after do_compile before do_compile_kernelmodules > addtask shared_workdir_setscene > > diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc > index 98a48ec..d979662 100644 > --- a/meta/recipes-kernel/linux/linux-yocto.inc > +++ b/meta/recipes-kernel/linux/linux-yocto.inc > @@ -55,6 +55,7 @@ do_install_append(){ > } > > # extra tasks > +addtask kernel_version_sanity_check after do_kernel_checkout before do_compile > addtask kernel_link_images after do_compile before do_install > addtask validate_branches before do_patch after do_kernel_checkout > addtask kernel_configcheck after do_configure before do_compile >