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>
21 #include <asm/cache.h>
22 #include <asm/global_data.h>
24 DECLARE_GLOBAL_DATA_PTR;
26 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
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);
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 defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
182 size_t tail = (len > chunksz) ? chunksz : len;
189 memmove(to, from, tail);
196 #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
197 memmove(to, from, len);
198 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
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 image_header_t *hdr;
278 hdr = (const image_header_t *)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(bootm_headers_t *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 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(bootm_headers_t *images, const char *select, u8 arch,
324 ulong *rd_datap, ulong *rd_lenp)
329 #if CONFIG_IS_ENABLED(FIT)
330 const char *fit_uname_config = images->fit_uname_cfg;
331 const char *fit_uname_ramdisk = NULL;
337 * If the init ramdisk comes from the FIT image and
338 * the FIT image address is omitted in the command
339 * line argument, try to use os FIT image address or
340 * default load address.
342 if (images->fit_uname_os)
343 default_addr = (ulong)images->fit_hdr_os;
345 default_addr = image_load_addr;
347 if (fit_parse_conf(select, default_addr,
348 &rd_addr, &fit_uname_config)) {
349 debug("* ramdisk: config '%s' from image at 0x%08lx\n",
350 fit_uname_config, rd_addr);
351 } else if (fit_parse_subimage(select, default_addr,
353 &fit_uname_ramdisk)) {
354 debug("* ramdisk: subimage '%s' from image at 0x%08lx\n",
355 fit_uname_ramdisk, rd_addr);
359 rd_addr = hextoul(select, NULL);
360 debug("* ramdisk: cmdline image address = 0x%08lx\n",
363 #if CONFIG_IS_ENABLED(FIT)
365 /* use FIT configuration provided in first bootm
366 * command argument. If the property is not defined,
367 * quit silently (with -ENOPKG)
369 rd_addr = map_to_sysmem(images->fit_hdr_os);
370 rd_noffset = fit_get_node_from_config(images,
373 if (rd_noffset == -ENOENT)
375 else if (rd_noffset < 0)
381 * Check if there is an initrd image at the
382 * address provided in the second bootm argument
383 * check image type, for FIT images get FIT node.
385 buf = map_sysmem(rd_addr, 0);
386 switch (genimg_get_format(buf)) {
387 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
388 case IMAGE_FORMAT_LEGACY: {
389 const image_header_t *rd_hdr;
391 printf("## Loading init Ramdisk from Legacy Image at %08lx ...\n",
394 bootstage_mark(BOOTSTAGE_ID_CHECK_RAMDISK);
395 rd_hdr = image_get_ramdisk(rd_addr, arch,
401 *rd_datap = image_get_data(rd_hdr);
402 *rd_lenp = image_get_data_size(rd_hdr);
406 #if CONFIG_IS_ENABLED(FIT)
407 case IMAGE_FORMAT_FIT:
408 rd_noffset = fit_image_load(images,
409 rd_addr, &fit_uname_ramdisk,
410 &fit_uname_config, arch,
412 BOOTSTAGE_ID_FIT_RD_START,
413 FIT_LOAD_OPTIONAL_NON_ZERO,
418 images->fit_hdr_rd = map_sysmem(rd_addr, 0);
419 images->fit_uname_rd = fit_uname_ramdisk;
420 images->fit_noffset_rd = rd_noffset;
423 #ifdef CONFIG_ANDROID_BOOT_IMAGE
424 case IMAGE_FORMAT_ANDROID:
425 android_image_get_ramdisk((void *)images->os.start,
430 if (IS_ENABLED(CONFIG_SUPPORT_RAW_INITRD)) {
434 end = strchr(select, ':');
436 *rd_lenp = hextoul(++end, NULL);
441 puts("Wrong Ramdisk Image Format\n");
449 * boot_get_ramdisk - main ramdisk handling routine
450 * @argc: command argument count
451 * @argv: command argument list
452 * @images: pointer to the bootm images structure
453 * @arch: expected ramdisk architecture
454 * @rd_start: pointer to a ulong variable, will hold ramdisk start address
455 * @rd_end: pointer to a ulong variable, will hold ramdisk end
457 * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
458 * Currently supported are the following ramdisk sources:
459 * - multicomponent kernel/ramdisk image,
460 * - commandline provided address of decicated ramdisk image.
463 * 0, if ramdisk image was found and valid, or skiped
464 * rd_start and rd_end are set to ramdisk start/end addresses if
465 * ramdisk image is found and valid
467 * 1, if ramdisk image is found but corrupted, or invalid
468 * rd_start and rd_end are set to 0 if no ramdisk exists
470 int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
471 u8 arch, ulong *rd_start, ulong *rd_end)
473 ulong rd_data, rd_len;
474 const char *select = NULL;
479 if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE)) {
482 /* Look for an Android boot image */
483 buf = map_sysmem(images->os.start, 0);
484 if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
485 select = (argc == 0) ? env_get("loadaddr") : argv[0];
492 * Look for a '-' which indicates to ignore the
495 if (select && strcmp(select, "-") == 0) {
496 debug("## Skipping init Ramdisk\n");
499 } else if (select || genimg_has_config(images)) {
502 ret = select_ramdisk(images, select, arch, &rd_data, &rd_len);
507 } else if (images->legacy_hdr_valid &&
508 image_check_type(&images->legacy_hdr_os_copy,
511 * Now check if we have a legacy mult-component image,
512 * get second entry data start address and len.
514 bootstage_mark(BOOTSTAGE_ID_RAMDISK);
515 printf("## Loading init Ramdisk from multi component Legacy Image at %08lx ...\n",
516 (ulong)images->legacy_hdr_os);
518 image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
523 bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
529 debug("## No init Ramdisk\n");
532 *rd_end = rd_data + rd_len;
534 debug(" ramdisk start = 0x%08lx, ramdisk end = 0x%08lx\n",
541 * boot_ramdisk_high - relocate init ramdisk
542 * @lmb: pointer to lmb handle, will be used for memory mgmt
543 * @rd_data: ramdisk data start address
544 * @rd_len: ramdisk data length
545 * @initrd_start: pointer to a ulong variable, will hold final init ramdisk
546 * start address (after possible relocation)
547 * @initrd_end: pointer to a ulong variable, will hold final init ramdisk
548 * end address (after possible relocation)
550 * boot_ramdisk_high() takes a relocation hint from "initrd_high" environment
551 * variable and if requested ramdisk data is moved to a specified location.
553 * Initrd_start and initrd_end are set to final (after relocation) ramdisk
554 * start/end addresses if ramdisk image start and len were provided,
555 * otherwise set initrd_start and initrd_end set to zeros.
561 int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
562 ulong *initrd_start, ulong *initrd_end)
566 int initrd_copy_to_ram = 1;
568 s = env_get("initrd_high");
570 /* a value of "no" or a similar string will act like 0,
571 * turning the "load high" feature off. This is intentional.
573 initrd_high = hextoul(s, NULL);
574 if (initrd_high == ~0)
575 initrd_copy_to_ram = 0;
577 initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
580 debug("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
581 initrd_high, initrd_copy_to_ram);
584 if (!initrd_copy_to_ram) { /* zero-copy ramdisk support */
585 debug(" in-place initrd\n");
586 *initrd_start = rd_data;
587 *initrd_end = rd_data + rd_len;
588 lmb_reserve(lmb, rd_data, rd_len);
591 *initrd_start = (ulong)lmb_alloc_base(lmb,
592 rd_len, 0x1000, initrd_high);
594 *initrd_start = (ulong)lmb_alloc(lmb, rd_len,
597 if (*initrd_start == 0) {
598 puts("ramdisk - allocation error\n");
601 bootstage_mark(BOOTSTAGE_ID_COPY_RAMDISK);
603 *initrd_end = *initrd_start + rd_len;
604 printf(" Loading Ramdisk to %08lx, end %08lx ... ",
605 *initrd_start, *initrd_end);
607 memmove_wd((void *)*initrd_start,
608 (void *)rd_data, rd_len, CHUNKSZ);
611 * Ensure the image is flushed to memory to handle
612 * AMP boot scenarios in which we might not be
615 if (IS_ENABLED(CONFIG_MP)) {
616 flush_cache((unsigned long)*initrd_start,
617 ALIGN(rd_len, ARCH_DMA_MINALIGN));
625 debug(" ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
626 *initrd_start, *initrd_end);
634 int boot_get_setup(bootm_headers_t *images, u8 arch,
635 ulong *setup_start, ulong *setup_len)
637 if (!CONFIG_IS_ENABLED(FIT))
640 return boot_get_setup_fit(images, arch, setup_start, setup_len);
643 int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
644 u8 arch, const ulong *ld_start, ulong * const ld_len)
646 ulong tmp_img_addr, img_data, img_len;
650 const char *uname, *name;
652 int devnum = 0; /* TODO support multi fpga platforms */
654 if (!IS_ENABLED(CONFIG_FPGA))
657 /* Check to see if the images struct has a FIT configuration */
658 if (!genimg_has_config(images)) {
659 debug("## FIT configuration was not specified\n");
664 * Obtain the os FIT header from the images struct
666 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
667 buf = map_sysmem(tmp_img_addr, 0);
669 * Check image type. For FIT images get FIT node
670 * and attempt to locate a generic binary.
672 switch (genimg_get_format(buf)) {
673 case IMAGE_FORMAT_FIT:
674 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
676 uname = fdt_stringlist_get(buf, conf_noffset, FIT_FPGA_PROP, 0,
679 debug("## FPGA image is not specified\n");
682 fit_img_result = fit_image_load(images,
684 (const char **)&uname,
685 &images->fit_uname_cfg,
688 BOOTSTAGE_ID_FPGA_INIT,
689 FIT_LOAD_OPTIONAL_NON_ZERO,
690 &img_data, &img_len);
692 debug("FPGA image (%s) loaded to 0x%lx/size 0x%lx\n",
693 uname, img_data, img_len);
695 if (fit_img_result < 0) {
696 /* Something went wrong! */
697 return fit_img_result;
700 if (!fpga_is_partial_data(devnum, img_len)) {
702 err = fpga_loadbitstream(devnum, (char *)img_data,
705 err = fpga_load(devnum, (const void *)img_data,
709 err = fpga_loadbitstream(devnum, (char *)img_data,
710 img_len, BIT_PARTIAL);
712 err = fpga_load(devnum, (const void *)img_data,
713 img_len, BIT_PARTIAL);
719 printf(" Programming %s bitstream... OK\n", name);
722 printf("The given image format is not supported (corrupt?)\n");
729 static void fit_loadable_process(u8 img_type,
734 const unsigned int count =
735 ll_entry_count(struct fit_loadable_tbl, fit_loadable);
736 struct fit_loadable_tbl *fit_loadable_handler =
737 ll_entry_start(struct fit_loadable_tbl, fit_loadable);
738 /* For each loadable handler */
739 for (i = 0; i < count; i++, fit_loadable_handler++)
740 /* matching this type */
741 if (fit_loadable_handler->type == img_type)
742 /* call that handler with this image data */
743 fit_loadable_handler->handler(img_data, img_len);
746 int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
747 u8 arch, const ulong *ld_start, ulong * const ld_len)
750 * These variables are used to hold the current image location
755 * These two variables are requirements for fit_image_load, but
756 * their values are not used
758 ulong img_data, img_len;
766 /* Check to see if the images struct has a FIT configuration */
767 if (!genimg_has_config(images)) {
768 debug("## FIT configuration was not specified\n");
773 * Obtain the os FIT header from the images struct
775 tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
776 buf = map_sysmem(tmp_img_addr, 0);
778 * Check image type. For FIT images get FIT node
779 * and attempt to locate a generic binary.
781 switch (genimg_get_format(buf)) {
782 case IMAGE_FORMAT_FIT:
783 conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
785 for (loadables_index = 0;
786 uname = fdt_stringlist_get(buf, conf_noffset,
788 loadables_index, NULL), uname;
790 fit_img_result = fit_image_load(images, tmp_img_addr,
792 &images->fit_uname_cfg,
793 arch, IH_TYPE_LOADABLE,
794 BOOTSTAGE_ID_FIT_LOADABLE_START,
795 FIT_LOAD_OPTIONAL_NON_ZERO,
796 &img_data, &img_len);
797 if (fit_img_result < 0) {
798 /* Something went wrong! */
799 return fit_img_result;
802 fit_img_result = fit_image_get_node(buf, uname);
803 if (fit_img_result < 0) {
804 /* Something went wrong! */
805 return fit_img_result;
807 fit_img_result = fit_image_get_type(buf,
810 if (fit_img_result < 0) {
811 /* Something went wrong! */
812 return fit_img_result;
815 fit_loadable_process(img_type, img_data, img_len);
819 printf("The given image format is not supported (corrupt?)\n");
826 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
828 * boot_get_cmdline - allocate and initialize kernel cmdline
829 * @lmb: pointer to lmb handle, will be used for memory mgmt
830 * @cmd_start: pointer to a ulong variable, will hold cmdline start
831 * @cmd_end: pointer to a ulong variable, will hold cmdline end
833 * boot_get_cmdline() allocates space for kernel command line below
834 * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environment
835 * variable is present its contents is copied to allocated kernel
842 int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
847 cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
848 env_get_bootm_mapsize() + env_get_bootm_low());
852 s = env_get("bootargs");
858 *cmd_start = (ulong)cmdline;
859 *cmd_end = *cmd_start + strlen(cmdline);
861 debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
867 * boot_get_kbd - allocate and initialize kernel copy of board info
868 * @lmb: pointer to lmb handle, will be used for memory mgmt
869 * @kbd: double pointer to board info data
871 * boot_get_kbd() allocates space for kernel copy of board info data below
872 * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
873 * with the current u-boot board info data.
879 int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
881 *kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
882 sizeof(struct bd_info),
884 env_get_bootm_mapsize() +
885 env_get_bootm_low());
891 debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
894 if (IS_ENABLED(CONFIG_CMD_BDI))
895 do_bdinfo(NULL, 0, 0, NULL);
902 int image_setup_linux(bootm_headers_t *images)
904 ulong of_size = images->ft_len;
905 char **of_flat_tree = &images->ft_addr;
906 struct lmb *lmb = &images->lmb;
909 if (CONFIG_IS_ENABLED(OF_LIBFDT))
910 boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
912 if (IS_ENABLED(CONFIG_SYS_BOOT_GET_CMDLINE)) {
913 ret = boot_get_cmdline(lmb, &images->cmdline_start,
914 &images->cmdline_end);
916 puts("ERROR with allocation of cmdline\n");
921 if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
922 ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
927 if (CONFIG_IS_ENABLED(OF_LIBFDT) && of_size) {
928 ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
936 void genimg_print_size(uint32_t size)
938 printf("%d Bytes = ", size);
939 print_size(size, "\n");
942 void genimg_print_time(time_t timestamp)
946 rtc_to_tm(timestamp, &tm);
947 printf("%4d-%02d-%02d %2d:%02d:%02d UTC\n",
948 tm.tm_year, tm.tm_mon, tm.tm_mday,
949 tm.tm_hour, tm.tm_min, tm.tm_sec);