[10/10] kern-tools: fix merge_config when LD contains parameters

Submitted by Bruce Ashfield on Feb. 6, 2020, 5:35 p.m. | Patch ID: 169794

Details

Message ID fc9272a1b06a8efeb155b229967eb25ef4dff7c9.1581010425.git.bruce.ashfield@gmail.com
State Master Next
Commit 65f37bfceb9e0ad1ee469015d93a7f9de7ffec30
Headers show

Commit Message

Bruce Ashfield Feb. 6, 2020, 5:35 p.m.
From: Bruce Ashfield <bruce.ashfield@gmail.com>

To ensure that the kernel linker is used when allno/mod/yes config
merge_config steps were executed, the call to make was tweaked to
explicitly pass LD.

But since the variable wasn't quoted, any parameters to LD (like
the sysroot) were mistakenly passed to make, and hence could trigger
an error on some architectures.

We also tweak the logging to hightlight errors like this in the
future and avoid losing it in the noise of merge configs sometimes
overly verbose output.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 meta/classes/kernel-yocto.bbclass                      | 10 +++++++---
 .../recipes-kernel/kern-tools/kern-tools-native_git.bb |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 918d101d3d..31ea42580c 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -352,10 +352,14 @@  do_kernel_configme() {
 		bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
 	fi
 
-	CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs}
-
+	CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
 	if [ $? -ne 0 -o ! -f ${B}/.config ]; then
-		bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
+		bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}"
+		if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then
+			bbfatal_log "`cat ${meta_dir}/cfg/merge_config_build.log`"
+		else
+			bbfatal_log "Details can be found at: ${S}/${meta_dir}/cfg/merge_config_build.log"
+		fi
 	fi
 
 	if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
index f263421234..4f1af731d6 100644
--- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
+++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
@@ -4,7 +4,7 @@  LIC_FILES_CHKSUM = "file://tools/kgit;beginline=5;endline=9;md5=9c30e971d435e249
 
 DEPENDS = "git-native"
 
-SRCREV = "388b67974deb2176c06994a325676cbf23e5fce8"
+SRCREV = "c66833e1caac25279a5052fceb13213f5e4f79f9"
 PR = "r12"
 PV = "0.2+git${SRCPV}"
 

Comments

Martin Jansa Feb. 7, 2020, 2:19 p.m.
With the LD="${KERNEL_LD}" removed here, the build with ld-is-gold doesn't
work anymore again.

Why did you remove it?

On Thu, Feb 6, 2020 at 6:37 PM <bruce.ashfield@gmail.com> wrote:

> From: Bruce Ashfield <bruce.ashfield@gmail.com>
>
> To ensure that the kernel linker is used when allno/mod/yes config
> merge_config steps were executed, the call to make was tweaked to
> explicitly pass LD.
>
> But since the variable wasn't quoted, any parameters to LD (like
> the sysroot) were mistakenly passed to make, and hence could trigger
> an error on some architectures.
>
> We also tweak the logging to hightlight errors like this in the
> future and avoid losing it in the noise of merge configs sometimes
> overly verbose output.
>
> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> ---
>  meta/classes/kernel-yocto.bbclass                      | 10 +++++++---
>  .../recipes-kernel/kern-tools/kern-tools-native_git.bb |  2 +-
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/kernel-yocto.bbclass
> b/meta/classes/kernel-yocto.bbclass
> index 918d101d3d..31ea42580c 100644
> --- a/meta/classes/kernel-yocto.bbclass
> +++ b/meta/classes/kernel-yocto.bbclass
> @@ -352,10 +352,14 @@ do_kernel_configme() {
>                 bbfatal_log "Could not find configuration queue
> (${meta_dir}/config.queue)"
>         fi
>
> -       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC}
> ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}"
> LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags}
> ${configs}
> -
> +       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC}
> ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}"
> ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} >
> ${meta_dir}/cfg/merge_config_build.log 2>&1
>         if [ $? -ne 0 -o ! -f ${B}/.config ]; then
> -               bbfatal_log "Could not configure
> ${KMACHINE}-${LINUX_KERNEL_TYPE}"
> +               bberror "Could not generate a .config for
> ${KMACHINE}-${LINUX_KERNEL_TYPE}"
> +               if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then
> +                       bbfatal_log "`cat
> ${meta_dir}/cfg/merge_config_build.log`"
> +               else
> +                       bbfatal_log "Details can be found at:
> ${S}/${meta_dir}/cfg/merge_config_build.log"
> +               fi
>         fi
>
>         if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
> diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> index f263421234..4f1af731d6 100644
> --- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> +++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> @@ -4,7 +4,7 @@ LIC_FILES_CHKSUM =
> "file://tools/kgit;beginline=5;endline=9;md5=9c30e971d435e249
>
>  DEPENDS = "git-native"
>
> -SRCREV = "388b67974deb2176c06994a325676cbf23e5fce8"
> +SRCREV = "c66833e1caac25279a5052fceb13213f5e4f79f9"
>  PR = "r12"
>  PV = "0.2+git${SRCPV}"
>
> --
> 2.19.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
Bruce Ashfield Feb. 7, 2020, 2:45 p.m.
On Fri, Feb 7, 2020 at 9:20 AM Martin Jansa <martin.jansa@gmail.com> wrote:
>
> With the LD="${KERNEL_LD}" removed here, the build with ld-is-gold doesn't work anymore again.
>
> Why did you remove it?

I removed it by mistake, and fixed it .. but apparently sent the wrong
version of the patch.

I'll send a v2 shortly!

Bruce

>
> On Thu, Feb 6, 2020 at 6:37 PM <bruce.ashfield@gmail.com> wrote:
>>
>> From: Bruce Ashfield <bruce.ashfield@gmail.com>
>>
>> To ensure that the kernel linker is used when allno/mod/yes config
>> merge_config steps were executed, the call to make was tweaked to
>> explicitly pass LD.
>>
>> But since the variable wasn't quoted, any parameters to LD (like
>> the sysroot) were mistakenly passed to make, and hence could trigger
>> an error on some architectures.
>>
>> We also tweak the logging to hightlight errors like this in the
>> future and avoid losing it in the noise of merge configs sometimes
>> overly verbose output.
>>
>> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
>> ---
>>  meta/classes/kernel-yocto.bbclass                      | 10 +++++++---
>>  .../recipes-kernel/kern-tools/kern-tools-native_git.bb |  2 +-
>>  2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
>> index 918d101d3d..31ea42580c 100644
>> --- a/meta/classes/kernel-yocto.bbclass
>> +++ b/meta/classes/kernel-yocto.bbclass
>> @@ -352,10 +352,14 @@ do_kernel_configme() {
>>                 bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
>>         fi
>>
>> -       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs}
>> -
>> +       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
>>         if [ $? -ne 0 -o ! -f ${B}/.config ]; then
>> -               bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}"
>> +               bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}"
>> +               if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then
>> +                       bbfatal_log "`cat ${meta_dir}/cfg/merge_config_build.log`"
>> +               else
>> +                       bbfatal_log "Details can be found at: ${S}/${meta_dir}/cfg/merge_config_build.log"
>> +               fi
>>         fi
>>
>>         if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
>> diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
>> index f263421234..4f1af731d6 100644
>> --- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
>> +++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
>> @@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://tools/kgit;beginline=5;endline=9;md5=9c30e971d435e249
>>
>>  DEPENDS = "git-native"
>>
>> -SRCREV = "388b67974deb2176c06994a325676cbf23e5fce8"
>> +SRCREV = "c66833e1caac25279a5052fceb13213f5e4f79f9"
>>  PR = "r12"
>>  PV = "0.2+git${SRCPV}"
>>
>> --
>> 2.19.1
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Martin Jansa Feb. 7, 2020, 2:46 p.m.
Awesome, thanks!

On Fri, Feb 7, 2020 at 3:45 PM Bruce Ashfield <bruce.ashfield@gmail.com>
wrote:

> On Fri, Feb 7, 2020 at 9:20 AM Martin Jansa <martin.jansa@gmail.com>
> wrote:
> >
> > With the LD="${KERNEL_LD}" removed here, the build with ld-is-gold
> doesn't work anymore again.
> >
> > Why did you remove it?
>
> I removed it by mistake, and fixed it .. but apparently sent the wrong
> version of the patch.
>
> I'll send a v2 shortly!
>
> Bruce
>
> >
> > On Thu, Feb 6, 2020 at 6:37 PM <bruce.ashfield@gmail.com> wrote:
> >>
> >> From: Bruce Ashfield <bruce.ashfield@gmail.com>
> >>
> >> To ensure that the kernel linker is used when allno/mod/yes config
> >> merge_config steps were executed, the call to make was tweaked to
> >> explicitly pass LD.
> >>
> >> But since the variable wasn't quoted, any parameters to LD (like
> >> the sysroot) were mistakenly passed to make, and hence could trigger
> >> an error on some architectures.
> >>
> >> We also tweak the logging to hightlight errors like this in the
> >> future and avoid losing it in the noise of merge configs sometimes
> >> overly verbose output.
> >>
> >> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> >> ---
> >>  meta/classes/kernel-yocto.bbclass                      | 10 +++++++---
> >>  .../recipes-kernel/kern-tools/kern-tools-native_git.bb |  2 +-
> >>  2 files changed, 8 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/meta/classes/kernel-yocto.bbclass
> b/meta/classes/kernel-yocto.bbclass
> >> index 918d101d3d..31ea42580c 100644
> >> --- a/meta/classes/kernel-yocto.bbclass
> >> +++ b/meta/classes/kernel-yocto.bbclass
> >> @@ -352,10 +352,14 @@ do_kernel_configme() {
> >>                 bbfatal_log "Could not find configuration queue
> (${meta_dir}/config.queue)"
> >>         fi
> >>
> >> -       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC}
> ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}"
> LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags}
> ${configs}
> >> -
> >> +       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC}
> ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}"
> ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} >
> ${meta_dir}/cfg/merge_config_build.log 2>&1
> >>         if [ $? -ne 0 -o ! -f ${B}/.config ]; then
> >> -               bbfatal_log "Could not configure
> ${KMACHINE}-${LINUX_KERNEL_TYPE}"
> >> +               bberror "Could not generate a .config for
> ${KMACHINE}-${LINUX_KERNEL_TYPE}"
> >> +               if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then
> >> +                       bbfatal_log "`cat
> ${meta_dir}/cfg/merge_config_build.log`"
> >> +               else
> >> +                       bbfatal_log "Details can be found at:
> ${S}/${meta_dir}/cfg/merge_config_build.log"
> >> +               fi
> >>         fi
> >>
> >>         if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then
> >> diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> >> index f263421234..4f1af731d6 100644
> >> --- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> >> +++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
> >> @@ -4,7 +4,7 @@ LIC_FILES_CHKSUM =
> "file://tools/kgit;beginline=5;endline=9;md5=9c30e971d435e249
> >>
> >>  DEPENDS = "git-native"
> >>
> >> -SRCREV = "388b67974deb2176c06994a325676cbf23e5fce8"
> >> +SRCREV = "c66833e1caac25279a5052fceb13213f5e4f79f9"
> >>  PR = "r12"
> >>  PV = "0.2+git${SRCPV}"
> >>
> >> --
> >> 2.19.1
> >>
> >> --
> >> _______________________________________________
> >> 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
> - "Use the force Harry" - Gandalf, Star Trek II
>