Buildroot - menuconfig creates config, but won't make - makefile

I'm trying to use buildroot to create a cross-compiler toolchain for MIPS64 (little endian).
I have run make menuconfig and have set the target to MIPS64 (little endian). Also I am being told that the config file has been generated and I can run make (as below)
configuration written to /home/blah/Downloads/buildroot-2018.02.6/mipsel64.config
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
So, I then run make and I get the following:
Makefile:864: *** Please configure Buildroot first (e.g. "make menuconfig"). Stop.
Any ideas?

Try to copy your buildroot config file to .config file in your buildroot directory. It may look like:
cp /home/blah/Downloads/buildroot-2018.02.6/mipsel64.config /home/blah/Downloads/buildroot-2018.02.6/.config
assuming that /home/blah/Downloads/buildroot-2018.02.6/ is your buildroot compilation directory.
Then try to do make.

Don't ask menuconfig to save to a file, just exit and answer Yes when asked Do you wish to save your new configuration?. This way it will save a file named .config, which is exactly the file neeeded for building.

Related

How can i setup meson and ninja on Ubuntu-Linux to produce the expected .a file by use of MakeFile?

Some years ago on Ubuntu 16.0.4 I've used this library: git clone https://github.com/Beckhoff/ADS and using only the make command I got build, compile and finally on the main directory I found a file called AdsLib-Linux.a and maybe nothing more than this.
Now I'm on Ubuntu 20.04 I need this library once again but this times make dosn't produce the same output and looking forth to the ReadMe instructions I finally used that instead of make:
meson build
ninja -C build
That now create a new directory build but no .a file as before on the root directory. Instead a new file in the build directory libADSLib.a is there. The same thing happens using right the make command.
Maybe the author changed over the years something on the config files or the behavior of the tools have changed, but I cannot get the former file anymore and I need it for other referencing code that now is not executing anymore.
Looking to the MakeFile I found that in the example folder, differently from the one on the parent directory, the MakeFile has something like that:
$(warning ATTENTION make is deprecated and superseeded by meson)
...
${PROGRAM}: LIB_NAME = ../AdsLib-${OS_NAME}.a
...
But all i've tried reading the guides on meson and ninja about setup, configure, build, and so on, did not produce anymore that file.
I've tried also to first build and then copy all files form the example folder to the parent directory and then build again, but again no .a file there.
How's the right way to configure the build process corectly so that this -Linux.a file is created. Or if not possibile anymore, what does it now produce I can use instead of what produced before?
Meson is a build system generator, similar to CMake or somewhat like ./configure, you need to run meson, then run ninja to actually build something.
You need to run both meson and ninja:
meson setup builddir
ninja -C builddir
Once you do that successfully, there will be a libAdsLib.a inside the builddir directory.
Let me correct a bit #dcbaker, according to their README you should setup build as build directory:
# configure meson to build the library into "build" dir
meson build
# let ninja build the library
ninja -C build
Of course, in general, it shouldn't be specific, but their example code is written in a weird way so this path is hard-coded. So, to use the example:
# configure meson to build example into "build" dir
meson example/build example
# let ninja build the example
ninja -C example/build
# and run the example
./example/build/example
About the library: it's now libAdsLib.a and produced in build directory. The name is set here and it's now in linux naming style, the old one - not. So, you have options:
Update your configuration/build files (Makefile?) where you use it
Copy or make symbolic link, e.g.
$ ln -s <>/build/libAdsLib.a <target_path>/AdsLib-Linux.a
Above it's very dependent on your development environment, do you have installation or setup scripts for it? do you permissions to modify/configure parameters for target application? do you need to support both old and new names? - many questions not related to original question about meson.

Buildroot linux kernel clean build

I am using buildroot to build linux firmware. How can I do a clean rebuild the linux kernel only (without having to build the whole thing which take an hour)?
I tried -
make linux-rebuild
but that does not do a clean.
I have also tried
make linux-reconfigure && make linux-rebuild
but that does not work either.
If you want to remove all of the changes in sources of the linux kernel be in buildroot directory (cd buildroot) and do following:
make linux-dirclean
make linux-rebuild
The first command will remove output/build/linux* directory and the second one will fetch and rebuild from scratch the kernel.
I've found in the buildroot /dl folder a copy of the kernel repo is stored in there as a tar.gz file. If you do not delete that file, buildroot will not pull any kernel updates.
after reading a lot through buildroot manual and trail and error - this is what you need to do for cleaning of linux only -
make clean linux

Getting kernel config from defconfig

The title says it all: I need the .config file that was used for compiling a kernel, but all I have is the defconfig file. I've seen instructions on how to produce the latter from the former, but not the other way around. Is it possible?
If you know the base config against which your defconfig file was generated, you can merge against it. Kernel version doesn't have to be exactly the same - new options will stay on default.
Assuming the base which your defconfig file was generated against was x86_64_defconfig (most likely) and you just have copied it into the linux source tree:
$ make mrproper
$ scripts/kconfig/merge_config.sh defconfig
If there are no errors, the .config file is now ready and you can run make to build the kernel.
For further help run $ scripts/kconfig/merge_config.sh -h or peek into the script.
You can't.
defconfig files are basic and minimalist config for one target architecture, and are just a starting point used to define a real .config.
You can instead retrieve .config used by other ways : look here on super-user

How can I extract the environment variables used when building a recipe in Yocto?

I am working on a kernel module for a project using Yocto Linux (version 1.3). I want to use the kernel headers and the compiler and libraries from my Yocto project, but develop the kernel module without needing to run bitbake every time. My initial solution to this was to execute the devshell task and extract the environment variables using something like this:
bitbake mykernel -c devshell
Then in the new xterm window bitbake opened for me:
env | sed 's/\=\(.*\)/\="\1"/' > buildenv #put quotes around r-values in env listing
^D #(I leave the devshell)
Then copy this to my development directory and source it before running make with all of its options
KERNEL_PATH=/mypathto/build/tmp/sysroots/socfpga_cyclone5/usr/src/kernel
source ./buildenv && make -C $KERNEL_PATH V=1 M=`pwd` \
ARCH=arm CROSS-COMPILE=arm-linux-gnueabihf- \
KERNEL_VERSION=3.13.0-00298-g3c7cbb9 \
CC="arm-linux-gnueabihf-gcc -mno-thumb-interwork -marm" \
LD=arm-linux-gnueabihf-ld AR=arm-linux-gnueabihf-ar
Now to my questions:
Am I going about this completely wrong? What is the recommended way to cross-develop kernel modules? I am doing it this way because I don't want to open a bitbake devshell and do my code development in there every time.
This sort of works (I can compile working modules) but the make script gives me an error message saying that the kernel configuration is invalid. I have also tried this with KERNEL_PATH set to the the kernel package git directory (build/tmp/work///git (which contains what appears to be a valid .config file) and I get a similar error.
How can I extract the env without needing to open a devshell? I would like to write a script that extracts it so my coworkers don't have to do it manually. The devshell command opens a completely separate Xterm window, which rather dampens its scriptability...
the sdk installer is what you are looking for:
bitbake your-image -c populate_sdk
then, from your build directory go to tmp/deploy/sdk
and execute the generated shell script.
this script will allow you to generate and install an sdk.
Not only the sdk will allow you to (cross) compile your kernel by providing the needed environment variables and tools, but it will also provide a sysroot + a standalone toolchain to help you easily (and by easily I mean really easily) crosscompile applications with the autotools (as long as you provide Makefile.am and configure.ac)
just source the environment-setup-* file, got to your kernel directory and compile.
Or, for application developpment based on the autotools,
go to the folder containing your project (sources + Makefile.am and configure.ac)
and do:
libtoolize --automake
aclocal
autoconf
automake -a
now your project is ready for compilation:
./configure $CONFIGURE_FLAGS
make
make install DESTDIR=path/to/destination/dir
If you're after a quick hack, instead of Ayman's more complete solution, the scripts run to complete each build stage are available in the directory:
./build/tmp/work/{target_platform}/{package}/{version}/temp/run.do_{build_stage}
These scripts can be run standalone from the ./temp/ directory, and contain all of the environment variables required.

Kernel recompiled with same config but: cpufreq: no nforce2 chipset error

I need to compile an old kernel 2.6.23 (downloaded from linuxkernels.com) in order to use it with a real time patch (it's a long story...), I installed ubuntu 10.04 which has a kernel 2.6.32-43-generic-pae.
I decided to simple copy ubuntu configuration:
cp cp /boot/config-2.6.32-43-generic-pae /usr/src/linux-2.6.23/.config
I recompile the kernel:
make menuconfig
make
make install
make modules_install
mkinitramfs -o /boot/initrd.img-2.6.23-MYVER 2.6.23-MYVER
note that in the config I make this edit: I remove the module versioning support under loadable modules section. (this step is required by the patch).
At start, I get the title error:
cpufreq: no nforce2 chipset error
how it possible, since I copied a working configuration? Maybe is because of that only flag I disable?
Not sure, but when I copy an existing .config, I run "make oldconfig" first to make sure I'm all sync'd up. Then I run make menuconfig if I want to interactively review/change any settings.

Resources