Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Denys Dmytriyenko <denis@denix.org>
To: Anuj Mittal <anuj.mittal@intel.com>
Cc: Bruce Ashfield <bruce.ashfield@windriver.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [rocko][PATCH 2/2] make-mod-scripts: add build requirements for external modules
Date: Wed, 15 Aug 2018 20:26:36 -0400	[thread overview]
Message-ID: <20180816002636.GW19965@denix.org> (raw)
In-Reply-To: <20180728084950.13242-2-anuj.mittal@intel.com>

On Sat, Jul 28, 2018 at 04:49:50PM +0800, Anuj Mittal wrote:
> From: Bruce Ashfield <bruce.ashfield@windriver.com>
> 
> Newer kernels (4.14/v4.15+) have dependencies for the build of
> modules (and hence external modules). Without these dependencies
> explicitly in the build chain, you can end up with build failures like:
> 
>   work-shared/qemux86/kernel-source/scripts/extract-cert.c:21:25: fatal
>   error: openssl/bio.h: No such file or directory
>   |  #include <openssl/bio.h>
>   |                          ^
>   | compilation terminated.
>   | make[2]: *** [scripts/extract-cert] Error 1
>   | make[1]: *** [scripts] Error 2
> 
> To ensure that these headers are in place, and that the scripts use
> our build environment flags, we add a dependency on openssl-native
> and use oe_make to invoke the build.
> 
> Older kernels have no issues with the extra dependency, so there's no
> need to make this conditional.
> 
> (From OE-Core rev: 916cb2029d3c97bf12ebf03832b9ba980451dbcf)
> 
> Fixes [YOCTO #12860]
> 
> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> [Tweaked to have changes in module*.bbclass instead from where
> make-mod-scripts was split in sumo]
> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
> ---
>  meta/classes/module-base.bbclass | 5 ++++-
>  meta/classes/module.bbclass      | 2 +-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/module-base.bbclass b/meta/classes/module-base.bbclass
> index 64729770c7..9f3465eb9d 100644
> --- a/meta/classes/module-base.bbclass
> +++ b/meta/classes/module-base.bbclass
> @@ -12,6 +12,9 @@ export CROSS_COMPILE = "${TARGET_PREFIX}"
>  # we didn't pick the name.
>  export KBUILD_OUTPUT = "${STAGING_KERNEL_BUILDDIR}"
>  
> +DEPENDS += "bc-native"
> +EXTRA_OEMAKE += " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
> +
>  export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
>  KERNEL_OBJECT_SUFFIX = ".ko"
>  
> @@ -22,6 +25,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
>  # be called before do_compile. See module.bbclass for an example.
>  do_make_scripts() {
>  	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 
> -	make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
> +	oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
>  	           -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} scripts prepare

This now breaks out-of-tree kernel modules that provide own non-standard 
Makefiles with something like "-f build.mak" added to EXTRA_OEMAKE.

That is because do_make_scripts() gets executed inside kernel-source directory 
(-C ${STAGING_KERNEL_DIR} above) and supposed to use kernel's Makefile, while 
do_compile()/do_install() are executed within module's sources and use 
whatever Makefile it provides. That is why it historically was using "make" 
here and not "oe_runmake".

When Bruce separated this code into make-mod-scripts, it was possible to also 
use oe_runmake there, as it now had own context. But the backport to rocko 
moved it back into module-base.bbclass and it gets executed within module's 
environment, including custom EXTRA_OEMAKE, which often breaks (i.e. few of my 
modules are now broken).

Should this backport only touch DEPENDS and do_make_scripts[depends], as the 
changelog claims, and leave make/oe_runmake and EXTRA_OEMAKE alone?


>  }
> diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
> index 78d1b21dbd..282900dc6d 100644
> --- a/meta/classes/module.bbclass
> +++ b/meta/classes/module.bbclass
> @@ -2,7 +2,7 @@ inherit module-base kernel-module-split pkgconfig
>  
>  addtask make_scripts after do_prepare_recipe_sysroot before do_configure
>  do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
> -do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
> +do_make_scripts[depends] += "virtual/kernel:do_shared_workdir openssl-native:do_populate_sysroot"
>  
>  EXTRA_OEMAKE += "KERNEL_SRC=${STAGING_KERNEL_DIR}"
>  
> -- 
> 2.17.1
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


  reply	other threads:[~2018-08-16  0:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-28  8:49 [rocko][PATCH 1/2] make-mod-scripts/kernel-devsrc: Fix objtool issues Anuj Mittal
2018-07-28  8:49 ` [rocko][PATCH 2/2] make-mod-scripts: add build requirements for external modules Anuj Mittal
2018-08-16  0:26   ` Denys Dmytriyenko [this message]
2018-08-16  1:25     ` Denys Dmytriyenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180816002636.GW19965@denix.org \
    --to=denis@denix.org \
    --cc=anuj.mittal@intel.com \
    --cc=bruce.ashfield@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox