Taking OpenEmbedded SRC_URI from environment variable

OpenEmbedded uses SRC_URI to determine where the source code is taken from. For many projects it would be convenient to use source code from local repository due to many reasons, in order to support that, it is possible to use file URI as ‘file://’

For example,
SRC_URI=”file:///path/to/local_repo/whatever_project”
This can create problem because it is not sharable between different people due to absolute path. It may be possible to update FILESPATH varible, but I preferred to use the following method.

  • In $HOME/.bashrc, export a new environment variable, say LOCAL_REPO
    export LOCAL_REPO='/path/to/local_repo'
  • In /path/to/oe/source-me.txt, add the following lines
    if [ -z ${LOCAL_REPO} ]; then
      echo No LOCAL_REPO environment variable set
      return 2
    fi
    export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} LOCAL_REPO"
    
  • In related bb files, use SRC_URI as
    SRC_URI = "file://${LOCAL_REPO}/whatever_project"

Published by Anand Sivaram (आनन्दः )

twitter.com/anand_sivaram https://www.linkedin.com/in/anandsivaram/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: