how to specify fdt_file in an U-boot build with Yocto - yocto

How can I specify the value of the variable 'fdt_file' in U-Boot that is build with Yocto?
Is UBOOT_CONFIG="fdt_file=test.dtb" in the local.conf the solution? It didn't work. Our do I have to create a patch file to apply to set in C this variable. Or would the Uenv.txt file be a solution?

Is UBOOT_CONFIG="fdt_file=test.dtb" in the local.conf the solution?
No, this is incorrect. UBOOT_CONFIG specify configuration file name (without extension) what should be used to build u-boot. Configuration files located under include/configs inside u-boot src dir.
Our do I have to create a patch file to apply to set in C this variable.
Yes. There is CONFIG_EXTRA_ENV_SETTINGS variable (located inside board config file) what define default values for environment variables. You can append "fdt_file=test.dtb\0" to it (don't forget \0 at the end). As another solution, you can set it value using setenv("fdt_file", "test.dtb") somewhere during board initialization.
Or would the Uenv.txt file be a solution?
Yes.
Pick one solution what better match your needs. For example, modifying uEnv.txt is simpler, because you don't need to rebuild u-boot every time. But have hardcoded value inside u-boot may be useful in some situations.

Related

Codemagic - Set Dynamic Environment Variables for the Build arguments

I am looking a way to manage dynamic environment variables in my build arguments.
I am able to make it work if I define values for TARGET_FILE and FLAVOR in the environment variable section in CodeMagic.
But my goal is to have the values specified in my git repository. So I will be able to change it and have a dynamic build.
I was thinking I would be able to set the env var in the pre-build section.
Following is a sample of my pre-build.sh file
# in my case it’s `dev`, `qa` and `prod`
export FLAVOR='qa'
# major and minor part of app version e.g. 1.0
export VERSION_NUMBER='1.0.0'
# this is the entry point of the app e.g. main_dev.dart
export TARGET_FILE="lib/main_$FLAVOR.dart"
My build is still failing because the TARGET_FILE for example is not specified
Target file "--flavor" not found.
Build failed :|
Failed to build for Android
I was wondering if anyone has ever encountered this scenario
As for configuring build from GitHub you can use codemagic.yaml file that allows you to define the configuration for CodeMagic build, including env variables (here is a docs).
Additional notes, just a proposition))
I actually don't know what is going on in your Flavors and env entry points, but quite possible you can actually get rid of both.
For instance, you can use .env file and flutter_config package to pass env specific variables to the native layer, including plist's and Gradle. Also, you can load this .env file into Dart code and use variables from it. On top of this, you can use this package to generate .env file with the terminal command (if you don't want to create any sh scripts))). Alongside with .env file, it can generate Dart class specifically for Dart code. It also can generate files based on global env variables.
In that way all environment specific configuration will be defined once, you won't expose your prod credentials anywhere except build tool and you won't need to copy/paste multiple entry points.
Update 08/05/2020:
Starting from Flutter 1.17 you can use --dart-defines argument instead of environment_config and flutter_config package to define compile-time variables. You can read more about this argument here

How to structure Yocto conf files for two different machines and same bblayers

I'm currently trying to setup my distro Yocto layer to generate a build environment for two different machines: robocop and terminator. The conf/machine/ containing these machine.conf files are present in a different layer.
Also, I would like to use the same bblayers.conf for setups.
The first idea was to make two separate conf directories:
conf/variant/robocop
conf/variant/terminator
Each containing a local.conf.sample (with the respective MACHINE value) and bblayers.conf.sample file.
The problem with this is that I am basically duplicating bblayers in both directories. Since the TEMPLATECONF var must point to a place where both files are present. Therefore I cannot separate local.conf.sample and bblayers.conf.sample
The other alternative is to leave both files under conf/ directory as generic and selecting the machine when bitbaking: MACHINE=robocop bitbake core-image-minimal. But I would like to avoid this as it is easy for the developer to forget to prepend the machine variable before building something.
Is there another alternative to allow two different local.conf using the same bblayers.conf ?
Also I would like to use is thread and ask for which usecases should one use *.conf or *.conf.sample files.

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.
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

Build from local mirror GCC bbappend recipe

I'm trying to figure out how to convince Yocto to build gcc using my local GIT source rather than standard location it uses.
By default the recipe to build GCC located in meta/recipes-devtools/gcc/gcc_5.2.bb. It includes gcc-5.2.inc, which points to
BASEURI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2"
as the location of the code.
Based on BitBake's documentation, I've created my own layer and gcc_5.2.bbappend append file. bitbake-layers show-appends shows that the system properly recognized the append file.
However, what this gcc_5.2.bbappend append file need to do to replace the source path? I've tried changing SRC_URI directly, prepending it with my own path. But it always stays the same and attempts to access the specified above path.
My original assumption that the /gcc/gcc_5.2.bb have to appended was incorrect. I've corrupted the specified above BASEURI to consistently cause an error. Running bitbake with -D option showed that there is a different recipe called gcc-source_5.2.bb that actually controls the source file acquisition and it had to be appended.

Do Doxygen config files support variables?

For instance I set the source code path as c:\code\testapp\src. Is this then available as a var I can use - for instance so I can spit out a tag file in a location relative to this, not relative to the working dir of doxygen? I think I'm looking for something like how Ant defines vars for just about everything and these can be re-used; does Doxygen have special vars for any of the config values?
I'm thinking like $PROJECT-NAME or %VERSION% or whatever...
You can use environment variables in the configuration file; the syntax is the same as in a makefile, i.e. $(VAR_NAME)
I am not sure, but I have seen people use variables as part of their build process. For example the lemon graph library uses cmake, sets a variable for the absolute file path in cmake and the doxygen config file includes variables such as #abs_top_srcdir#. Through the build process these variables are replaced with the relevant text.