Комментарии 4
>Как этот костыль заменить корректными методами
припоминаю, когда-то было примерно так, можно попробовать
+ /* Allow the early environment to override the fdt address */
+ gd->fdt_blob = (void *)getenv_int("fdtcontroladdr", 16,
+ (uintptr_t)gd->fdt_blob);
упомянутая "getenv_int" - функция из той же древней patch:
https://lists.denx.de/pipermail/u-boot/2011-October/104855.html
+/**
+ * Decode the value of an environment variable and return it.
+ *
+ * @param name Name of environment variable
+ * @param base Number base to use (normally 10, or 16 for hex)
+ * @param default_val Default value to return if the variable is not
+ * found
+ * @return the decoded value, or default_val if not found
+ */
+static int getenv_int(const char *name, int base, int default_val)
+{
+ char tmp[64]; /* long enough for environment variables */
+ int i = getenv_f(name, tmp, sizeof(tmp));
+ return (i > 0)
+ ? (int) simple_strtoul(tmp, NULL, base)
+ : default_val;
+}
/* Allow the early environment to override the fdt address */
gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
(uintptr_t)gd->fdt_blob);
/**
* Decode the integer value of an environment variable and return it.
*
* @param name Name of environemnt variable
* @param base Number base to use (normally 10, or 16 for hex)
* @param default_val Default value to return if the variable is not
* found
* @return the decoded value, or default_val if not found
*/
ulong getenv_ulong(const char *name, int base, ulong default_val)
{
/*
* We can use getenv() here, even before relocation, since the
* environment variable value is an integer and thus short.
*/
const char *str = getenv(name);
return str ? simple_strtoul(str, NULL, base) : default_val;
}
Аналогичный код вызывается и у меня. Но что-то идет не так.
Дебажим U-boot на реальном железе