Search code examples
yoctorecipeopenembedded

Yocto recipe for adding export to .bash_profile


how can I define environmental variables I would otherwise put in .bashrc or .bash_profile using export into a build of yocto, so as not to do it everytime I flash OS.

For particulars:
Board I am building for : Toradex Apalis T30
I am adding this recipe : https://github.com/bmwcarit/meta-ros

As shown in readme of the above recipe, we need to set up the environment with

export ROS_ROOT=/opt/ros
export ROS_DISTRO=indigo
export ROS_PACKAGE_PATH=/opt/ros/indigo/share
export PATH=$PATH:/opt/ros/indigo/bin
export LD_LIBRARY_PATH=/opt/ros/indigo/lib
export PYTHONPATH=/opt/ros/indigo/lib/python2.7/site-packages
export ROS_MASTER_URI=http://localhost:11311
export CMAKE_PREFIX_PATH=/opt/ros/indigo
touch /opt/ros/indigo/.catkin

Also how can I add the last touch to run only once.(I suppose it need not be ran every time a terminal is opened).

I tried to make a service to declare these variables, but I think that's not the most efficient(or atleast good) method of doing the same.


Solution

  • I don't know if there's a simpler way but I created a .bbappend of the "base-files" recipe provinding the .profile file with

    FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
    

    inside.

    Then in you need to have a file called dot.profile and put your environment variable.

    As a general advice, when you face this kind of issue, use the find command to find which recipe provides which files