Skip to content
Snippets Groups Projects
Commit 0b218c06 authored by Jonas Höppner's avatar Jonas Höppner
Browse files

[CMD][SECO_FDT_OVERLAY] Fix applying lists of overlays from one env variable

Secoconfig uses space seperated lists for som usecases. These have not
been decoded correctly before, only the first one was applied.
This is fixed now.
parent 96802033
No related branches found
No related tags found
No related merge requests found
......@@ -84,26 +84,36 @@ static int fdt_overlay_add_to_list(const char * overlay)
static int fdt_overlay_read_from_env( const char * env_var)
{
char * env_str;
char * local_env_str;
char * overlay;
int cnt = 0;
// seco_config
env_str = env_get(env_var);
if( !env_str || strlen(env_str) == 0)
return 0;
/* strtok modifies the string by inserting a \0 at the split.
Create a copy to leave the original string as is. */
local_env_str = strdup(env_str);
if ( local_env_str == NULL ){
fprintf(stderr, "%s: Error: Failed to allocate memory.\n", __func__);
return 0;
}
/* Seco config has configured something, use it.
Loop over all elements separted by ';' */
overlay = strtok( env_str, ";" );
Loop over all elements separated by space */
overlay = strtok( local_env_str, " " );
while( overlay != NULL)
{
debug("%s %d: seco_config overlay: %d %s\n", __func__,
__LINE__, overlay_cnt, overlay);
if( fdt_overlay_add_to_list(overlay) < 0) break;
if( fdt_overlay_add_to_list(overlay) < 0)
break;
cnt++;
overlay = strtok( NULL, ";" );
overlay = strtok( NULL, " " );
}
free(local_env_str);
return cnt;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment