[Buildroot] Is there an equivalent of yocto's devshell?
arnout at mind.be
Thu Sep 1 20:53:54 UTC 2016
On 01-09-16 09:20, Ottavio Campana wrote:
>>> Particularly, I am not able to find if buildroot offers a feature
>>> similar to the devshell of yocto. The devshell is a shell with all the
>>> environment variables already set, so that it is possibile to invoke
>>> commands such as make in the same way that the build process does. By
>>> working in the devshell, a developer can work already in the correct
>>> environment for cross-compiling, which can save a lot of time.
>>> Does something similar to the devshell exist in buildroot?
>> I have never used this 'devshell', but I take it that it is something
>> that adds the cross compiler to the path and possibly sets up some
>> environment variables like CC/CXX/CROSS_COMPILE/ARCH to point to the
>> cross compiler?
>> If so, we don't have anything quite like that, but writing a little
>> shell script for your project adding output/host/usr/bin to your path
>> and exporting those environment variables shouldn't take many minutes.
>> Or does it do something more special than that?
> Well, le'ts say that it configures the not only the cross compiler but it also sets all the variables for pointing to the staging environment for finding includes and linking to libraries. Compiling a self contained program is trivial, but when you need to include different libraries things start to be more difficult.
The toolchain is wrapped to make sure it points to the correct sysroot. So just
calling output/usr/bin/<cross>-gcc is enough. Same for pkg-config:
output/usr/bin/pkg-config is a wrapper script that sets the correct environment
There is still a pretty long list of variables that buildroot passes down to
the build system. You can find it in package/Makefile.in:
TARGET_CONFIGURE_OPTS = \
Obviously, you won't need the majority of them for a particular build.
Whenever you build a package based on autotools or make, you'll see that
environment appearing in the build output, so you can cut and paste from there.
Alternatively, you can run 'make printvars' and extract the
TARGET_CONFIGURE_OPTS environment variable.
As Zoltan mentioned further down, qmake-based packages can directly use
output/host/usr/bin/qmake. For cmake-based packages, use
However, as Thomas explains further down, it's really a lot simpler to make a
package/foo/foo.mk file. If all you want to do is to build and not bother with
installation or dependencies or anything like that, it can be really simple:
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
That should be enough, and you can build with:
make foo FOO_OVERRIDE_SRCDIR=path/to/src
You don't even have to create a different foo.mk for different packages - but
make sure you clean up the build directory between builds.
> I can write the script, but can you tell my where I can find all the variables that are set by buildroot before compiling a package?
> Thank you
> buildroot mailing list
> buildroot at busybox.net
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
More information about the buildroot