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;
28 * image_get_ramdisk - get and verify ramdisk image
29 * @rd_addr: ramdisk image start address
30 * @arch: expected ramdisk architecture
31 * @verify: checksum verification flag
33 * image_get_ramdisk() returns a pointer to the verified ramdisk image
34 * header. Routine receives image start address and expected architecture
35 * flag. Verification done covers data and header integrity and os/type/arch
39 * pointer to a ramdisk image header, if image was found and valid
40 * otherwise, return NULL
42 static const image_header_t *image_get_ramdisk(ulong rd_addr, u8 arch,
45 const image_header_t *rd_hdr = (const image_header_t *)rd_addr;
47 if (!image_check_magic(rd_hdr)) {
48 puts("Bad Magic Number\n");
49 bootstage_error(BOOTSTAGE_ID_RD_MAGIC);
53 if (!image_check_hcrc(rd_hdr)) {
54 puts("Bad Header Checksum\n");
55 bootstage_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
59 bootstage_mark(BOOTSTAGE_ID_RD_MAGIC);
60 image_print_contents(rd_hdr);
63 puts(" Verifying Checksum ... ");
64 if (!image_check_dcrc(rd_hdr)) {
65 puts("Bad Data CRC\n");
66 bootstage_error(BOOTSTAGE_ID_RD_CHECKSUM);
72 bootstage_mark(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
74 if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
75 !image_check_arch(rd_hdr, arch) ||
76 !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
77 printf("No Linux %s Ramdisk Image\n",
78 genimg_get_arch_name(arch));
79 bootstage_error(BOOTSTAGE_ID_RAMDISK);
86 /*****************************************************************************/
87 /* Shared dual-format routines */
88 /*****************************************************************************/
89 ulong image_load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
90 ulong image_save_addr; /* Default Save Address */
91 ulong image_save_size; /* Default Save Size (in bytes) */
93 static int on_loadaddr(const char *name, const char *value, enum env_op op,
98 case env_op_overwrite:
99 image_load_addr = hextoul(value, NULL);
107 U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
109 ulong env_get_bootm_low(void)
111 char *s = env_get("bootm_low");
114 ulong tmp = hextoul(s, NULL);
118 #if defined(CONFIG_SYS_SDRAM_BASE)
119 return CONFIG_SYS_SDRAM_BASE;
120 #elif defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_RISCV)
121 return gd->bd->bi_dram[0].start;
127 phys_size_t env_get_bootm_size(void)
129 phys_size_t tmp, size;
131 char *s = env_get("bootm_size");
134 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
138 start = gd->ram_base;
141 if (start + size > gd->ram_top)
142 size = gd->ram_top - start;
144 s = env_get("bootm_low");
146 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
150 return size - (tmp - start);
153 phys_size_t env_get_bootm_mapsize(void)
156 char *s = env_get("bootm_mapsize");
159 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
163 #if defined(CONFIG_SYS_BOOTMAPSZ)
164 return CONFIG_SYS_BOOTMAPSZ;
166 return env_get_bootm_size();
170 void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
175 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
181 size_t tail = (len > chunksz) ? chunksz : len;
188 memmove(to, from, tail);
195 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
196 memmove(to, from, len);
197 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
201 * genimg_get_kernel_addr_fit - get the real kernel address and return 2
203 * @img_addr: a string might contain real image address
204 * @fit_uname_config: double pointer to a char, will hold pointer to a
205 * configuration unit name
206 * @fit_uname_kernel: double pointer to a char, will hold pointer to a subimage
209 * genimg_get_kernel_addr_fit get the real kernel start address from a string
210 * which is normally the first argv of bootm/bootz
213 * kernel start address
215 ulong genimg_get_kernel_addr_fit(char * const img_addr,
216 const char **fit_uname_config,
217 const char **fit_uname_kernel)
221 /* find out kernel image address */
223 kernel_addr = image_load_addr;
224 debug("* kernel: default image load address = 0x%08lx\n",
226 } else if (CONFIG_IS_ENABLED(FIT) &&
227 fit_parse_conf(img_addr, image_load_addr, &kernel_addr,
229 debug("* kernel: config '%s' from image at 0x%08lx\n",
230 *fit_uname_config, kernel_addr);
231 } else if (CONFIG_IS_ENABLED(FIT) &&
232 fit_parse_subimage(img_addr, image_load_addr, &kernel_addr,
234 debug("* kernel: subimage '%s' from image at 0x%08lx\n",
235 *fit_uname_kernel, kernel_addr);
237 kernel_addr = hextoul(img_addr, NULL);
238 debug("* kernel: cmdline image address = 0x%08lx\n",
246 * genimg_get_kernel_addr() is the simple version of
247 * genimg_get_kernel_addr_fit(). It ignores those return FIT strings
249 ulong genimg_get_kernel_addr(char * const img_addr)
251 const char *fit_uname_config = NULL;
252 const char *fit_uname_kernel = NULL;
254 return genimg_get_kernel_addr_fit(img_addr, &fit_uname_config,
259 * genimg_get_format - get image format type
260 * @img_addr: image start address
262 * genimg_get_format() checks whether provided address points to a valid
263 * legacy or FIT image.
265 * New uImage format and FDT blob are based on a libfdt. FDT blob
266 * may be passed directly or embedded in a FIT image. In both situations
267 * genimg_get_format() must be able to dectect libfdt header.
270 * image format type or IMAGE_FORMAT_INVALID if no image is present
272 int genimg_get_format(const void *img_addr)
274 if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
275 const image_header_t *hdr;
277 hdr = (const image_header_t *)img_addr;
278 if (image_check_magic(hdr))
279 return IMAGE_FORMAT_LEGACY;
281 if (CONFIG_IS_ENABLED(FIT) || CONFIG_IS_ENABLED(OF_LIBFDT)) {
282 if (!fdt_check_header(img_addr))
283 return IMAGE_FORMAT_FIT;
285 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE) &&
286 !android_image_check_header(img_addr))
287 return IMAGE_FORMAT_ANDROID;
289 return IMAGE_FORMAT_INVALID;
293 * fit_has_config - check if there is a valid FIT configuration
294 * @images: pointer to the bootm command headers structure
296 * fit_has_config() checks if there is a FIT configuration in use
297 * (if FTI support is present).
300 * 0, no FIT support or no configuration found
301 * 1, configuration found
303 int genimg_has_config(bootm_headers_t *images)
305 if (CONFIG_IS_ENABLED(FIT) && images->fit_uname_cfg)
312 * select_ramdisk() - Select and locate the ramdisk to use
314 * @images: pointer to the bootm images structure
315 * @select: name of ramdisk to select, or hex address, NULL for any
316 * @arch: expected ramdisk architecture
317 * @rd_datap: pointer to a ulong variable, will hold ramdisk pointer
318 * @rd_lenp: pointer to a ulong variable, will hold ramdisk length
319 * Return: 0 if OK, -ENOPKG if no ramdisk (but an error should not be reported),
320 * other -ve value on other error
322 static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
323 ulong *rd_datap, ulong *rd_lenp)
325 const char *fit_uname_config;
326 const char *fit_uname_ramdisk;
332 #if CONFIG_IS_ENABLED(FIT)
333 fit_uname_config = images->fit_uname_cfg;
334 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 case IMAGE_FORMAT_LEGACY:
390 if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
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);
408 case IMAGE_FORMAT_FIT:
409 if (CONFIG_IS_ENABLED(FIT)) {
410 rd_noffset = fit_image_load(images, rd_addr,
411 &fit_uname_ramdisk, &fit_uname_config,
412 arch, IH_TYPE_RAMDISK,
413 BOOTSTAGE_ID_FIT_RD_START,
414 FIT_LOAD_OPTIONAL_NON_ZERO,
419 images->fit_hdr_rd = map_sysmem(rd_addr, 0);
420 images->fit_uname_rd = fit_uname_ramdisk;
421 images->fit_noffset_rd = rd_noffset;
425 case IMAGE_FORMAT_ANDROID:
426 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
427 void *ptr = map_sysmem(images->os.start, 0);
430 ret = android_image_get_ramdisk(ptr, rd_datap,
441 if (IS_ENABLED(CONFIG_SUPPORT_RAW_INITRD)) {
445 end = strchr(select, ':');
447 *rd_lenp = hextoul(++end, NULL);
454 puts("Wrong Ramdisk Image Format\n");
463 * boot_get_ramdisk - main ramdisk handling routine
464 * @argc: command argument count
465 * @argv: command argument list
466 * @images: pointer to the bootm images structure
467 * @arch: expected ramdisk architecture
468 * @rd_start: pointer to a ulong variable, will hold ramdisk start address
469 * @rd_end: pointer to a ulong variable, will hold ramdisk end
471 * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
472 * Currently supported are the following ramdisk sources:
473 * - multicomponent kernel/ramdisk image,
474 * - commandline provided address of decicated ramdisk image.
477 * 0, if ramdisk image was found and valid, or skiped
478 * rd_start and rd_end are set to ramdisk start/end addresses if
479 * ramdisk image is found and valid
481 * 1, if ramdisk image is found but corrupted, or invalid
482 * rd_start and rd_end are set to 0 if no ramdisk exists
484 int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
485 u8 arch, ulong *rd_start, ulong *rd_end)
487 ulong rd_data, rd_len;
488 const char *select = NULL;
493 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
496 /* Look for an Android boot image */
497 buf = map_sysmem(images->os.start, 0);
498 if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
499 select = (argc == 0) ? env_get("loadaddr") : argv[0];
506 * Look for a '-' which indicates to ignore the
509 if (select && strcmp(select, "-") == 0) {
510 debug("## Skipping init Ramdisk\n");
513 } else if (select || genimg_has_config(images)) {
516 ret = select_ramdisk(images, select, arch, &rd_data, &rd_len);
521 } else if (images->legacy_hdr_valid &&
522 image_check_type(&images->legacy_hdr_os_copy,
525 * Now check if we have a legacy mult-component image,
526 * get second entry data start address and len.
528 bootstage_mark(BOOTSTAGE_ID_RAMDISK);
529 printf("## Loading init Ramdisk from multi component Legacy Image at %08lx ...\n",
530 (ulong)images->legacy_hdr_os);
532 image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
537 bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
543 debug("## No init Ramdisk\n");
546 *rd_end = rd_data + rd_len;
548 debug(" ramdisk start = 0x%08lx, ramdisk end = 0x%08lx\n",
554 #if defined(CONFIG_LMB)
556 * boot_ramdisk_high - relocate init ramdisk
557 * @lmb: pointer to lmb handle, will be used for memory mgmt
558 * @rd_data: ramdisk data start address
559 * @rd_len: ramdisk data length
560 * @initrd_start: pointer to a ulong variable, will hold final init ramdisk
561 * start address (after possible relocation)
562 * @initrd_end: pointer to a ulong variable, will hold final init ramdisk
563 * end address (after possible relocation)
565 * boot_ramdisk_high() takes a relocation hint from "initrd_high" environment
566 * variable and if requested ramdisk data is moved to a specified location.
568 * Initrd_start and initrd_end are set to final (after relocation) ramdisk
569 * start/end addresses if ramdisk image start and len were provided,
570 * otherwise set initrd_start and initrd_end set to zeros.
576 int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
577 ulong *initrd_start, ulong *initrd_end)
581 int initrd_copy_to_ram = 1;
583 s = env_get("initrd_high");
585 /* a value of "no" or a similar string will act like 0,
586 * turning the "load high" feature off. This is intentional.
588 initrd_high = hextoul(s, NULL);
589 if (initrd_high == ~0)
590 initrd_copy_to_ram = 0;
592 initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
595 debug("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
596 initrd_high, initrd_copy_to_ram);
599 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
600 debug(" in-place initrd\n");
601 *initrd_start = rd_data;
602 *initrd_end = rd_data + rd_len;
603 lmb_reserve(lmb, rd_data, rd_len);
606 *initrd_start = (ulong)lmb_alloc_base(lmb,
607 rd_len, 0x1000, initrd_high);
609 *initrd_start = (ulong)lmb_alloc(lmb, rd_len,
612 if (*initrd_start == 0) {
613 puts("ramdisk - allocation error\n");
616 bootstage_mark(BOOTSTAGE_ID_COPY_RAMDISK);
618 *initrd_end = *initrd_start + rd_len;
619 printf(" Loading Ramdisk to %08lx, end %08lx ... ",
620 *initrd_start, *initrd_end);
622 memmove_wd((void *)*initrd_start,
623 (void *)rd_data, rd_len, CHUNKSZ);
626 * Ensure the image is flushed to memory to handle
627 * AMP boot scenarios in which we might not be
630 if (IS_ENABLED(CONFIG_MP)) {
631 flush_cache((unsigned long)*initrd_start,
632 ALIGN(rd_len, ARCH_DMA_MINALIGN));
640 debug(" ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
641 *initrd_start, *initrd_end);
650 int boot_get_setup(bootm_headers_t *images, u8 arch,
651 ulong *setup_start, ulong *setup_len)
653 if (!CONFIG_IS_ENABLED(FIT))
656 return boot_get_setup_fit(images, arch, setup_start, setup_len);
659 int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
660 u8 arch, const ulong *ld_start, ulong * const ld_len)
662 ulong tmp_img_addr, img_data, img_len;
666 const char *uname, *name;
668 int devnum = 0; /* TODO support multi fpga platforms */
670 if (!IS_ENABLED(CONFIG_FPGA))
673 /* Check to see if the images struct has a FIT configuration */
674 if (!genimg_has_config(images)) {
675 debug("## FIT configuration was not specified\n");
680 * Obtain the os FIT header from the images struct
682 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
683 buf = map_sysmem(tmp_img_addr, 0);
685 * Check image type. For FIT images get FIT node
686 * and attempt to locate a generic binary.
688 switch (genimg_get_format(buf)) {
689 case IMAGE_FORMAT_FIT:
690 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
692 uname = fdt_stringlist_get(buf, conf_noffset, FIT_FPGA_PROP, 0,
695 debug("## FPGA image is not specified\n");
698 fit_img_result = fit_image_load(images,
700 (const char **)&uname,
701 &images->fit_uname_cfg,
704 BOOTSTAGE_ID_FPGA_INIT,
705 FIT_LOAD_OPTIONAL_NON_ZERO,
706 &img_data, &img_len);
708 debug("FPGA image (%s) loaded to 0x%lx/size 0x%lx\n",
709 uname, img_data, img_len);
711 if (fit_img_result < 0) {
712 /* Something went wrong! */
713 return fit_img_result;
716 if (!fpga_is_partial_data(devnum, img_len)) {
718 err = fpga_loadbitstream(devnum, (char *)img_data,
721 err = fpga_load(devnum, (const void *)img_data,
722 img_len, BIT_FULL, 0);
725 err = fpga_loadbitstream(devnum, (char *)img_data,
726 img_len, BIT_PARTIAL);
728 err = fpga_load(devnum, (const void *)img_data,
729 img_len, BIT_PARTIAL, 0);
735 printf(" Programming %s bitstream... OK\n", name);
738 printf("The given image format is not supported (corrupt?)\n");
745 static void fit_loadable_process(u8 img_type,
750 const unsigned int count =
751 ll_entry_count(struct fit_loadable_tbl, fit_loadable);
752 struct fit_loadable_tbl *fit_loadable_handler =
753 ll_entry_start(struct fit_loadable_tbl, fit_loadable);
754 /* For each loadable handler */
755 for (i = 0; i < count; i++, fit_loadable_handler++)
756 /* matching this type */
757 if (fit_loadable_handler->type == img_type)
758 /* call that handler with this image data */
759 fit_loadable_handler->handler(img_data, img_len);
762 int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
763 u8 arch, const ulong *ld_start, ulong * const ld_len)
766 * These variables are used to hold the current image location
771 * These two variables are requirements for fit_image_load, but
772 * their values are not used
774 ulong img_data, img_len;
782 /* Check to see if the images struct has a FIT configuration */
783 if (!genimg_has_config(images)) {
784 debug("## FIT configuration was not specified\n");
789 * Obtain the os FIT header from the images struct
791 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
792 buf = map_sysmem(tmp_img_addr, 0);
794 * Check image type. For FIT images get FIT node
795 * and attempt to locate a generic binary.
797 switch (genimg_get_format(buf)) {
798 case IMAGE_FORMAT_FIT:
799 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
801 for (loadables_index = 0;
802 uname = fdt_stringlist_get(buf, conf_noffset,
804 loadables_index, NULL), uname;
806 fit_img_result = fit_image_load(images, tmp_img_addr,
808 &images->fit_uname_cfg,
809 arch, IH_TYPE_LOADABLE,
810 BOOTSTAGE_ID_FIT_LOADABLE_START,
811 FIT_LOAD_OPTIONAL_NON_ZERO,
812 &img_data, &img_len);
813 if (fit_img_result < 0) {
814 /* Something went wrong! */
815 return fit_img_result;
818 fit_img_result = fit_image_get_node(buf, uname);
819 if (fit_img_result < 0) {
820 /* Something went wrong! */
821 return fit_img_result;
823 fit_img_result = fit_image_get_type(buf,
826 if (fit_img_result < 0) {
827 /* Something went wrong! */
828 return fit_img_result;
831 fit_loadable_process(img_type, img_data, img_len);
835 printf("The given image format is not supported (corrupt?)\n");
842 #if defined(CONFIG_LMB)
843 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
845 * boot_get_cmdline - allocate and initialize kernel cmdline
846 * @lmb: pointer to lmb handle, will be used for memory mgmt
847 * @cmd_start: pointer to a ulong variable, will hold cmdline start
848 * @cmd_end: pointer to a ulong variable, will hold cmdline end
850 * boot_get_cmdline() allocates space for kernel command line below
851 * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environment
852 * variable is present its contents is copied to allocated kernel
859 int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
864 cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
865 env_get_bootm_mapsize() + env_get_bootm_low());
869 s = env_get("bootargs");
875 *cmd_start = (ulong)cmdline;
876 *cmd_end = *cmd_start + strlen(cmdline);
878 debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
884 * boot_get_kbd - allocate and initialize kernel copy of board info
885 * @lmb: pointer to lmb handle, will be used for memory mgmt
886 * @kbd: double pointer to board info data
888 * boot_get_kbd() allocates space for kernel copy of board info data below
889 * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
890 * with the current u-boot board info data.
896 int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
898 *kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
899 sizeof(struct bd_info),
901 env_get_bootm_mapsize() +
902 env_get_bootm_low());
908 debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
911 if (IS_ENABLED(CONFIG_CMD_BDI))
912 do_bdinfo(NULL, 0, 0, NULL);
919 int image_setup_linux(bootm_headers_t *images)
921 ulong of_size = images->ft_len;
922 char **of_flat_tree = &images->ft_addr;
923 struct lmb *lmb = &images->lmb;
926 if (CONFIG_IS_ENABLED(OF_LIBFDT))
927 boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
929 if (IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE)) {
930 ret = boot_get_cmdline(lmb, &images->cmdline_start,
931 &images->cmdline_end);
933 puts("ERROR with allocation of cmdline\n");
938 if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
939 ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
944 if (CONFIG_IS_ENABLED(OF_LIBFDT) && of_size) {
945 ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
954 void genimg_print_size(uint32_t size)
956 printf("%d Bytes = ", size);
957 print_size(size, "\n");
960 void genimg_print_time(time_t timestamp)
964 rtc_to_tm(timestamp, &tm);
965 printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
966 tm.tm_year, tm.tm_mon, tm.tm_mday,
967 tm.tm_hour, tm.tm_min, tm.tm_sec);