1.2. Building an SDK Installer

As an alternative to locating and downloading an SDK installer, you can build the SDK installer. Follow these steps:

  1. Set Up the Build Environment: Be sure you are set up to use BitBake in a shell. See the "Preparing the Build Host" section in the Yocto Project Development Tasks Manual for information on how to get a build host ready that is either a native Linux machine or a machine that uses CROPS.

  2. Clone the poky Repository: You need to have a local copy of the Yocto Project Source Directory (i.e. a local poky repository). See the "Cloning the poky Repository" and possibly the "Checking Out by Branch in Poky" and "Checking Out by Tag in Poky" sections all in the Yocto Project Development Tasks Manual for information on how to clone the poky repository and check out the appropriate branch for your work.

  3. Initialize the Build Environment: While in the root directory of the Source Directory (i.e. poky), run the oe-init-build-env environment setup script to define the OpenEmbedded build environment on your build host.

         $ source oe-init-build-env
                    

    Among other things, the script creates the Build Directory, which is build in this case and is located in the Source Directory. After the script runs, your current working directory is set to the build directory.

  4. Make Sure You Are Building an Installer for the Correct Machine: Check to be sure that your MACHINE variable in the local.conf file in your Build Directory matches the architecture for which you are building.

  5. Make Sure Your SDK Machine is Correctly Set: If you are building a toolchain designed to run on an architecture that differs from your current development host machine (i.e. the build host), be sure that the SDKMACHINE variable in the local.conf file in your Build Directory is correctly set.

    Note

    If you are building an SDK installer for the Extensible SDK, the SDKMACHINE value must be set for the architecture of the machine you are using to build the installer. If SDKMACHINE is not set appropriately, the build fails and provides an error message similar to the following:
         The extensible SDK can currently only be built for the same architecture as the machine being built on - SDK_ARCH is
         set to i686 (likely via setting SDKMACHINE) which is different from the architecture of the build machine (x86_64).
         Unable to continue.
                        

  6. Build the SDK Installer: To build the SDK installer for a standard SDK and populate the SDK image, use the following command form. Be sure to replace image with an image (e.g. "core-image-sato"):

         $ bitbake image -c populate_sdk
                    

    You can do the same for the extensible SDK using this command form:

         $ bitbake image -c populate_sdk_ext
                    

    These commands produce an SDK installer that contains the sysroot that matches your target root filesystem.

    When the bitbake command completes, the SDK installer will be in tmp/deploy/sdk in the Build Directory.

    Notes

    • By default, the previous BitBake command does not build static binaries. If you want to use the toolchain to build these types of libraries, you need to be sure your SDK has the appropriate static development libraries. Use the TOOLCHAIN_TARGET_TASK variable inside your local.conf file before building the SDK installer. Doing so ensures that the eventual SDK installation process installs the appropriate library packages as part of the SDK. Following is an example using libc static development libraries:

           TOOLCHAIN_TARGET_TASK_append = " libc-staticdev"
                                  

    • For additional information on building the installer, see the Cookbook guide to Making an Eclipse™ Debug Capable Image wiki page.

  7. Run the Installer: You can now run the SDK installer from tmp/deploy/sdk in the Build Directory. Following is an example:

         $ cd ~/poky/build/tmp/deploy/sdk
         $ ./poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-2.7.sh
                    

    During execution of the script, you choose the root location for the toolchain. See the "Installed Standard SDK Directory Structure" section and the "Installed Extensible SDK Directory Structure" section for more information.