Poky Linux distribution provides SDK for quite
long time. From time to time I hear persons which complain about lack of libX
or libY in toolchain tarballs. But there is a solution for them — Poky SDK can
be expanded with packages.
Installation
This is described
in Poky Handbook already:
The meta-toolchain and meta-toolchain-sdk targets (see the images section)
build tarballs which contain toolchains and libraries suitable for application
development outside Poky. These unpack into the /usr/local/poky directory and
contain a setup script, e.g. /usr/local/poky/eabi-glibc/arm/environment-setup
which can be sourced to initialise a suitable environment. After sourcing this,
the compiler, QEMU scripts, QEMU binary, a special version of pkgconfig and
other useful utilities are added to the PATH. Variables to assist pkgconfig and
autotools are also set so that, for example, configure can find pre-generated
test results for tests which need target hardware to run.
Using the toolchain with autotool enabled packages is straightforward, just
pass the appropriate host option to configure e.g. “./configure
—host=arm-poky-linux-gnueabi”. For other projects it is usually a case of
ensuring the cross tools are used e.g. CC=arm-poky-linux-gnueabi-gcc and
LD=arm-poky-linux-gnueabi-ld.
Extending SDK
So you want to build GTK+ based application but “configure” tells you that you
miss GTK+ headers? In normal systems you would install development packages.
Same is with Poky SDK, but due to fact that there are no repositories for Poky a
bit more work is needed.
You will need contents of “tmp/deploy/ipk/” from other developer or from local
Poky build. I have them from local build and they are stored in
“/home/hrw/devel/OH/poky/trunk/build/tmp/deploy/ipk” directory.
Next step is editing opkg configuration file (stored in /usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/etc/opkg.conf) to add feeds locations. With my packages it looks like this:
arch all 1
arch any 6
arch noarch 11
arch arm 16
arch armv4 21
arch armv4t 26
arch armv5te 31
arch qemuarm 36
src oe-all file:/home/hrw/devel/OH/poky/trunk/build/tmp/deploy/ipk/all
src oe-armv5te file:/home/hrw/devel/OH/poky/trunk/build/tmp/deploy/ipk/armv5te
Now it is time to install those missing headers: opkg-target update
will
update list of available packages and opkg-target install gtk+-dev
install
required headers.
Building software
Hello world
First something really simple: helloworld.c. Run arm-poky-linux-gnueabi-gcc
hello.c -o hello
. Result will be ARM binary:
14:14 hrw@home:$ file hello hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), not stripped
Autoconf based application
I took Tasks 0.13 as an example as it use some libraries not present in
standard toolchain. After unpacking and starting ./configure
--host=arm-poky-linux-gnueabi
I got message that GTK+ headers are missing so I
installed them with opkg-target install gtk+-dev
(like it is described).
After next “configure” call there was message about missing “libecal” which is
part of “eds-dbus” so opkg-target install eds-dbus-dev
solved problem.
Finally “configure” does not give any errors and make
call built application:
14:19 hrw@home:tasks-0.13$ file src/gtk/tasks
src/gtk/tasks: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), not stripped
Summary
As you see Poky SDK is not limited to default set of packages but can be
extended with additional ones. OK, someone needs to build them first but imagine
situation when company has 10 developers — one has Poky build tree which he use
to generate packages which can be used by rest of team without spending precious
time on building.
BTW — It is not limited to Poky SDK. Other OpenEmbedded based systems should be
more or less capable of doing such things.