An official way to add a software package using Yocto is to add a new layer if there is no recipe existing for this package. Then baking the whole image should have it included. However, we are not going to take about it in this post, where we will examine how to make the Wifi work and/or cross compile the code in the development server.
1. Compile locally
One would expect to have gcc installed in the rootfs (console-image) but it is not. As usual, the corresponding recipe could be added into the image. However, if the gumstix is equipped with a wifi adaptor, bringing it online may be a good idea as well if the corresponding package manager (e.g., opkg) is installed already.
This link (http://wiki.gumstix.org/index.php?title=Overo_Wifi) provides all the information to configure wifi connection. Note that the example is WPA2 in the wpa_supplicant. I have tried WPA-EAP, which is only supported by my wifi environment, but failed – wpa_supplicant parsing failure. I was using Gumstix Overo and Yocto 1.6 Daisy. It is not clear if newer Yocto Gumstix layer would support WPA-EAP (I am highly suspicious not). The workaround is simple as long as you have a smartphone supporting hotspot. Yep, configure the hotspot to make it WPA2 only and you have got it.
2. Cross-compile in the development server
Believe it or not – the best way working for me is cross-compile in the development server. This link (https://github.com/gumstix/yocto-manifest/wiki/Cross-Compile-with-Yocto-SDK) has everything. Note that the SDK provided by the Gumstix team is based on Yocto 1.8. If you are not using this version, build your own SDK:
bitbake gumstix-console-image -c populate_sdk
One tricky thing before starting the cross-compile is the Makefile. The environment gets reset for the ARM gcc after the environment script is sourced. This means, on one hand, any env variables reseting in the Makefile would break the cross-compile and fall back to native-compile. These env variables include CC, CFLAGS, LDFLAGS and etc. On the other hand, this new Makefile is much more simpler.
# Makefile for provd # using Yocto cross compile # Sep 1, 2015 # email@example.com # http://davejingtian.org # NOTE: # Do NOT change CC,CFLAGS,LDFLAGS OBJS = provd.o nlm.o provmem.o provd : $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@