mirror of
https://github.com/smaeul/u-boot.git
synced 2025-09-13 21:46:00 +01:00
This config is causing conflicts with how fdtfile variable is initialized. For K3 devices, CONFIG_DEFAULT_DEVICE_TREE= "ti/k3-<board>.dtb". With CONFIG_TI_FDT_FOLDER_PATH also prefixing "ti", fdtfile is then "ti/ti/k3-<board>.dtb". This variable is updated when fitImage is booted and fails to boot due to the parsing error "ti/ti/". Given that there are no other users of this config other than K3 for now, it is being removed. Since am64x, j721e and j721s2 also define a DEFAULT_FDT_FILE, update them to conform to the DEFAULT_DEVICE_TREE standard. Signed-off-by: Aashvij Shenai <a-shenai@ti.com>
62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Library to support FDT file operations which are common
|
|
*
|
|
* Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
|
|
*/
|
|
|
|
#include <env.h>
|
|
#include <stdio.h>
|
|
#include "fdt_ops.h"
|
|
|
|
void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map)
|
|
{
|
|
char *fdt_file_name = NULL;
|
|
char fdtfile[TI_FDT_FILE_MAX];
|
|
|
|
if (board_name) {
|
|
while (fdt_map) {
|
|
/* Check for NULL terminator in the list */
|
|
if (!fdt_map->board_name)
|
|
break;
|
|
if (!strncmp(fdt_map->board_name, board_name, TI_BOARD_NAME_MAX)) {
|
|
fdt_file_name = fdt_map->fdt_file_name;
|
|
break;
|
|
}
|
|
fdt_map++;
|
|
}
|
|
}
|
|
|
|
/* match not found OR null board_name */
|
|
if (!fdt_file_name) {
|
|
/*
|
|
* Prioritize CONFIG_DEFAULT_FDT_FILE - if that is not defined,
|
|
* or is empty, then use CONFIG_DEFAULT_DEVICE_TREE
|
|
*/
|
|
#ifdef CONFIG_DEFAULT_FDT_FILE
|
|
if (strlen(CONFIG_DEFAULT_FDT_FILE)) {
|
|
snprintf(fdtfile, sizeof(fdtfile), "%s", CONFIG_DEFAULT_FDT_FILE);
|
|
} else
|
|
#endif
|
|
{
|
|
snprintf(fdtfile, sizeof(fdtfile), "%s.dtb", CONFIG_DEFAULT_DEVICE_TREE);
|
|
}
|
|
} else {
|
|
snprintf(fdtfile, sizeof(fdtfile), "%s", fdt_file_name);
|
|
}
|
|
|
|
env_set("fdtfile", fdtfile);
|
|
|
|
/*
|
|
* XXX: DEPRECATION WARNING: 2 u-boot versions (2024.10).
|
|
*
|
|
* Maintain compatibility with downstream scripts that may be using
|
|
* name_fdt
|
|
*/
|
|
if (board_name)
|
|
env_set("name_fdt", fdtfile);
|
|
/* Also set the findfdt legacy script to warn users to stop using this */
|
|
env_set("findfdt",
|
|
"echo WARN: fdtfile already set. Stop using findfdt in script");
|
|
}
|