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>
23 #include <asm/cache.h>
24 #include <asm/global_data.h>
26 DECLARE_GLOBAL_DATA_PTR;
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 struct legacy_img_hdr *image_get_ramdisk(ulong rd_addr, u8 arch,
46 const struct legacy_img_hdr *rd_hdr = (const struct legacy_img_hdr *)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);
87 /*****************************************************************************/
88 /* Shared dual-format routines */
89 /*****************************************************************************/
90 ulong image_load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
91 ulong image_save_addr; /* Default Save Address */
92 ulong image_save_size; /* Default Save Size (in bytes) */
94 static int on_loadaddr(const char *name, const char *value, enum env_op op,
99 case env_op_overwrite:
100 image_load_addr = hextoul(value, NULL);
108 U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
110 ulong env_get_bootm_low(void)
112 char *s = env_get("bootm_low");
115 ulong tmp = hextoul(s, NULL);
119 #if defined(CONFIG_SYS_SDRAM_BASE)
120 return CONFIG_SYS_SDRAM_BASE;
121 #elif defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_RISCV)
122 return gd->bd->bi_dram[0].start;
128 phys_size_t env_get_bootm_size(void)
130 phys_size_t tmp, size;
132 char *s = env_get("bootm_size");
135 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
139 start = gd->ram_base;
142 if (start + size > gd->ram_top)
143 size = gd->ram_top - start;
145 s = env_get("bootm_low");
147 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
151 return size - (tmp - start);
154 phys_size_t env_get_bootm_mapsize(void)
157 char *s = env_get("bootm_mapsize");
160 tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
164 #if defined(CONFIG_SYS_BOOTMAPSZ)
165 return CONFIG_SYS_BOOTMAPSZ;
167 return env_get_bootm_size();
171 void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
176 if (IS_ENABLED(CONFIG_HW_WATCHDOG) || IS_ENABLED(CONFIG_WATCHDOG)) {
182 size_t tail = (len > chunksz) ? chunksz : len;
189 memmove(to, from, tail);
197 memmove(to, from, len);
202 * genimg_get_kernel_addr_fit - get the real kernel address and return 2
204 * @img_addr: a string might contain real image address
205 * @fit_uname_config: double pointer to a char, will hold pointer to a
206 * configuration unit name
207 * @fit_uname_kernel: double pointer to a char, will hold pointer to a subimage
210 * genimg_get_kernel_addr_fit get the real kernel start address from a string
211 * which is normally the first argv of bootm/bootz
214 * kernel start address
216 ulong genimg_get_kernel_addr_fit(char * const img_addr,
217 const char **fit_uname_config,
218 const char **fit_uname_kernel)
222 /* find out kernel image address */
224 kernel_addr = image_load_addr;
225 debug("* kernel: default image load address = 0x%08lx\n",
227 } else if (CONFIG_IS_ENABLED(FIT) &&
228 fit_parse_conf(img_addr, image_load_addr, &kernel_addr,
230 debug("* kernel: config '%s' from image at 0x%08lx\n",
231 *fit_uname_config, kernel_addr);
232 } else if (CONFIG_IS_ENABLED(FIT) &&
233 fit_parse_subimage(img_addr, image_load_addr, &kernel_addr,
235 debug("* kernel: subimage '%s' from image at 0x%08lx\n",
236 *fit_uname_kernel, kernel_addr);
238 kernel_addr = hextoul(img_addr, NULL);
239 debug("* kernel: cmdline image address = 0x%08lx\n",
247 * genimg_get_kernel_addr() is the simple version of
248 * genimg_get_kernel_addr_fit(). It ignores those return FIT strings
250 ulong genimg_get_kernel_addr(char * const img_addr)
252 const char *fit_uname_config = NULL;
253 const char *fit_uname_kernel = NULL;
255 return genimg_get_kernel_addr_fit(img_addr, &fit_uname_config,
260 * genimg_get_format - get image format type
261 * @img_addr: image start address
263 * genimg_get_format() checks whether provided address points to a valid
264 * legacy or FIT image.
266 * New uImage format and FDT blob are based on a libfdt. FDT blob
267 * may be passed directly or embedded in a FIT image. In both situations
268 * genimg_get_format() must be able to dectect libfdt header.
271 * image format type or IMAGE_FORMAT_INVALID if no image is present
273 int genimg_get_format(const void *img_addr)
275 if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
276 const struct legacy_img_hdr *hdr;
278 hdr = (const struct legacy_img_hdr *)img_addr;
279 if (image_check_magic(hdr))
280 return IMAGE_FORMAT_LEGACY;
282 if (CONFIG_IS_ENABLED(FIT) || CONFIG_IS_ENABLED(OF_LIBFDT)) {
283 if (!fdt_check_header(img_addr))
284 return IMAGE_FORMAT_FIT;
286 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE) &&
287 !android_image_check_header(img_addr))
288 return IMAGE_FORMAT_ANDROID;
290 return IMAGE_FORMAT_INVALID;
294 * fit_has_config - check if there is a valid FIT configuration
295 * @images: pointer to the bootm command headers structure
297 * fit_has_config() checks if there is a FIT configuration in use
298 * (if FTI support is present).
301 * 0, no FIT support or no configuration found
302 * 1, configuration found
304 int genimg_has_config(struct bootm_headers *images)
306 if (CONFIG_IS_ENABLED(FIT) && images->fit_uname_cfg)
313 * select_ramdisk() - Select and locate the ramdisk to use
315 * @images: pointer to the bootm images structure
316 * @select: name of ramdisk to select, or hex address, NULL for any
317 * @arch: expected ramdisk architecture
318 * @rd_datap: pointer to a ulong variable, will hold ramdisk pointer
319 * @rd_lenp: pointer to a ulong variable, will hold ramdisk length
320 * Return: 0 if OK, -ENOPKG if no ramdisk (but an error should not be reported),
321 * other -ve value on other error
323 static int select_ramdisk(struct bootm_headers *images, const char *select, u8 arch,
324 ulong *rd_datap, ulong *rd_lenp)
326 const char *fit_uname_config;
327 const char *fit_uname_ramdisk;
328 bool done_select = !select;
334 if (CONFIG_IS_ENABLED(FIT)) {
335 fit_uname_config = images->fit_uname_cfg;
336 fit_uname_ramdisk = NULL;
341 * If the init ramdisk comes from the FIT image and
342 * the FIT image address is omitted in the command
343 * line argument, try to use os FIT image address or
344 * default load address.
346 if (images->fit_uname_os)
347 default_addr = (ulong)images->fit_hdr_os;
349 default_addr = image_load_addr;
351 if (fit_parse_conf(select, default_addr, &rd_addr,
352 &fit_uname_config)) {
353 debug("* ramdisk: config '%s' from image at 0x%08lx\n",
354 fit_uname_config, rd_addr);
356 } else if (fit_parse_subimage(select, default_addr,
358 &fit_uname_ramdisk)) {
359 debug("* ramdisk: subimage '%s' from image at 0x%08lx\n",
360 fit_uname_ramdisk, rd_addr);
366 rd_addr = hextoul(select, NULL);
367 debug("* ramdisk: cmdline image address = 0x%08lx\n", rd_addr);
369 if (CONFIG_IS_ENABLED(FIT) && !select) {
370 /* use FIT configuration provided in first bootm
371 * command argument. If the property is not defined,
372 * quit silently (with -ENOPKG)
374 rd_addr = map_to_sysmem(images->fit_hdr_os);
375 rd_noffset = fit_get_node_from_config(images, FIT_RAMDISK_PROP,
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 struct legacy_img_hdr *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,
414 arch, IH_TYPE_RAMDISK,
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, rd_lenp);
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[], struct bootm_headers *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",
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);
649 int boot_get_setup(struct bootm_headers *images, u8 arch,
650 ulong *setup_start, ulong *setup_len)
652 if (!CONFIG_IS_ENABLED(FIT))
655 return boot_get_setup_fit(images, arch, setup_start, setup_len);
658 int boot_get_fpga(int argc, char *const argv[], struct bootm_headers *images,
659 u8 arch, const ulong *ld_start, ulong * const ld_len)
661 ulong tmp_img_addr, img_data, img_len;
665 const char *uname, *name;
667 int devnum = 0; /* TODO support multi fpga platforms */
669 if (!IS_ENABLED(CONFIG_FPGA))
672 /* Check to see if the images struct has a FIT configuration */
673 if (!genimg_has_config(images)) {
674 debug("## FIT configuration was not specified\n");
679 * Obtain the os FIT header from the images struct
681 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
682 buf = map_sysmem(tmp_img_addr, 0);
684 * Check image type. For FIT images get FIT node
685 * and attempt to locate a generic binary.
687 switch (genimg_get_format(buf)) {
688 case IMAGE_FORMAT_FIT:
689 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
691 uname = fdt_stringlist_get(buf, conf_noffset, FIT_FPGA_PROP, 0,
694 debug("## FPGA image is not specified\n");
697 fit_img_result = fit_image_load(images,
699 (const char **)&uname,
700 &images->fit_uname_cfg,
703 BOOTSTAGE_ID_FPGA_INIT,
704 FIT_LOAD_OPTIONAL_NON_ZERO,
705 &img_data, &img_len);
707 debug("FPGA image (%s) loaded to 0x%lx/size 0x%lx\n",
708 uname, img_data, img_len);
710 if (fit_img_result < 0) {
711 /* Something went wrong! */
712 return fit_img_result;
715 if (!fpga_is_partial_data(devnum, img_len)) {
717 err = fpga_loadbitstream(devnum, (char *)img_data,
720 err = fpga_load(devnum, (const void *)img_data,
721 img_len, BIT_FULL, 0);
724 err = fpga_loadbitstream(devnum, (char *)img_data,
725 img_len, BIT_PARTIAL);
727 err = fpga_load(devnum, (const void *)img_data,
728 img_len, BIT_PARTIAL, 0);
734 printf(" Programming %s bitstream... OK\n", name);
737 printf("The given image format is not supported (corrupt?)\n");
744 static void fit_loadable_process(u8 img_type,
749 const unsigned int count =
750 ll_entry_count(struct fit_loadable_tbl, fit_loadable);
751 struct fit_loadable_tbl *fit_loadable_handler =
752 ll_entry_start(struct fit_loadable_tbl, fit_loadable);
753 /* For each loadable handler */
754 for (i = 0; i < count; i++, fit_loadable_handler++)
755 /* matching this type */
756 if (fit_loadable_handler->type == img_type)
757 /* call that handler with this image data */
758 fit_loadable_handler->handler(img_data, img_len);
761 int boot_get_loadable(int argc, char *const argv[], struct bootm_headers *images,
762 u8 arch, const ulong *ld_start, ulong * const ld_len)
765 * These variables are used to hold the current image location
770 * These two variables are requirements for fit_image_load, but
771 * their values are not used
773 ulong img_data, img_len;
781 /* Check to see if the images struct has a FIT configuration */
782 if (!genimg_has_config(images)) {
783 debug("## FIT configuration was not specified\n");
788 * Obtain the os FIT header from the images struct
790 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
791 buf = map_sysmem(tmp_img_addr, 0);
793 * Check image type. For FIT images get FIT node
794 * and attempt to locate a generic binary.
796 switch (genimg_get_format(buf)) {
797 case IMAGE_FORMAT_FIT:
798 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
800 for (loadables_index = 0;
801 uname = fdt_stringlist_get(buf, conf_noffset,
803 loadables_index, NULL), uname;
805 fit_img_result = fit_image_load(images, tmp_img_addr,
807 &images->fit_uname_cfg,
808 arch, IH_TYPE_LOADABLE,
809 BOOTSTAGE_ID_FIT_LOADABLE_START,
810 FIT_LOAD_OPTIONAL_NON_ZERO,
811 &img_data, &img_len);
812 if (fit_img_result < 0) {
813 /* Something went wrong! */
814 return fit_img_result;
817 fit_img_result = fit_image_get_node(buf, uname);
818 if (fit_img_result < 0) {
819 /* Something went wrong! */
820 return fit_img_result;
822 fit_img_result = fit_image_get_type(buf,
825 if (fit_img_result < 0) {
826 /* Something went wrong! */
827 return fit_img_result;
830 fit_loadable_process(img_type, img_data, img_len);
834 printf("The given image format is not supported (corrupt?)\n");
842 * boot_get_cmdline - allocate and initialize kernel cmdline
843 * @lmb: pointer to lmb handle, will be used for memory mgmt
844 * @cmd_start: pointer to a ulong variable, will hold cmdline start
845 * @cmd_end: pointer to a ulong variable, will hold cmdline end
847 * This allocates space for kernel command line below
848 * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environment
849 * variable is present its contents is copied to allocated kernel
856 int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
863 * Help the compiler detect that this function is only called when
864 * CONFIG_SYS_BOOT_GET_CMDLINE is enabled
866 if (!IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE))
869 barg = IF_ENABLED_INT(CONFIG_SYS_BOOT_GET_CMDLINE, CONFIG_SYS_BARGSIZE);
870 cmdline = (char *)(ulong)lmb_alloc_base(lmb, barg, 0xf,
871 env_get_bootm_mapsize() + env_get_bootm_low());
875 s = env_get("bootargs");
881 *cmd_start = (ulong)cmdline;
882 *cmd_end = *cmd_start + strlen(cmdline);
884 debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
890 * boot_get_kbd - allocate and initialize kernel copy of board info
891 * @lmb: pointer to lmb handle, will be used for memory mgmt
892 * @kbd: double pointer to board info data
894 * boot_get_kbd() allocates space for kernel copy of board info data below
895 * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
896 * with the current u-boot board info data.
902 int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
904 *kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
905 sizeof(struct bd_info),
907 env_get_bootm_mapsize() +
908 env_get_bootm_low());
914 debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
916 if (_DEBUG && IS_ENABLED(CONFIG_CMD_BDI))
917 do_bdinfo(NULL, 0, 0, NULL);
922 int image_setup_linux(struct bootm_headers *images)
924 ulong of_size = images->ft_len;
925 char **of_flat_tree = &images->ft_addr;
926 struct lmb *lmb = images_lmb(images);
929 /* This function cannot be called without lmb support */
930 if (!CONFIG_IS_ENABLED(LMB))
932 if (CONFIG_IS_ENABLED(OF_LIBFDT))
933 boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
935 if (IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE)) {
936 ret = boot_get_cmdline(lmb, &images->cmdline_start,
937 &images->cmdline_end);
939 puts("ERROR with allocation of cmdline\n");
944 if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
945 ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
950 if (CONFIG_IS_ENABLED(OF_LIBFDT) && of_size) {
951 ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
959 void genimg_print_size(uint32_t size)
961 printf("%d Bytes = ", size);
962 print_size(size, "\n");
965 void genimg_print_time(time_t timestamp)
969 rtc_to_tm(timestamp, &tm);
970 printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
971 tm.tm_year, tm.tm_mon, tm.tm_mday,
972 tm.tm_hour, tm.tm_min, tm.tm_sec);