Bitbake sdk runing kernels menuconfig on cross compile chain

Hi all,

When I generate a bitbake sdk with

bitbake -k console-trdx-image -c populate_sdk

with all kernel code included and install the sdk, kernel compile works great.

However, if I want to call the menuconfig, The command line says:

root@embed-VirtualBox:/usr/local/oecore-x86_64/sysroots/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/usr/src/kernel# make colibri_vf_defconfig menuconfig 
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
  HOSTCC  scripts/kconfig/mconf.o
 ***** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.**
 *** 
 *** Install ncurses (ncurses-devel) and try again.
 *** 
make[2]: *** [scripts/kconfig/dochecklxdialog] Fehler 1
make[1]: *** [menuconfig] Fehler 2
make: *** [__build_one_by_one] Fehler 2

Does someone knows, how to get the menu to work? Do I miss something?

When I use

bitbake virtual/kernel -c menuconfig

This works like a charm, but I need the kernel compile available to cross compile some external drivers. Or is there another way?

Thanks in advance! - Tom

Hello,

Your host doesn’t have the ncurse libraries that are needed to launch menuconfig :

sudo apt-get install ncurses-devel

or ncurses-dev don’t remember the exact name.

Hi Vincent,

thanks for your answer, but yes, ncurses are installed (as stated: bitbake virtual/kernel -c menuconfig works correctly with ncurses)

As I can see, issue is, that the

source /usr/local/oecore-x86_64/environment-setup-armv7at2hf-vfp-neon-angstrom-linux-gnueabi

resets some library paths, so that ncurses of the host system is not used.

Is there a reason that you don’t use bitbake virtual/kernel -c menuconfig ?

As said: I need the compiled kernel and modules available to cross compile some external drivers. I am actually crosscompile the redpine wlan module and need the kernel sources and modules.

What I now do is I create the .config with bitbake and copy it to the sdk kernel directory. That works for the time being.

In my experience, it is easier to do this kind of “heavy kernel development” outside of OpenEmbedded/bitbake. OE is great to build rootfs, but during Linux kernel development, it seems to add more complexity than necessary.

We have a development article which shows how to cross compile the kernel directly using conventional methods:
http://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code

After development, when the changes are tested and proven, one can either commit them to a local git repository and point the OE recipe to the local git repository, or create a patch and add the patch to the OE recipe.

You could add the nativesdk-ncurses-dev package to the sdk build to get the ncurses developer headers deployed with the sdk, e.g. adding the following line to conf/local/conf

RDEPENDS_nativesdk-packagegroup-sdk-host_append = " nativesdk-ncurses-dev"

Probably this is enough to get the kernel host tools build-able for the make menuconfig case.


One other solution would probably be to not source the sdk environment script but instead use only the SDK compiler.
E.g. by setting the environment variables ARCH and CROSS_COMPILE.
Test that ARCH is empty to proof that the environment has not been sourced in the current process:

$ echo $ARCH

Set the environment for kernel compilation and make your config

cd /usr/local/oecore-x86_64/sysroots/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/usr/src/kernel
export ARCH=arm
export CROSS_COMPILE=arm-angstrom-linux-gnueabi-
PATH=$PATH:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi/
make colibri_vf_defconfig menuconfig

I had the same issue. If sourcing environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi building the kernel worked, but make menuconfig was broken. But if I only set ARCH, PATH and CROSS_COMPILE as suggested in Build U-Boot and Linux Kernel from Source Code the kernel won’t build:

Can't locate strict.pm in @INC (you may need to install the strict module) (@INC contains: //usr/lib/perl/site_perl/5.22.1 //usr/lib/perl/vendor_perl/5.22.1 //usr/lib/perl/5.22.1 /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/site_perl/5.22.1/ /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/site_perl/5.22.1 /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/vendor_perl/5.22.1/ /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/vendor_perl/5.22.1 /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/5.22.1/ /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/5.22.1 /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/lib/perl/5.22.1 .) at ./lib/build_OID_registry line 14.
BEGIN failed--compilation aborted at ./lib/build_OID_registry line 14.
make[1]: *** [lib/Makefile:195: lib/oid_registry_data.c] Error 2
make: *** [Makefile:950: lib] Error 2
make: *** Waiting for unfinished jobs....

For the latter to work I also had to specify OECORE_NATIVE_SYSROOT as specified in environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi.

And for the record: It is PKG_CONFIG_PATH in environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi which breaks make menuconfig.

My export file now looks like this:

export PATH=${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/usr/bin:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/usr/sbin:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/bin:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/sbin:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/usr/bin/../x86_64-angstromsdk-linux/bin:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-uclibc:${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-musl:$PATH
export OECORE_NATIVE_SYSROOT=${HOME}/oe-core/sdk.colibri_imx6/sysroots/x86_64-angstromsdk-linux
export ARCH=arm
export CROSS_COMPILE=arm-angstrom-linux-gnueabi-
export LOADADDR=10008000