ulong size)
{
const char *select = NULL;
+ ulong img_addr;
+ void *buf;
int ret;
if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
- char *buf;
-
/* Look for an Android boot image */
buf = map_sysmem(images.os.start, 0);
if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
}
if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
+ img_addr = argc ? hextoul(argv[0], NULL) : image_load_addr;
+ buf = map_sysmem(img_addr, 0);
+
/* find flattened device tree */
- ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
- &images.ft_addr, &images.ft_len);
+ ret = boot_get_fdt(buf, flag, argc, argv, IH_ARCH_DEFAULT,
+ &images, &images.ft_addr, &images.ft_len);
if (ret) {
puts("Could not find a valid device tree\n");
return 1;
return 0;
}
-/**
- * boot_get_fdt - main fdt handling routine
- * @argc: command argument count
- * @argv: command argument list
- * @arch: architecture (IH_ARCH_...)
- * @images: pointer to the bootm images structure
- * @of_flat_tree: pointer to a char* variable, will hold fdt start address
- * @of_size: pointer to a ulong variable, will hold fdt length
- *
- * boot_get_fdt() is responsible for finding a valid flat device tree image.
- * Currently supported are the following ramdisk sources:
- * - multicomponent kernel/ramdisk image,
- * - commandline provided address of decicated ramdisk image.
- *
- * returns:
- * 0, if fdt image was found and valid, or skipped
- * of_flat_tree and of_size are set to fdt start address and length if
- * fdt image is found and valid
- *
- * 1, if fdt image is found but corrupted
- * of_flat_tree and of_size are set to 0 if no fdt exists
- */
-int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
- struct bootm_headers *images, char **of_flat_tree, ulong *of_size)
+int boot_get_fdt(void *buf, int flag, int argc, char *const argv[], uint arch,
+ struct bootm_headers *images, char **of_flat_tree,
+ ulong *of_size)
{
- ulong img_addr;
ulong fdt_addr;
char *fdt_blob = NULL;
- void *buf;
const char *select = NULL;
*of_flat_tree = NULL;
*of_size = 0;
- img_addr = (argc == 0) ? image_load_addr : hextoul(argv[0], NULL);
- buf = map_sysmem(img_addr, 0);
-
if (argc > 2)
select = argv[2];
if (select || genimg_has_config(images)) {
int fit_get_node_from_config(struct bootm_headers *images,
const char *prop_name, ulong addr);
-int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
- struct bootm_headers *images,
- char **of_flat_tree, ulong *of_size);
+/**
+ * boot_get_fdt() - locate FDT devicetree to use for booting
+ *
+ * @buf: Pointer to image
+ * @argc: command argument count
+ * @argv: command argument list
+ * @arch: architecture (IH_ARCH_...)
+ * @images: pointer to the bootm images structure
+ * @of_flat_tree: pointer to a char* variable, will hold fdt start address
+ * @of_size: pointer to a ulong variable, will hold fdt length
+ *
+ * boot_get_fdt() is responsible for finding a valid flat device tree image.
+ * Currently supported are the following FDT sources:
+ * - multicomponent kernel/ramdisk/FDT image,
+ * - commandline provided address of decicated FDT image.
+ *
+ * Return:
+ * 0, if fdt image was found and valid, or skipped
+ * of_flat_tree and of_size are set to fdt start address and length if
+ * fdt image is found and valid
+ *
+ * 1, if fdt image is found but corrupted
+ * of_flat_tree and of_size are set to 0 if no fdt exists
+ */
+int boot_get_fdt(void *buf, int flag, int argc, char *const argv[], uint arch,
+ struct bootm_headers *images, char **of_flat_tree,
+ ulong *of_size);
+
void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob);
int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size);