|Version 25 (modified by Ben, 13 months ago) (diff)|
The SHR distribution is put together using the OpenEmbedded software framework.
Although it may seem initially daunting for new users, it is actually a very simple and effective way of creating a custom Linux distro. The basic idea behind OpenEmbedded comes from the fact that a Linux distribution is generally put together from lots of different software packages, where specific versions must be downloaded and compiled, and the resulting binaries written to specific places in a Linux file system. OpenEmbedded allows us to automate this process through the use of configuration files and a powerful python script called BitBake which can parse each file and perform the necessary actions. In the configuration files we are able to specify for each package, details such as where the source code can be obtained, and which version should be compiled. BitBake is also able to apply patches and take care of cross compiling for specific architectures and create opkg software archives for each package as well as write complete filesystem images.
in order to build SHR we need to download all the files which have been created by the SHR developers for their software along with the configuration files from OpenEmbedded for the rest of the distro and then we need to run the BitBake program to read these files, obtain the sources and compile them into binaries. In addition to this, many SHR users and developers prefer to do the whole thing inside a chroot jail which contains specific build tools, in order to provide a standard environment regardless of the underlying host. In this case we may also need to download and configure all the files and directories which will be inside the jail. Most of this can be taken care of by a universal Makefile which is maintained by the SHR team, and this makes the whole process very simple.
Setting up the build environment
The first step in building SHR is to set up the build system by downloading all the necesarry OpenEmbedded and SHR files and tools using one of the following methods:
chroot method (recommended)
In order to download and configure all the necesarry files and packages to begin building SHR, it is recomended that the chroot method is used. Instructions on how to do this using the SHR Makefile can be found at: http://shr-project.org/trac/wiki/Building_SHR_with_chroot
The instructions for setting up the build system without a chroot can be found at: http://shr-project.org/trac/wiki/Building_SHR_without_chroot
Open the file shr-core/conf/local.conf with a text editor.
Enable this option if you have multiple cores:
PARALLEL_MAKE = "-j 4" BB_NUMBER_THREADS = "4"
To avoid multiple locales generation, add:
GLIBC_GENERATE_LOCALES = "en_US.UTF-8 en_GB.UTF-8 cs_CZ.UTF-8"
and you also need to set IMAGE_LINGUAS accordingly
IMAGE_LINGUAS = "en-us en-gb cs-cz"
In order to speed up the whole build you can disable locale generation altogether (You can't build an shr image without the en_US.UTF-8 locale, so this is only for building single packages):
ENABLE_BINARY_LOCALE_GENERATION = "0"
The SHR Makefile sets the environment up to build for the OM-GTA02 device so if you wish to complile SHR for the FreeRunner? you can use the following command:
bitbake -k shr-image
To compile for other devices you can prefix MACHINE before bitbake command:
MACHINE=om-gta01 bitbake shr-image # for n900 use MACHINE=nokia900
Or you can change it in setup-local (and run ". ./setup-env").