From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f196.google.com (mail-qk0-f196.google.com [209.85.220.196]) by mail.openembedded.org (Postfix) with ESMTP id 9C0007318A for ; Thu, 25 Aug 2016 14:54:36 +0000 (UTC) Received: by mail-qk0-f196.google.com with SMTP id n66so3779022qkf.0 for ; Thu, 25 Aug 2016 07:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=6cn1XSv289uTcj1SsuqYtOhVAZrNykVl2f9K3Gyd0FM=; b=AlHpdbp+dUoh10IuN1JxhtZdQjnSmERzY7oj6D9r2GPOXK2JnskLpG+ZN1l4ksz4sL zp9NLZ06C4rvSYvKu5fPw+c/ihWIEXKp7+5YlrBqNhS64GPFGGupbE6IZd3NIdT0LY7p XwrM6WzPJrktVeOkQIN67SY3joRxgdIWobtR5sISQrXuf5Cx3lqBRPG09aI7VaeOOp75 RddDGlo+dsA2qU7ApQzrFN4fzXVxQ1KtifnX9iPGe4I+HbpZQh776G0TUngTfvx5OD/G AQydm/60FcmUrPu8YNULw/sD+CmXCt9a/OQg440P9rc6BXJogziDWYr7xeoMMtLI1ynt Qzkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6cn1XSv289uTcj1SsuqYtOhVAZrNykVl2f9K3Gyd0FM=; b=fR2EvbxiWNwYsRDH7uxB3yJlTFEiMEQtpz7TLK8FSOsxqIZ5OstnJHSvoUHS1TB6a2 ck94jv9Fp9+e98tbX1MytnVUxG5RmATDXWBnbWGBuuqZKW2V0RVS1x3OSvpsqx6PI1Tm P0WfVbTJipigaB/xErzTsLC7Ubs6Ac7ulAnrFRhJviCJ9QfQ0vFAGQ9DSpITEtrqTcbr sRRrlebUIxZRJx9Elo06Ra2JW8iDHtV/NuUoaEySrykYjAwFYj6JtqdiZpbNFznz+d6Y kHM+Mz1iRa62XxltXdCRzCxkGq4kA6DE4dqr41WXluGSD/Nco+pvrc27WXrxO4OxMv1a 8Vqw== X-Gm-Message-State: AE9vXwPT3kyPcGbZhYi7rD7hVKX5ZQyU2lniPUcGuRq3DbcfVnvvHVE0V6KUZqp4AJBvAn3G8h7HppLeASgI+g== X-Received: by 10.55.166.137 with SMTP id p131mr10804652qke.161.1472136876529; Thu, 25 Aug 2016 07:54:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.50.137 with HTTP; Thu, 25 Aug 2016 07:54:35 -0700 (PDT) In-Reply-To: <1471411501-3523-1-git-send-email-california.l.sullivan@intel.com> References: <1471411501-3523-1-git-send-email-california.l.sullivan@intel.com> From: Bruce Ashfield Date: Thu, 25 Aug 2016 10:54:35 -0400 Message-ID: To: California Sullivan Cc: Patches and discussions about the oe-core layer Subject: Re: [PATCH RFC 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: Thu, 25 Aug 2016 14:54:39 -0000 Content-Type: multipart/alternative; boundary=94eb2c06eda09635e4053ae693db --94eb2c06eda09635e4053ae693db Content-Type: text/plain; charset=UTF-8 On Wed, Aug 17, 2016 at 1:25 AM, California Sullivan < california.l.sullivan@intel.com> wrote: > The kernel being built should match what the recipe claims it is > building. This function ensures that happens for anyone using > LINUX_VERSION as they should. As it will likely break outside kernels > not using LINUX_VERSION, only enable the function for linux-yocto for > now. > > Signed-off-by: California Sullivan > --- > I'm not absolutely sure this is the correct path to solve the issue. > This patch relies on LINUX_VERSION being set which isn't a guarantee. > There is probably a more general solution that I'm not thinking of. > I can't say that I know of all the options either, but I can ask questions and perhaps others will have more ideas. > > meta/classes/kernel.bbclass | 21 +++++++++++++++++++++ > meta/recipes-kernel/linux/linux-yocto.inc | 1 + > 2 files changed, 22 insertions(+) > > diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass > index db42744..ac2611f 100644 > --- a/meta/classes/kernel.bbclass > +++ b/meta/classes/kernel.bbclass > @@ -330,6 +330,27 @@ kernel_do_install() { > } > do_install[prefuncs] += "package_get_auto_pr" > > +# Must be ran some time 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/.*=\ //) > I was also trying to think of a way to avoid duplicating code that is yanking out version numbers, but yes if we depend on utsrelease, we also have to do some level of building .. but that can actually be pretty lightweight. Have you tried just invoking the prepare1 target in the kernel build ? That should generate the utsrelease, and not much more. > + > + # If SUBLEVEL is zero or doesn't exist we ignore it as > VERSION.PATCHLEVEL is normal > + if [ -n "${SUBLEVEL}" ] && [ "${SUBLEVEL}" != "0" ]; then > + if [ "${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" != > "${LINUX_VERSION}" ]; then > + bbfatal "LINUX_VERSION (${LINUX_VERSION}) does not > match kernel being built (${VERSION}.${PATCHLEVEL}.${SUBLEVEL}).\nTo fix > this correct the LINUX_VERSION variable in your kernel recipe." > I know that I use LINUX_VERSION in the linux-yocto recipes, but it isn't something enforced or widespread (as far as I know). Since this is kernel.bbclass versus kernel-yocto.bbclass should this be checking against PV versus LINUX_VERSION ? Alternatively, this could just move to kernel-yocto.bbclass as we try and make it more general. Bruce > + fi > + else > + if [ "${VERSION}.${PATCHLEVEL}" != "${LINUX_VERSION}" ]; > then > + bbfatal "LINUX_VERSION (${LINUX_VERSION}) does not > match kernel being built (${VERSION}.${PATCHLEVEL}).\nTo fix this correct > the LINUX_VERSION variable in your kernel recipe." > + fi > + 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 > -- > 2.5.5 > > -- > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core > -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end" --94eb2c06eda09635e4053ae693db Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Wed, Aug 17, 2016 at 1:25 AM, California Sullivan = <ca= lifornia.l.sullivan@intel.com> wrote:
The kernel being built should match what the recipe claims it is=
building. This function ensures that happens for anyone using
LINUX_VERSION as they should. As it will likely break outside kernels
not using LINUX_VERSION, only enable the function for linux-yocto for
now.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
I'm not absolutely sure this is the correct path to solve the issue. This patch relies on LINUX_VERSION being set which isn't a guarantee. There is probably a more general solution that I'm not thinking of.
=

I can't say that I know of all the opt= ions either, but I can ask questions and perhaps
others will = have more ideas.
=C2=A0

=C2=A0meta/classes/kernel.bbclass=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 21 +++++++++++++++++++++
=C2=A0meta/recipes-kernel/linux/linux-yocto.inc |=C2=A0 1 +
=C2=A02 files changed, 22 insertions(+)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index db42744..ac2611f 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -330,6 +330,27 @@ kernel_do_install() {
=C2=A0}
=C2=A0do_install[prefuncs] +=3D "package_get_auto_pr"

+# Must be ran some time after do_kernel_checkout or else Makefile won'= t be in ${S}/Makefile
+do_kernel_version_sanity_check() {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# The Makefile determines the kernel version sh= own at runtime
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# Don't use KERNEL_VERSION because the head= ers it grabs the version from aren't generated until do_compile
+=C2=A0 =C2=A0 =C2=A0 =C2=A0VERSION=3D$(grep "^VERSION =3D" ${S}/= Makefile | sed s/.*=3D\ //)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0PATCHLEVEL=3D$(grep "^PATCHLEVEL =3D"= ${S}/Makefile | sed s/.*=3D\ //)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0SUBLEVEL=3D$(grep "^SUBLEVEL =3D" ${S= }/Makefile | sed s/.*=3D\ //)

I was als= o trying to think of a way to avoid duplicating code that is yanking out ve= rsion
numbers, but yes if we depend on utsrelease, we also ha= ve to do some level of
building .. but that can actually be = pretty lightweight.

Have you tried just invoking the prep= are1 target in the kernel build ? That should
generate the u= tsrelease, and not much more.
=C2=A0
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# If SUBLEVEL is zero or doesn't exist we i= gnore it as VERSION.PATCHLEVEL is normal
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if [ -n "${SUBLEVEL}" ] && [ = "${SUBLEVEL}" !=3D "0" ]; then
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if [ "${VERSIO= N}.${PATCHLEVEL}.${SUBLEVEL}" !=3D "${LINUX_VERSION}" ]= ; then
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0bbfatal "LINUX_VERSION (${LINUX_VERSION}) does not match ker= nel being built (${VERSION}.${PATCHLEVEL}.${SUBLEVEL}).\nTo fix this c= orrect the LINUX_VERSION variable in your kernel recipe."

I know that I use LINUX_VERSION in the linux-yocto = recipes, but it isn't something
enforced or widespread (a= s far as I know). Since this is kernel.bbclass versus kernel-yocto.bbclass<= br>
should this be checking against PV versus LINUX_VERSION ? Alt= ernatively, this could just
move to kernel-yocto.bbclass as w= e try and make it more general.

Bruce

<= /div>
=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fi
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if [ "${VERSIO= N}.${PATCHLEVEL}" !=3D "${LINUX_VERSION}" ]; then
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0bbfatal "LINUX_VERSION (${LINUX_VERSION}) does not match ker= nel being built (${VERSION}.${PATCHLEVEL}).\nTo fix this correct the L= INUX_VERSION variable in your kernel recipe."
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fi
+=C2=A0 =C2=A0 =C2=A0 =C2=A0fi
+=C2=A0 =C2=A0 =C2=A0 =C2=A0exit 0
+}
+
=C2=A0addtask shared_workdir after do_compile before do_compile_kernelmodul= es
=C2=A0addtask 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(){
=C2=A0}

=C2=A0# extra tasks
+addtask kernel_version_sanity_check after do_kernel_checkout before do_com= pile
=C2=A0addtask kernel_link_images after do_compile before do_install
=C2=A0addtask validate_branches before do_patch after do_kernel_checkout =C2=A0addtask kernel_configcheck after do_configure before do_compile
--
2.5.5

--
_______________________________________________
Openembedded-core mailing list
Openembedded-co= re@lists.openembedded.org
http://lists.openembedded.org/m= ailman/listinfo/openembedded-core



--
"Thou shalt n= ot follow the NULL pointer, for chaos and madness await thee at its end&quo= t;
--94eb2c06eda09635e4053ae693db--