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)
368 if (CONFIG_IS_ENABLED(FIT) && !select) {
369 /* use FIT configuration provided in first bootm
370 * command argument. If the property is not defined,
371 * quit silently (with -ENOPKG)
373 rd_addr = map_to_sysmem(images->fit_hdr_os);
374 rd_noffset = fit_get_node_from_config(images,
377 if (rd_noffset == -ENOENT)
379 else if (rd_noffset < 0)
384 * Check if there is an initrd image at the
385 * address provided in the second bootm argument
386 * check image type, for FIT images get FIT node.
388 buf = map_sysmem(rd_addr, 0);
389 switch (genimg_get_format(buf)) {
390 case IMAGE_FORMAT_LEGACY:
391 if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
392 const image_header_t *rd_hdr;
394 printf("## Loading init Ramdisk from Legacy Image at %08lx ...\n",
397 bootstage_mark(BOOTSTAGE_ID_CHECK_RAMDISK);
398 rd_hdr = image_get_ramdisk(rd_addr, arch,
404 *rd_datap = image_get_data(rd_hdr);
405 *rd_lenp = image_get_data_size(rd_hdr);
409 case IMAGE_FORMAT_FIT:
410 if (CONFIG_IS_ENABLED(FIT)) {
411 rd_noffset = fit_image_load(images, rd_addr,
412 &fit_uname_ramdisk, &fit_uname_config,
413 arch, IH_TYPE_RAMDISK,
414 BOOTSTAGE_ID_FIT_RD_START,
415 FIT_LOAD_OPTIONAL_NON_ZERO,
420 images->fit_hdr_rd = map_sysmem(rd_addr, 0);
421 images->fit_uname_rd = fit_uname_ramdisk;
422 images->fit_noffset_rd = rd_noffset;
426 case IMAGE_FORMAT_ANDROID:
427 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
428 void *ptr = map_sysmem(images->os.start, 0);
431 ret = android_image_get_ramdisk(ptr, rd_datap,
442 if (IS_ENABLED(CONFIG_SUPPORT_RAW_INITRD)) {
446 end = strchr(select, ':');
448 *rd_lenp = hextoul(++end, NULL);
455 puts("Wrong Ramdisk Image Format\n");
464 * boot_get_ramdisk - main ramdisk handling routine
465 * @argc: command argument count
466 * @argv: command argument list
467 * @images: pointer to the bootm images structure
468 * @arch: expected ramdisk architecture
469 * @rd_start: pointer to a ulong variable, will hold ramdisk start address
470 * @rd_end: pointer to a ulong variable, will hold ramdisk end
472 * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
473 * Currently supported are the following ramdisk sources:
474 * - multicomponent kernel/ramdisk image,
475 * - commandline provided address of decicated ramdisk image.
478 * 0, if ramdisk image was found and valid, or skiped
479 * rd_start and rd_end are set to ramdisk start/end addresses if
480 * ramdisk image is found and valid
482 * 1, if ramdisk image is found but corrupted, or invalid
483 * rd_start and rd_end are set to 0 if no ramdisk exists
485 int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
486 u8 arch, ulong *rd_start, ulong *rd_end)
488 ulong rd_data, rd_len;
489 const char *select = NULL;
494 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
497 /* Look for an Android boot image */
498 buf = map_sysmem(images->os.start, 0);
499 if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
500 select = (argc == 0) ? env_get("loadaddr") : argv[0];
507 * Look for a '-' which indicates to ignore the
510 if (select && strcmp(select, "-") == 0) {
511 debug("## Skipping init Ramdisk\n");
514 } else if (select || genimg_has_config(images)) {
517 ret = select_ramdisk(images, select, arch, &rd_data, &rd_len);
522 } else if (images->legacy_hdr_valid &&
523 image_check_type(&images->legacy_hdr_os_copy,
526 * Now check if we have a legacy mult-component image,
527 * get second entry data start address and len.
529 bootstage_mark(BOOTSTAGE_ID_RAMDISK);
530 printf("## Loading init Ramdisk from multi component Legacy Image at %08lx ...\n",
531 (ulong)images->legacy_hdr_os);
533 image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
538 bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
544 debug("## No init Ramdisk\n");
547 *rd_end = rd_data + rd_len;
549 debug(" ramdisk start = 0x%08lx, ramdisk end = 0x%08lx\n",
555 #if defined(CONFIG_LMB)
557 * boot_ramdisk_high - relocate init ramdisk
558 * @lmb: pointer to lmb handle, will be used for memory mgmt
559 * @rd_data: ramdisk data start address
560 * @rd_len: ramdisk data length
561 * @initrd_start: pointer to a ulong variable, will hold final init ramdisk
562 * start address (after possible relocation)
563 * @initrd_end: pointer to a ulong variable, will hold final init ramdisk
564 * end address (after possible relocation)
566 * boot_ramdisk_high() takes a relocation hint from "initrd_high" environment
567 * variable and if requested ramdisk data is moved to a specified location.
569 * Initrd_start and initrd_end are set to final (after relocation) ramdisk
570 * start/end addresses if ramdisk image start and len were provided,
571 * otherwise set initrd_start and initrd_end set to zeros.
577 int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
578 ulong *initrd_start, ulong *initrd_end)
582 int initrd_copy_to_ram = 1;
584 s = env_get("initrd_high");
586 /* a value of "no" or a similar string will act like 0,
587 * turning the "load high" feature off. This is intentional.
589 initrd_high = hextoul(s, NULL);
590 if (initrd_high == ~0)
591 initrd_copy_to_ram = 0;
593 initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
596 debug("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
597 initrd_high, initrd_copy_to_ram);
600 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
601 debug(" in-place initrd\n");
602 *initrd_start = rd_data;
603 *initrd_end = rd_data + rd_len;
604 lmb_reserve(lmb, rd_data, rd_len);
607 *initrd_start = (ulong)lmb_alloc_base(lmb,
608 rd_len, 0x1000, initrd_high);
610 *initrd_start = (ulong)lmb_alloc(lmb, rd_len,
613 if (*initrd_start == 0) {
614 puts("ramdisk - allocation error\n");
617 bootstage_mark(BOOTSTAGE_ID_COPY_RAMDISK);
619 *initrd_end = *initrd_start + rd_len;
620 printf(" Loading Ramdisk to %08lx, end %08lx ... ",
621 *initrd_start, *initrd_end);
623 memmove_wd((void *)*initrd_start,
624 (void *)rd_data, rd_len, CHUNKSZ);
627 * Ensure the image is flushed to memory to handle
628 * AMP boot scenarios in which we might not be
631 if (IS_ENABLED(CONFIG_MP)) {
632 flush_cache((unsigned long)*initrd_start,
633 ALIGN(rd_len, ARCH_DMA_MINALIGN));
641 debug(" ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
642 *initrd_start, *initrd_end);
651 int boot_get_setup(bootm_headers_t *images, u8 arch,
652 ulong *setup_start, ulong *setup_len)
654 if (!CONFIG_IS_ENABLED(FIT))
657 return boot_get_setup_fit(images, arch, setup_start, setup_len);
660 int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
661 u8 arch, const ulong *ld_start, ulong * const ld_len)
663 ulong tmp_img_addr, img_data, img_len;
667 const char *uname, *name;
669 int devnum = 0; /* TODO support multi fpga platforms */
671 if (!IS_ENABLED(CONFIG_FPGA))
674 /* Check to see if the images struct has a FIT configuration */
675 if (!genimg_has_config(images)) {
676 debug("## FIT configuration was not specified\n");
681 * Obtain the os FIT header from the images struct
683 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
684 buf = map_sysmem(tmp_img_addr, 0);
686 * Check image type. For FIT images get FIT node
687 * and attempt to locate a generic binary.
689 switch (genimg_get_format(buf)) {
690 case IMAGE_FORMAT_FIT:
691 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
693 uname = fdt_stringlist_get(buf, conf_noffset, FIT_FPGA_PROP, 0,
696 debug("## FPGA image is not specified\n");
699 fit_img_result = fit_image_load(images,
701 (const char **)&uname,
702 &images->fit_uname_cfg,
705 BOOTSTAGE_ID_FPGA_INIT,
706 FIT_LOAD_OPTIONAL_NON_ZERO,
707 &img_data, &img_len);
709 debug("FPGA image (%s) loaded to 0x%lx/size 0x%lx\n",
710 uname, img_data, img_len);
712 if (fit_img_result < 0) {
713 /* Something went wrong! */
714 return fit_img_result;
717 if (!fpga_is_partial_data(devnum, img_len)) {
719 err = fpga_loadbitstream(devnum, (char *)img_data,
722 err = fpga_load(devnum, (const void *)img_data,
723 img_len, BIT_FULL, 0);
726 err = fpga_loadbitstream(devnum, (char *)img_data,
727 img_len, BIT_PARTIAL);
729 err = fpga_load(devnum, (const void *)img_data,
730 img_len, BIT_PARTIAL, 0);
736 printf(" Programming %s bitstream... OK\n", name);
739 printf("The given image format is not supported (corrupt?)\n");
746 static void fit_loadable_process(u8 img_type,
751 const unsigned int count =
752 ll_entry_count(struct fit_loadable_tbl, fit_loadable);
753 struct fit_loadable_tbl *fit_loadable_handler =
754 ll_entry_start(struct fit_loadable_tbl, fit_loadable);
755 /* For each loadable handler */
756 for (i = 0; i < count; i++, fit_loadable_handler++)
757 /* matching this type */
758 if (fit_loadable_handler->type == img_type)
759 /* call that handler with this image data */
760 fit_loadable_handler->handler(img_data, img_len);
763 int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
764 u8 arch, const ulong *ld_start, ulong * const ld_len)
767 * These variables are used to hold the current image location
772 * These two variables are requirements for fit_image_load, but
773 * their values are not used
775 ulong img_data, img_len;
783 /* Check to see if the images struct has a FIT configuration */
784 if (!genimg_has_config(images)) {
785 debug("## FIT configuration was not specified\n");
790 * Obtain the os FIT header from the images struct
792 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
793 buf = map_sysmem(tmp_img_addr, 0);
795 * Check image type. For FIT images get FIT node
796 * and attempt to locate a generic binary.
798 switch (genimg_get_format(buf)) {
799 case IMAGE_FORMAT_FIT:
800 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
802 for (loadables_index = 0;
803 uname = fdt_stringlist_get(buf, conf_noffset,
805 loadables_index, NULL), uname;
807 fit_img_result = fit_image_load(images, tmp_img_addr,
809 &images->fit_uname_cfg,
810 arch, IH_TYPE_LOADABLE,
811 BOOTSTAGE_ID_FIT_LOADABLE_START,
812 FIT_LOAD_OPTIONAL_NON_ZERO,
813 &img_data, &img_len);
814 if (fit_img_result < 0) {
815 /* Something went wrong! */
816 return fit_img_result;
819 fit_img_result = fit_image_get_node(buf, uname);
820 if (fit_img_result < 0) {
821 /* Something went wrong! */
822 return fit_img_result;
824 fit_img_result = fit_image_get_type(buf,
827 if (fit_img_result < 0) {
828 /* Something went wrong! */
829 return fit_img_result;
832 fit_loadable_process(img_type, img_data, img_len);
836 printf("The given image format is not supported (corrupt?)\n");
843 #if defined(CONFIG_LMB)
844 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
846 * boot_get_cmdline - allocate and initialize kernel cmdline
847 * @lmb: pointer to lmb handle, will be used for memory mgmt
848 * @cmd_start: pointer to a ulong variable, will hold cmdline start
849 * @cmd_end: pointer to a ulong variable, will hold cmdline end
851 * boot_get_cmdline() allocates space for kernel command line below
852 * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environment
853 * variable is present its contents is copied to allocated kernel
860 int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
865 cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
866 env_get_bootm_mapsize() + env_get_bootm_low());
870 s = env_get("bootargs");
876 *cmd_start = (ulong)cmdline;
877 *cmd_end = *cmd_start + strlen(cmdline);
879 debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
885 * boot_get_kbd - allocate and initialize kernel copy of board info
886 * @lmb: pointer to lmb handle, will be used for memory mgmt
887 * @kbd: double pointer to board info data
889 * boot_get_kbd() allocates space for kernel copy of board info data below
890 * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
891 * with the current u-boot board info data.
897 int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
899 *kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
900 sizeof(struct bd_info),
902 env_get_bootm_mapsize() +
903 env_get_bootm_low());
909 debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
912 if (IS_ENABLED(CONFIG_CMD_BDI))
913 do_bdinfo(NULL, 0, 0, NULL);
920 int image_setup_linux(bootm_headers_t *images)
922 ulong of_size = images->ft_len;
923 char **of_flat_tree = &images->ft_addr;
924 struct lmb *lmb = &images->lmb;
927 if (CONFIG_IS_ENABLED(OF_LIBFDT))
928 boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
930 if (IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE)) {
931 ret = boot_get_cmdline(lmb, &images->cmdline_start,
932 &images->cmdline_end);
934 puts("ERROR with allocation of cmdline\n");
939 if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
940 ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
945 if (CONFIG_IS_ENABLED(OF_LIBFDT) && of_size) {
946 ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
955 void genimg_print_size(uint32_t size)
957 printf("%d Bytes = ", size);
958 print_size(size, "\n");
961 void genimg_print_time(time_t timestamp)
965 rtc_to_tm(timestamp, &tm);
966 printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
967 tm.tm_year, tm.tm_mon, tm.tm_mday,
968 tm.tm_hour, tm.tm_min, tm.tm_sec);