Reputation: 71
I would like to create an environmental variable called BOARD
that is set to the physical board type from a Yocto recipe. This variable will not be used during the actual installation of recipes. I would also like to modify the HOME
variable. These variables need to be accessible on the board after it is booted. What is the best of doing so?
I have tried using export but realized that this command doesn't affect the parent shell. I have read about modifying the dot.profile file, but I don't want to hard code a variable. I would like it to dynamically alter the variable depending on what MACHINE
variable was used to run bitbake.
For example in the dot.profile file:
export BOARD = "${MACHINE}"
However, MACHINE
doesn't seem to be accessible.
Upvotes: 4
Views: 7542
Reputation: 2310
You can add something like this in image recipe or local.conf
:
set_board_env(){
mkdir -p ${IMAGE_ROOTFS}/etc/profile.d
echo "export BOARD=${MACHINE}" > ${IMAGE_ROOTFS}/etc/profile.d/set_board_env.sh
}
ROOTFS_POSTPROCESS_COMMAND += "set_board_env;"
Upvotes: 5