1 // SPDX-License-Identifier: GPL-2.0+
3 * Image code used by boards (and not host tools)
5 * (C) Copyright 2008 Semihalf
7 * (C) Copyright 2000-2006
8 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
12 #include <bootstage.h>
14 #include <display_options.h>
22 #include <asm/cache.h>
23 #include <asm/global_data.h>
25 DECLARE_GLOBAL_DATA_PTR;
27 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
29 * image_get_ramdisk - get and verify ramdisk image
30 * @rd_addr: ramdisk image start address
31 * @arch: expected ramdisk architecture
32 * @verify: checksum verification flag
34 * image_get_ramdisk() returns a pointer to the verified ramdisk image
35 * header. Routine receives image start address and expected architecture
36 * flag. Verification done covers data and header integrity and os/type/arch
40 * pointer to a ramdisk image header, if image was found and valid
41 * otherwise, return NULL
43 static const image_header_t *image_get_ramdisk(ulong rd_addr, u8 arch,
46 const image_header_t *rd_hdr = (const image_header_t *)rd_addr;
48 if (!image_check_magic(rd_hdr)) {
49 puts("Bad Magic Number\n");
50 bootstage_error(BOOTSTAGE_ID_RD_MAGIC);
54 if (!image_check_hcrc(rd_hdr)) {
55 puts("Bad Header Checksum\n");
56 bootstage_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
60 bootstage_mark(BOOTSTAGE_ID_RD_MAGIC);
61 image_print_contents(rd_hdr);
64 puts(" Verifying Checksum ... ");
65 if (!image_check_dcrc(rd_hdr)) {
66 puts("Bad Data CRC\n");
67 bootstage_error(BOOTSTAGE_ID_RD_CHECKSUM);
73 bootstage_mark(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
75 if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
76 !image_check_arch(rd_hdr, arch) ||
77 !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
78 printf("No Linux %s Ramdisk Image\n",
79 genimg_get_arch_name(arch));
80 bootstage_error(BOOTSTAGE_ID_RAMDISK);
88 /*****************************************************************************/
89 /* Shared dual-format routines */
90 /*****************************************************************************/
91 ulong image_load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
92 ulong image_save_addr; /* Default Save Address */
93 ulong image_save_size; /* Default Save Size (in bytes) */
95 static int on_loadaddr(const char *name, const char *value, enum env_op op,
100 case env_op_overwrite:
101 image_load_addr = hextoul(value, NULL);
109 U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
111 ulong env_get_bootm_low(void)
113 char *s = env_get("bootm_low");
116 ulong tmp = hextoul(s, NULL);
120 #if defined(CONFIG_SYS_SDRAM_BASE)
121 return CONFIG_SYS_SDRAM_BASE;
122 #elif defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_RISCV)
123 return gd->bd->bi_dram[0].start;
129 phys_size_t env_get_bootm_size(void)
131 phys_size_t tmp, size;
133 char *s = env_get("bootm_size");
136 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
140 start = gd->ram_base;
143 if (start + size > gd->ram_top)
144 size = gd->ram_top - start;
146 s = env_get("bootm_low");
148 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
152 return size - (tmp - start);
155 phys_size_t env_get_bootm_mapsize(void)
158 char *s = env_get("bootm_mapsize");
161 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
165 #if defined(CONFIG_SYS_BOOTMAPSZ)
166 return CONFIG_SYS_BOOTMAPSZ;
168 return env_get_bootm_size();
172 void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
177 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
183 size_t tail = (len > chunksz) ? chunksz : len;
190 memmove(to, from, tail);
197 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
198 memmove(to, from, len);
199 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
203 * genimg_get_kernel_addr_fit - get the real kernel address and return 2
205 * @img_addr: a string might contain real image address
206 * @fit_uname_config: double pointer to a char, will hold pointer to a
207 * configuration unit name
208 * @fit_uname_kernel: double pointer to a char, will hold pointer to a subimage
211 * genimg_get_kernel_addr_fit get the real kernel start address from a string
212 * which is normally the first argv of bootm/bootz
215 * kernel start address
217 ulong genimg_get_kernel_addr_fit(char * const img_addr,
218 const char **fit_uname_config,
219 const char **fit_uname_kernel)
223 /* find out kernel image address */
225 kernel_addr = image_load_addr;
226 debug("* kernel: default image load address = 0x%08lx\n",
228 } else if (CONFIG_IS_ENABLED(FIT) &&
229 fit_parse_conf(img_addr, image_load_addr, &kernel_addr,
231 debug("* kernel: config '%s' from image at 0x%08lx\n",
232 *fit_uname_config, kernel_addr);
233 } else if (CONFIG_IS_ENABLED(FIT) &&
234 fit_parse_subimage(img_addr, image_load_addr, &kernel_addr,
236 debug("* kernel: subimage '%s' from image at 0x%08lx\n",
237 *fit_uname_kernel, kernel_addr);
239 kernel_addr = hextoul(img_addr, NULL);
240 debug("* kernel: cmdline image address = 0x%08lx\n",
248 * genimg_get_kernel_addr() is the simple version of
249 * genimg_get_kernel_addr_fit(). It ignores those return FIT strings
251 ulong genimg_get_kernel_addr(char * const img_addr)
253 const char *fit_uname_config = NULL;
254 const char *fit_uname_kernel = NULL;
256 return genimg_get_kernel_addr_fit(img_addr, &fit_uname_config,
261 * genimg_get_format - get image format type
262 * @img_addr: image start address
264 * genimg_get_format() checks whether provided address points to a valid
265 * legacy or FIT image.
267 * New uImage format and FDT blob are based on a libfdt. FDT blob
268 * may be passed directly or embedded in a FIT image. In both situations
269 * genimg_get_format() must be able to dectect libfdt header.
272 * image format type or IMAGE_FORMAT_INVALID if no image is present
274 int genimg_get_format(const void *img_addr)
276 if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
277 const image_header_t *hdr;
279 hdr = (const image_header_t *)img_addr;
280 if (image_check_magic(hdr))
281 return IMAGE_FORMAT_LEGACY;
283 if (CONFIG_IS_ENABLED(FIT) || CONFIG_IS_ENABLED(OF_LIBFDT)) {
284 if (!fdt_check_header(img_addr))
285 return IMAGE_FORMAT_FIT;
287 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE) &&
288 !android_image_check_header(img_addr))
289 return IMAGE_FORMAT_ANDROID;
291 return IMAGE_FORMAT_INVALID;
295 * fit_has_config - check if there is a valid FIT configuration
296 * @images: pointer to the bootm command headers structure
298 * fit_has_config() checks if there is a FIT configuration in use
299 * (if FTI support is present).
302 * 0, no FIT support or no configuration found
303 * 1, configuration found
305 int genimg_has_config(bootm_headers_t *images)
307 if (CONFIG_IS_ENABLED(FIT) && images->fit_uname_cfg)
314 * select_ramdisk() - Select and locate the ramdisk to use
316 * @images: pointer to the bootm images structure
317 * @select: name of ramdisk to select, or hex address, NULL for any
318 * @arch: expected ramdisk architecture
319 * @rd_datap: pointer to a ulong variable, will hold ramdisk pointer
320 * @rd_lenp: pointer to a ulong variable, will hold ramdisk length
321 * Return: 0 if OK, -ENOPKG if no ramdisk (but an error should not be reported),
322 * other -ve value on other error
324 static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
325 ulong *rd_datap, ulong *rd_lenp)
331 #if CONFIG_IS_ENABLED(FIT)
332 const char *fit_uname_config = images->fit_uname_cfg;
333 const char *fit_uname_ramdisk = NULL;
339 * If the init ramdisk comes from the FIT image and
340 * the FIT image address is omitted in the command
341 * line argument, try to use os FIT image address or
342 * default load address.
344 if (images->fit_uname_os)
345 default_addr = (ulong)images->fit_hdr_os;
347 default_addr = image_load_addr;
349 if (fit_parse_conf(select, default_addr,
350 &rd_addr, &fit_uname_config)) {
351 debug("* ramdisk: config '%s' from image at 0x%08lx\n",
352 fit_uname_config, rd_addr);
353 } else if (fit_parse_subimage(select, default_addr,
355 &fit_uname_ramdisk)) {
356 debug("* ramdisk: subimage '%s' from image at 0x%08lx\n",
357 fit_uname_ramdisk, rd_addr);
361 rd_addr = hextoul(select, NULL);
362 debug("* ramdisk: cmdline image address = 0x%08lx\n",
365 #if CONFIG_IS_ENABLED(FIT)
367 /* use FIT configuration provided in first bootm
368 * command argument. If the property is not defined,
369 * quit silently (with -ENOPKG)
371 rd_addr = map_to_sysmem(images->fit_hdr_os);
372 rd_noffset = fit_get_node_from_config(images,
375 if (rd_noffset == -ENOENT)
377 else if (rd_noffset < 0)
383 * Check if there is an initrd image at the
384 * address provided in the second bootm argument
385 * check image type, for FIT images get FIT node.
387 buf = map_sysmem(rd_addr, 0);
388 switch (genimg_get_format(buf)) {
389 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
390 case IMAGE_FORMAT_LEGACY: {
391 const image_header_t *rd_hdr;
393 printf("## Loading init Ramdisk from Legacy Image at %08lx ...\n",
396 bootstage_mark(BOOTSTAGE_ID_CHECK_RAMDISK);
397 rd_hdr = image_get_ramdisk(rd_addr, arch,
403 *rd_datap = image_get_data(rd_hdr);
404 *rd_lenp = image_get_data_size(rd_hdr);
409 #if CONFIG_IS_ENABLED(FIT)
410 case IMAGE_FORMAT_FIT:
411 rd_noffset = fit_image_load(images,
412 rd_addr, &fit_uname_ramdisk,
413 &fit_uname_config, arch,
415 BOOTSTAGE_ID_FIT_RD_START,
416 FIT_LOAD_OPTIONAL_NON_ZERO,
421 images->fit_hdr_rd = map_sysmem(rd_addr, 0);
422 images->fit_uname_rd = fit_uname_ramdisk;
423 images->fit_noffset_rd = rd_noffset;
427 case IMAGE_FORMAT_ANDROID:
428 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
429 void *ptr = map_sysmem(images->os.start, 0);
432 ret = android_image_get_ramdisk(ptr, rd_datap,
443 if (IS_ENABLED(CONFIG_SUPPORT_RAW_INITRD)) {
447 end = strchr(select, ':');
449 *rd_lenp = hextoul(++end, NULL);
456 puts("Wrong Ramdisk Image Format\n");
465 * boot_get_ramdisk - main ramdisk handling routine
466 * @argc: command argument count
467 * @argv: command argument list
468 * @images: pointer to the bootm images structure
469 * @arch: expected ramdisk architecture
470 * @rd_start: pointer to a ulong variable, will hold ramdisk start address
471 * @rd_end: pointer to a ulong variable, will hold ramdisk end
473 * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
474 * Currently supported are the following ramdisk sources:
475 * - multicomponent kernel/ramdisk image,
476 * - commandline provided address of decicated ramdisk image.
479 * 0, if ramdisk image was found and valid, or skiped
480 * rd_start and rd_end are set to ramdisk start/end addresses if
481 * ramdisk image is found and valid
483 * 1, if ramdisk image is found but corrupted, or invalid
484 * rd_start and rd_end are set to 0 if no ramdisk exists
486 int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
487 u8 arch, ulong *rd_start, ulong *rd_end)
489 ulong rd_data, rd_len;
490 const char *select = NULL;
495 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
498 /* Look for an Android boot image */
499 buf = map_sysmem(images->os.start, 0);
500 if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
501 select = (argc == 0) ? env_get("loadaddr") : argv[0];
508 * Look for a '-' which indicates to ignore the
511 if (select && strcmp(select, "-") == 0) {
512 debug("## Skipping init Ramdisk\n");
515 } else if (select || genimg_has_config(images)) {
518 ret = select_ramdisk(images, select, arch, &rd_data, &rd_len);
523 } else if (images->legacy_hdr_valid &&
524 image_check_type(&images->legacy_hdr_os_copy,
527 * Now check if we have a legacy mult-component image,
528 * get second entry data start address and len.
530 bootstage_mark(BOOTSTAGE_ID_RAMDISK);
531 printf("## Loading init Ramdisk from multi component Legacy Image at %08lx ...\n",
532 (ulong)images->legacy_hdr_os);
534 image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
539 bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
545 debug("## No init Ramdisk\n");
548 *rd_end = rd_data + rd_len;
550 debug(" ramdisk start = 0x%08lx, ramdisk end = 0x%08lx\n",
556 #if defined(CONFIG_LMB)
558 * boot_ramdisk_high - relocate init ramdisk
559 * @lmb: pointer to lmb handle, will be used for memory mgmt
560 * @rd_data: ramdisk data start address
561 * @rd_len: ramdisk data length
562 * @initrd_start: pointer to a ulong variable, will hold final init ramdisk
563 * start address (after possible relocation)
564 * @initrd_end: pointer to a ulong variable, will hold final init ramdisk
565 * end address (after possible relocation)
567 * boot_ramdisk_high() takes a relocation hint from "initrd_high" environment
568 * variable and if requested ramdisk data is moved to a specified location.
570 * Initrd_start and initrd_end are set to final (after relocation) ramdisk
571 * start/end addresses if ramdisk image start and len were provided,
572 * otherwise set initrd_start and initrd_end set to zeros.
578 int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
579 ulong *initrd_start, ulong *initrd_end)
583 int initrd_copy_to_ram = 1;
585 s = env_get("initrd_high");
587 /* a value of "no" or a similar string will act like 0,
588 * turning the "load high" feature off. This is intentional.
590 initrd_high = hextoul(s, NULL);
591 if (initrd_high == ~0)
592 initrd_copy_to_ram = 0;
594 initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
597 debug("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
598 initrd_high, initrd_copy_to_ram);
601 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
602 debug(" in-place initrd\n");
603 *initrd_start = rd_data;
604 *initrd_end = rd_data + rd_len;
605 lmb_reserve(lmb, rd_data, rd_len);
608 *initrd_start = (ulong)lmb_alloc_base(lmb,
609 rd_len, 0x1000, initrd_high);
611 *initrd_start = (ulong)lmb_alloc(lmb, rd_len,
614 if (*initrd_start == 0) {
615 puts("ramdisk - allocation error\n");
618 bootstage_mark(BOOTSTAGE_ID_COPY_RAMDISK);
620 *initrd_end = *initrd_start + rd_len;
621 printf(" Loading Ramdisk to %08lx, end %08lx ... ",
622 *initrd_start, *initrd_end);
624 memmove_wd((void *)*initrd_start,
625 (void *)rd_data, rd_len, CHUNKSZ);
628 * Ensure the image is flushed to memory to handle
629 * AMP boot scenarios in which we might not be
632 if (IS_ENABLED(CONFIG_MP)) {
633 flush_cache((unsigned long)*initrd_start,
634 ALIGN(rd_len, ARCH_DMA_MINALIGN));
642 debug(" ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
643 *initrd_start, *initrd_end);
652 int boot_get_setup(bootm_headers_t *images, u8 arch,
653 ulong *setup_start, ulong *setup_len)
655 if (!CONFIG_IS_ENABLED(FIT))
658 return boot_get_setup_fit(images, arch, setup_start, setup_len);
661 int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
662 u8 arch, const ulong *ld_start, ulong * const ld_len)
664 ulong tmp_img_addr, img_data, img_len;
668 const char *uname, *name;
670 int devnum = 0; /* TODO support multi fpga platforms */
672 if (!IS_ENABLED(CONFIG_FPGA))
675 /* Check to see if the images struct has a FIT configuration */
676 if (!genimg_has_config(images)) {
677 debug("## FIT configuration was not specified\n");
682 * Obtain the os FIT header from the images struct
684 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
685 buf = map_sysmem(tmp_img_addr, 0);
687 * Check image type. For FIT images get FIT node
688 * and attempt to locate a generic binary.
690 switch (genimg_get_format(buf)) {
691 case IMAGE_FORMAT_FIT:
692 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
694 uname = fdt_stringlist_get(buf, conf_noffset, FIT_FPGA_PROP, 0,
697 debug("## FPGA image is not specified\n");
700 fit_img_result = fit_image_load(images,
702 (const char **)&uname,
703 &images->fit_uname_cfg,
706 BOOTSTAGE_ID_FPGA_INIT,
707 FIT_LOAD_OPTIONAL_NON_ZERO,
708 &img_data, &img_len);
710 debug("FPGA image (%s) loaded to 0x%lx/size 0x%lx\n",
711 uname, img_data, img_len);
713 if (fit_img_result < 0) {
714 /* Something went wrong! */
715 return fit_img_result;
718 if (!fpga_is_partial_data(devnum, img_len)) {
720 err = fpga_loadbitstream(devnum, (char *)img_data,
723 err = fpga_load(devnum, (const void *)img_data,
724 img_len, BIT_FULL, 0);
727 err = fpga_loadbitstream(devnum, (char *)img_data,
728 img_len, BIT_PARTIAL);
730 err = fpga_load(devnum, (const void *)img_data,
731 img_len, BIT_PARTIAL, 0);
737 printf(" Programming %s bitstream... OK\n", name);
740 printf("The given image format is not supported (corrupt?)\n");
747 static void fit_loadable_process(u8 img_type,
752 const unsigned int count =
753 ll_entry_count(struct fit_loadable_tbl, fit_loadable);
754 struct fit_loadable_tbl *fit_loadable_handler =
755 ll_entry_start(struct fit_loadable_tbl, fit_loadable);
756 /* For each loadable handler */
757 for (i = 0; i < count; i++, fit_loadable_handler++)
758 /* matching this type */
759 if (fit_loadable_handler->type == img_type)
760 /* call that handler with this image data */
761 fit_loadable_handler->handler(img_data, img_len);
764 int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
765 u8 arch, const ulong *ld_start, ulong * const ld_len)
768 * These variables are used to hold the current image location
773 * These two variables are requirements for fit_image_load, but
774 * their values are not used
776 ulong img_data, img_len;
784 /* Check to see if the images struct has a FIT configuration */
785 if (!genimg_has_config(images)) {
786 debug("## FIT configuration was not specified\n");
791 * Obtain the os FIT header from the images struct
793 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
794 buf = map_sysmem(tmp_img_addr, 0);
796 * Check image type. For FIT images get FIT node
797 * and attempt to locate a generic binary.
799 switch (genimg_get_format(buf)) {
800 case IMAGE_FORMAT_FIT:
801 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
803 for (loadables_index = 0;
804 uname = fdt_stringlist_get(buf, conf_noffset,
806 loadables_index, NULL), uname;
808 fit_img_result = fit_image_load(images, tmp_img_addr,
810 &images->fit_uname_cfg,
811 arch, IH_TYPE_LOADABLE,
812 BOOTSTAGE_ID_FIT_LOADABLE_START,
813 FIT_LOAD_OPTIONAL_NON_ZERO,
814 &img_data, &img_len);
815 if (fit_img_result < 0) {
816 /* Something went wrong! */
817 return fit_img_result;
820 fit_img_result = fit_image_get_node(buf, uname);
821 if (fit_img_result < 0) {
822 /* Something went wrong! */
823 return fit_img_result;
825 fit_img_result = fit_image_get_type(buf,
828 if (fit_img_result < 0) {
829 /* Something went wrong! */
830 return fit_img_result;
833 fit_loadable_process(img_type, img_data, img_len);
837 printf("The given image format is not supported (corrupt?)\n");
844 #if defined(CONFIG_LMB)
845 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
847 * boot_get_cmdline - allocate and initialize kernel cmdline
848 * @lmb: pointer to lmb handle, will be used for memory mgmt
849 * @cmd_start: pointer to a ulong variable, will hold cmdline start
850 * @cmd_end: pointer to a ulong variable, will hold cmdline end
852 * boot_get_cmdline() allocates space for kernel command line below
853 * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environment
854 * variable is present its contents is copied to allocated kernel
861 int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
866 cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
867 env_get_bootm_mapsize() + env_get_bootm_low());
871 s = env_get("bootargs");
877 *cmd_start = (ulong)cmdline;
878 *cmd_end = *cmd_start + strlen(cmdline);
880 debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
886 * boot_get_kbd - allocate and initialize kernel copy of board info
887 * @lmb: pointer to lmb handle, will be used for memory mgmt
888 * @kbd: double pointer to board info data
890 * boot_get_kbd() allocates space for kernel copy of board info data below
891 * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
892 * with the current u-boot board info data.
898 int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
900 *kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
901 sizeof(struct bd_info),
903 env_get_bootm_mapsize() +
904 env_get_bootm_low());
910 debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
913 if (IS_ENABLED(CONFIG_CMD_BDI))
914 do_bdinfo(NULL, 0, 0, NULL);
921 int image_setup_linux(bootm_headers_t *images)
923 ulong of_size = images->ft_len;
924 char **of_flat_tree = &images->ft_addr;
925 struct lmb *lmb = &images->lmb;
928 if (CONFIG_IS_ENABLED(OF_LIBFDT))
929 boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
931 if (IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE)) {
932 ret = boot_get_cmdline(lmb, &images->cmdline_start,
933 &images->cmdline_end);
935 puts("ERROR with allocation of cmdline\n");
940 if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
941 ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
946 if (CONFIG_IS_ENABLED(OF_LIBFDT) && of_size) {
947 ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
956 void genimg_print_size(uint32_t size)
958 printf("%d Bytes = ", size);
959 print_size(size, "\n");
962 void genimg_print_time(time_t timestamp)
966 rtc_to_tm(timestamp, &tm);
967 printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
968 tm.tm_year, tm.tm_mon, tm.tm_mday,
969 tm.tm_hour, tm.tm_min, tm.tm_sec);