Introduce an overlay based method for constructing a base DT blob
to pass to the kernel.
It is based on a specific method now to get the FDT from a FIT image
named boot_get_fdt_fit().
Signed-off-by: Pantelis Antoniou
---
common/image-fdt.c | 7 +--
common/image-fit.c | 181 +++--
include/image.h| 25
3 files changed, 205 insertions(+), 8 deletions(-)
diff --git a/common/image-fdt.c b/common/image-fdt.c
index da4d007..a2ef409 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -356,17 +356,16 @@ int boot_get_fdt(int flag, int argc, char * const argv[],
uint8_t arch,
if (fit_check_format(buf)) {
ulong load, len;
- fdt_noffset = fit_image_load(images,
+ fdt_noffset = boot_get_fdt_fit(images,
fdt_addr, &fit_uname_fdt,
&fit_uname_config,
- arch, IH_TYPE_FLATDT,
- BOOTSTAGE_ID_FIT_FDT_START,
- FIT_LOAD_OPTIONAL, &load, &len);
+ arch, &load, &len);
images->fit_hdr_fdt = map_sysmem(fdt_addr, 0);
images->fit_uname_fdt = fit_uname_fdt;
images->fit_noffset_fdt = fdt_noffset;
fdt_addr = load;
+
break;
} else
#endif
diff --git a/common/image-fit.c b/common/image-fit.c
index e75cb64..7f17fd1 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
DECLARE_GLOBAL_DATA_PTR;
#endif /* !USE_HOSTCC*/
@@ -434,6 +435,10 @@ void fit_image_print(const void *fit, int image_noffset,
const char *p)
printf("0x%08lx\n", load);
}
+ /* optional load address for FDT */
+ if (type == IH_TYPE_FLATDT && !fit_image_get_load(fit, image_noffset,
&load))
+ printf("%s Load Address: 0x%08lx\n", p, load);
+
if ((type == IH_TYPE_KERNEL) || (type == IH_TYPE_STANDALONE) ||
(type == IH_TYPE_RAMDISK)) {
ret = fit_image_get_entry(fit, image_noffset, &entry);
@@ -1454,6 +1459,8 @@ int fit_conf_get_node(const void *fit, const char
*conf_uname)
{
int noffset, confs_noffset;
int len;
+ const char *s;
+ char *conf_uname_copy = NULL;
confs_noffset = fdt_path_offset(fit, FIT_CONFS_PATH);
if (confs_noffset < 0) {
@@ -1475,12 +1482,29 @@ int fit_conf_get_node(const void *fit, const char
*conf_uname)
debug("Found default configuration: '%s'\n", conf_uname);
}
+ s = strchr(conf_uname, '#');
+ if (s) {
+ len = s - conf_uname;
+ conf_uname_copy = malloc(len + 1);
+ if (!conf_uname_copy) {
+ debug("Can't allocate uname copy: '%s'\n",
+ conf_uname);
+ return -ENOMEM;
+ }
+ memcpy(conf_uname_copy, conf_uname, len);
+ conf_uname_copy[len] = '\0';
+ conf_uname = conf_uname_copy;
+ }
+
noffset = fdt_subnode_offset(fit, confs_noffset, conf_uname);
if (noffset < 0) {
debug("Can't get node offset for configuration unit name: '%s'
(%s)\n",
conf_uname, fdt_strerror(noffset));
}
+ if (conf_uname_copy)
+ free(conf_uname_copy);
+
return noffset;
}
@@ -1527,7 +1551,7 @@ void fit_conf_print(const void *fit, int noffset, const
char *p)
char *desc;
const char *uname;
int ret;
- int loadables_index;
+ int fdt_index, loadables_index;
/* Mandatory properties */
ret = fit_get_desc(fit, noffset, &desc);
@@ -1549,9 +1573,17 @@ void fit_conf_print(const void *fit, int noffset, const
char *p)
if (uname)
printf("%s Init Ramdisk: %s\n", p, uname);
- uname = fdt_getprop(fit, noffset, FIT_FDT_PROP, NULL);
- if (uname)
- printf("%s FDT: %s\n", p, uname);
+ for (fdt_index = 0;
+uname = fdt_stringlist_get(fit, noffset, FIT_FDT_PROP,
+ fdt_index, NULL), uname;
+fdt_index++) {
+
+ if (fdt_index == 0)
+ printf("%s FDT: ", p);
+ else
+ printf("%s", p);
+ printf("%s\n", uname);
+ }
uname = fdt_getprop(fit, noffset, FIT_FPGA_PROP, NULL);
if (uname)
@@ -1888,3 +1920,144 @@ int boot_get_setup_fit(bootm_headers_t *images, uint8_t
arch,
return ret;
}
+