Book Image

Embedded Linux Projects Using Yocto Project Cookbook

By : Alex Gonzalez
Book Image

Embedded Linux Projects Using Yocto Project Cookbook

By: Alex Gonzalez

Overview of this book

Table of Contents (13 chapters)
Embedded Linux Projects Using Yocto Project Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with the SCons builder


SCons is also a multiplatform build system written in Python, with its configuration files also written in the same language. It also includes support for Microsoft Visual Studio among other features.

Getting ready

SCons parses the SConstruct files, and by default it does not propagate the environment into the build system. This is to avoid build issues caused by environment differences. This is a complication for Yocto, as it configures the environment with the cross-compilation toolchain settings.

SCons does not define a standard way to support cross-compilation, so every project will implement it differently. For a simple example as the hello world program, we can just initialize the CC and PATH variables from the external environment as follows:

import os
env = Environment(CC = os.environ['CC'],
                  ENV = {'PATH': os.environ['PATH']})
env.Program("helloworld", "helloworld.c")

How to do it...

The Yocto build system also contains classes with the...