[OE-core] [PATCH] kernel-yocto: do_kernel_configme: Fix silent sysroot poisoning error

Ioan-Adrian Ratiu adrian.ratiu at ni.com
Mon Aug 29 13:51:38 UTC 2016


On Mon, 29 Aug 2016, Bruce Ashfield <bruce.ashfield at gmail.com> wrote:
> On Mon, Aug 29, 2016 at 9:14 AM, Ioan-Adrian Ratiu <adrian.ratiu at ni.com>
> wrote:
>
>> On Mon, 29 Aug 2016, Bruce Ashfield <bruce.ashfield at gmail.com> wrote:
>> > On Mon, Aug 29, 2016 at 5:19 AM, Ioan-Adrian Ratiu <adrian.ratiu at ni.com>
>> > wrote:
>> >
>> >> do_kernel_configme calls merge_config.sh (installed in the sysroot by
>> >> the kern-tools-native recipe) which calls make to fill in any missing
>> >> symbols from the resulting merged config.
>> >
>> >
>> > That's not what it does ... but that isn't important.
>>
>> Can you please explain in a simple sentence what it does?
>>
>
> It concatenates/merges configuration fragments.
>
> The need to run make, or fill in any additional symbols is the optional
> behaviour
> of the script and isn't the essential service of what it provides. Since
> for the
> most part, it does very little if well specified configs and defconfigs are
> passed.

Even if it is an optional behaviour, this is exactly what make does, so
I don't know how I mistated what it does (it fills in missing symbols).
This is exactly what I said.

The important issue is that it can fail and if it can fail then we need
to check its return code. Isn't this true?



>
>
>>
>> >
>> >
>> >>
>> >> This errors out on my system because of sysroot poisoning [1]. Here is
>> >> a partial output from my .kernel-meta/cfg/merge_config_build.log (this
>> >> file is created in do_kernel_configme() while callig merge_config.sh):
>> >>
>> >> make[1]: Entering directory '/media/adi/ssd/nilrt-master/
>> >> build/tmp-glibc/work/x64-nilrt-linux/linux-nilrt/4.1+
>> >> gitAUTOINC+a7e53ecc27-r0/linux-x64-standard-build'
>> >>   HOSTCC  scripts/basic/fixdep
>> >> /media/adi/ssd/nilrt-master/build/tmp-glibc/work-shared/
>> >> x64/kernel-source/scripts/basic/fixdep.c:106:23: fatal error:
>> >> sys/types.h: No such file or directory
>> >> compilation terminated.
>> >> make[2]: *** [/media/adi/ssd/nilrt-master/build/tmp-glibc/work-shared/
>> >> x64/kernel-source/scripts/basic/Makefile:22:
>> scripts/basic/x86_64-nilrt-linux-fixdep]
>> >> Error 1
>> >>
>> >
>> > This just means that we are missing a dependency. Everything that
>> > merge_config
>> > needs should be already in place before it runs, i.e. do_kernel_metadata
>> > should
>> > have already run and built any host tools that it needs.
>>
>> This is not a missing dependency. The problem is the make command called
>> in merge_configs fails silently because of a misconfigured sysroot. The
>> correct sysroot is in the TOOLCHAIN_OPTIONS variable and it does not get
>> passed to the make call in merge_configs.
>>
>
> That's my definition of a missing dependency. The host tools should already
> exist before
> merge_config ever runs. It shouldn't need to build anything.
>
>
>>
>> >
>> > How are you managing to trigger this error ? I've done plenty of builds,
>> > and haven't
>> > seen this one before.
>>
>> Every one of my builds error out in that make call from merge_config
>> without this change because make does not search in the correct sysroot.
>>
>>
> So there's something drastically different. I've done hundreds of builds
> before
> and after my changes to the kern tools.
>
> I need to understand what is different.
>
> What's your configuration ? Are you building linux-yocto, or something else
> ?
> (so I can run the same build here.)
>
> Bruce
>
>
>> >
>> > Bruce
>> >
>> >
>> >>
>> >> This issue is hard to debug because merge_config.sh does NOT check the
>> >> error output of its make call (this is added in the second patch) and
>> >> even though make errors out, the build continues as if nothing happened
>> >> and compiles a kernel with garbage configs (the .config generated by
>> >> do_kernel_configme is empty and gets filled later) which doesn't boot.
>> >>
>> >> Adding $TOOLCHAIN_OPTIONS to $CFLAGS before calling merge_configs.sh
>> >> fixes the error because $TOOLCHAIN_OPTIONS defines the sysroot and make
>> >> uses it to correctly compile & fill all missing kernel config options.
>> >>
>> >> [1] http://lists.openembedded.org/pipermail/openembedded-core/
>> >> 2014-October/098253.html
>> >>
>> >> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu at ni.com>
>> >> ---
>> >>  meta/classes/kernel-yocto.bbclass | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/meta/classes/kernel-yocto.bbclass
>> >> b/meta/classes/kernel-yocto.bbclass
>> >> index 8650e55..4397a9d 100644
>> >> --- a/meta/classes/kernel-yocto.bbclass
>> >> +++ b/meta/classes/kernel-yocto.bbclass
>> >> @@ -249,7 +249,7 @@ do_kernel_configme() {
>> >>                 bbfatal_log "Could not find configuration queue
>> >> (${meta_dir}/config.queue)"
>> >>         fi
>> >>
>> >> -       ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs}
>> >
>> >> ${meta_dir}/cfg/merge_config_build.log 2>&1
>> >> +       CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" ARCH=${ARCH}
>> >> merge_config.sh -O ${B} ${config_flags} ${configs} >
>> >> ${meta_dir}/cfg/merge_config_build.log 2>&1
>> >>         if [ $? -ne 0 ]; then
>> >>                 bbfatal_log "Could not configure
>> >> ${KMACHINE}-${LINUX_KERNEL_TYPE}"
>> >>         fi
>> >> --
>> >> 2.9.3
>> >>
>> >>
>> >
>> >
>> > --
>> > "Thou shalt not follow the NULL pointer, for chaos and madness await thee
>> > at its end"
>>
>
>
>
> -- 
> "Thou shalt not follow the NULL pointer, for chaos and madness await thee
> at its end"



More information about the Openembedded-core mailing list