1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2016 Marvell International Ltd.
4 * https://spdx.org/licenses
17 #include <mach/efuse.h>
19 #include <spi_flash.h>
28 #include <u-boot/sha1.h>
29 #include <u-boot/sha256.h>
30 #include <u-boot/sha512.h>
32 #if defined(CONFIG_ARMADA_8K)
33 #define MAIN_HDR_MAGIC 0xB105B002
35 struct mvebu_image_header {
37 u32 prolog_size; /* 4-7 */
38 u32 prolog_checksum; /* 8-11 */
39 u32 boot_image_size; /* 12-15 */
40 u32 boot_image_checksum; /* 16-19 */
41 u32 rsrvd0; /* 20-23 */
42 u32 load_addr; /* 24-27 */
43 u32 exec_addr; /* 28-31 */
46 u8 ext_count; /* 34 */
47 u8 aux_flags; /* 35 */
48 u32 io_arg_0; /* 36-39 */
49 u32 io_arg_1; /* 40-43 */
50 u32 io_arg_2; /* 43-47 */
51 u32 io_arg_3; /* 48-51 */
52 u32 rsrvd1; /* 52-55 */
53 u32 rsrvd2; /* 56-59 */
54 u32 rsrvd3; /* 60-63 */
56 #elif defined(CONFIG_ARMADA_3700) /* A3700 */
57 #define HASH_SUM_LEN 16
58 #define IMAGE_VERSION_3_6_0 0x030600
59 #define IMAGE_VERSION_3_5_0 0x030500
61 struct tim_boot_flash_sign {
66 struct tim_boot_flash_sign tim_boot_flash_signs[] = {
67 { 0x454d4d08, "mmc" },
68 { 0x454d4d0b, "mmc" },
69 { 0x5350490a, "spi" },
70 { 0x5350491a, "nand" },
71 { 0x55415223, "uart" },
72 { 0x53415432, "sata" },
76 struct common_tim_data {
82 u32 reserved[5]; /* Reserve 20 bytes */
89 struct mvebu_image_info {
95 u32 image_size_to_hash;
96 u32 hash_algorithm_id;
97 u32 hash[HASH_SUM_LEN]; /* Reserve 512 bits for the hash */
100 u32 encrypt_start_offset;
103 #elif defined(CONFIG_ARMADA_32BIT)
105 /* Structure of the main header, version 1 (Armada 370/XP/375/38x/39x) */
106 struct a38x_main_hdr_v1 {
107 u8 blockid; /* 0x0 */
109 u16 nandpagesize; /* 0x2-0x3 */
110 u32 blocksize; /* 0x4-0x7 */
111 u8 version; /* 0x8 */
112 u8 headersz_msb; /* 0x9 */
113 u16 headersz_lsb; /* 0xA-0xB */
114 u32 srcaddr; /* 0xC-0xF */
115 u32 destaddr; /* 0x10-0x13 */
116 u32 execaddr; /* 0x14-0x17 */
117 u8 options; /* 0x18 */
118 u8 nandblocksize; /* 0x19 */
119 u8 nandbadblklocation; /* 0x1A */
120 u8 reserved4; /* 0x1B */
121 u16 reserved5; /* 0x1C-0x1D */
123 u8 checksum; /* 0x1F */
127 * Header for the optional headers, version 1 (Armada 370/XP/375/38x/39x)
129 struct a38x_opt_hdr_v1 {
135 #define A38X_OPT_HDR_V1_SECURE_TYPE 0x1
137 struct a38x_boot_mode {
142 /* The blockid header field values used to indicate boot device of image */
143 struct a38x_boot_mode a38x_boot_modes[] = {
158 size_t (*read)(const char *file_name);
159 int (*write)(size_t image_size);
163 static ulong get_load_addr(void)
165 const char *addr_str;
168 addr_str = env_get("loadaddr");
170 addr = hextoul(addr_str, NULL);
172 addr = CONFIG_SYS_LOAD_ADDR;
177 /********************************************************************
179 ********************************************************************/
180 #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(MMC_WRITE)
181 static int mmc_burn_image(size_t image_size)
188 const u8 mmc_dev_num = CONFIG_SYS_MMC_ENV_DEV;
190 struct blk_desc *blk_desc;
192 mmc = find_mmc_device(mmc_dev_num);
194 printf("No SD/MMC/eMMC card found\n");
200 printf("%s(%d) init failed\n", IS_SD(mmc) ? "SD" : "MMC",
205 /* SD reserves LBA-0 for MBR and boots from LBA-1,
206 * MMC/eMMC boots from LBA-0
208 start_lba = IS_SD(mmc) ? 1 : 0;
210 blk_count = image_size / mmc->write_bl_len;
211 if (image_size % mmc->write_bl_len)
214 blk_desc = mmc_get_blk_desc(mmc);
216 printf("Error - failed to obtain block descriptor\n");
219 blk_written = blk_dwrite(blk_desc, start_lba, blk_count,
220 (void *)get_load_addr());
222 blk_count = image_size / mmc->block_dev.blksz;
223 if (image_size % mmc->block_dev.blksz)
226 blk_written = mmc->block_dev.block_write(mmc_dev_num,
227 start_lba, blk_count,
228 (void *)get_load_addr());
229 #endif /* CONFIG_BLK */
230 if (blk_written != blk_count) {
231 printf("Error - written %#lx blocks\n", blk_written);
239 static size_t mmc_read_file(const char *file_name)
244 const u8 mmc_dev_num = CONFIG_SYS_MMC_ENV_DEV;
246 mmc = find_mmc_device(mmc_dev_num);
248 printf("No SD/MMC/eMMC card found\n");
253 printf("%s(%d) init failed\n", IS_SD(mmc) ? "SD" : "MMC",
258 /* Load from data partition (0) */
259 if (fs_set_blk_dev("mmc", "0", FS_TYPE_ANY)) {
260 printf("Error: MMC 0 not found\n");
264 /* Perfrom file read */
265 rc = fs_read(file_name, get_load_addr(), 0, 0, &act_read);
272 static int is_mmc_active(void)
276 #else /* CONFIG_DM_MMC */
277 static int mmc_burn_image(size_t image_size)
282 static size_t mmc_read_file(const char *file_name)
287 static int is_mmc_active(void)
291 #endif /* CONFIG_DM_MMC */
293 /********************************************************************
295 ********************************************************************/
296 #ifdef CONFIG_SPI_FLASH
297 static int spi_burn_image(size_t image_size)
300 struct spi_flash *flash;
303 /* Probe the SPI bus to get the flash device */
304 flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
305 CONFIG_SF_DEFAULT_CS,
306 CONFIG_SF_DEFAULT_SPEED,
307 CONFIG_SF_DEFAULT_MODE);
309 printf("Failed to probe SPI Flash\n");
313 erase_bytes = image_size +
314 (flash->erase_size - image_size % flash->erase_size);
315 printf("Erasing %d bytes (%d blocks) at offset 0 ...",
316 erase_bytes, erase_bytes / flash->erase_size);
317 ret = spi_flash_erase(flash, 0, erase_bytes);
323 printf("Writing %d bytes from 0x%lx to offset 0 ...",
324 (int)image_size, get_load_addr());
325 ret = spi_flash_write(flash, 0, image_size, (void *)get_load_addr());
334 static int is_spi_active(void)
339 #else /* CONFIG_SPI_FLASH */
340 static int spi_burn_image(size_t image_size)
345 static int is_spi_active(void)
349 #endif /* CONFIG_SPI_FLASH */
351 /********************************************************************
353 ********************************************************************/
354 #ifdef CONFIG_CMD_NAND
355 static int nand_burn_image(size_t image_size)
359 struct mtd_info *mtd;
361 mtd = get_nand_dev_by_index(nand_curr_device);
363 puts("\nno devices available\n");
366 block_size = mtd->erasesize;
368 /* Align U-Boot size to currently used blocksize */
369 image_size = ((image_size + (block_size - 1)) & (~(block_size - 1)));
371 /* Erase the U-Boot image space */
372 printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size);
373 ret = nand_erase(mtd, 0, image_size);
380 /* Write the image to flash */
381 printf("Writing %d bytes from 0x%lx to offset 0 ... ",
382 (int)image_size, get_load_addr());
383 ret = nand_write(mtd, 0, &image_size, (void *)get_load_addr());
393 static int is_nand_active(void)
398 #else /* CONFIG_CMD_NAND */
399 static int nand_burn_image(size_t image_size)
404 static int is_nand_active(void)
408 #endif /* CONFIG_CMD_NAND */
410 /********************************************************************
412 ********************************************************************/
413 #if defined(CONFIG_USB_STORAGE) && defined(CONFIG_BLK)
414 static size_t usb_read_file(const char *file_name)
422 if (usb_init() < 0) {
423 printf("Error: usb_init failed\n");
427 /* Try to recognize storage devices immediately */
428 blk_first_device(UCLASS_USB, &dev);
430 printf("Error: USB storage device not found\n");
434 /* Always load from usb 0 */
435 if (fs_set_blk_dev("usb", "0", FS_TYPE_ANY)) {
436 printf("Error: USB 0 not found\n");
440 /* Perfrom file read */
441 rc = fs_read(file_name, get_load_addr(), 0, 0, &act_read);
448 static int is_usb_active(void)
453 #else /* defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */
454 static size_t usb_read_file(const char *file_name)
459 static int is_usb_active(void)
463 #endif /* defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */
465 /********************************************************************
467 ********************************************************************/
468 #ifdef CONFIG_CMD_NET
469 static size_t tftp_read_file(const char *file_name)
474 * update global variable image_load_addr before tftp file from network
476 image_load_addr = get_load_addr();
477 ret = net_loop(TFTPGET);
478 return ret > 0 ? ret : 0;
481 static int is_tftp_active(void)
487 static size_t tftp_read_file(const char *file_name)
492 static int is_tftp_active(void)
496 #endif /* CONFIG_CMD_NET */
508 struct bubt_dev bubt_devs[BUBT_MAX_DEV] = {
509 {"tftp", tftp_read_file, NULL, is_tftp_active},
510 {"usb", usb_read_file, NULL, is_usb_active},
511 {"mmc", mmc_read_file, mmc_burn_image, is_mmc_active},
512 {"spi", NULL, spi_burn_image, is_spi_active},
513 {"nand", NULL, nand_burn_image, is_nand_active},
516 static int bubt_write_file(struct bubt_dev *dst, size_t image_size)
519 printf("Error: Write not supported on device %s\n", dst->name);
523 return dst->write(image_size);
526 #if defined(CONFIG_ARMADA_8K)
527 u32 do_checksum32(u32 *start, int32_t len)
541 static int check_image_header(void)
543 struct mvebu_image_header *hdr =
544 (struct mvebu_image_header *)get_load_addr();
545 u32 header_len = hdr->prolog_size;
547 u32 checksum_ref = hdr->prolog_checksum;
550 * For now compare checksum, and magic. Later we can
551 * verify more stuff on the header like interface type, etc
553 if (hdr->magic != MAIN_HDR_MAGIC) {
554 printf("ERROR: Bad MAGIC 0x%08x != 0x%08x\n",
555 hdr->magic, MAIN_HDR_MAGIC);
559 /* The checksum value is discarded from checksum calculation */
560 hdr->prolog_checksum = 0;
562 checksum = do_checksum32((u32 *)hdr, header_len);
563 if (checksum != checksum_ref) {
564 printf("Error: Bad Image checksum. 0x%x != 0x%x\n",
565 checksum, checksum_ref);
569 /* Restore the checksum before writing */
570 hdr->prolog_checksum = checksum_ref;
571 printf("Image checksum...OK!\n");
575 #elif defined(CONFIG_ARMADA_3700) /* Armada 3700 */
576 static int check_image_header(void)
578 struct common_tim_data *hdr = (struct common_tim_data *)get_load_addr();
580 u8 hash_160_output[SHA1_SUM_LEN];
581 u8 hash_256_output[SHA256_SUM_LEN];
582 u8 hash_512_output[SHA512_SUM_LEN];
583 sha1_context hash1_text;
584 sha256_context hash256_text;
585 sha512_context hash512_text;
587 u32 hash_algorithm_id;
588 u32 image_size_to_hash;
589 u32 flash_entry_addr;
591 u32 internal_hash[HASH_SUM_LEN];
593 u32 num_of_image = hdr->num_images;
594 u32 version = hdr->version;
595 u32 trusted = hdr->trusted;
597 /* bubt checksum validation only supports nontrusted images */
599 printf("bypass image validation, ");
600 printf("only untrusted image is supported now\n");
603 /* only supports image version 3.5 and 3.6 */
604 if (version != IMAGE_VERSION_3_5_0 && version != IMAGE_VERSION_3_6_0) {
605 printf("Error: Unsupported Image version = 0x%08x\n", version);
608 /* validate images hash value */
609 for (image_num = 0; image_num < num_of_image; image_num++) {
610 struct mvebu_image_info *info =
611 (struct mvebu_image_info *)(get_load_addr() +
612 sizeof(struct common_tim_data) +
613 image_num * sizeof(struct mvebu_image_info));
614 hash_algorithm_id = info->hash_algorithm_id;
615 image_size_to_hash = info->image_size_to_hash;
616 flash_entry_addr = info->flash_entry_addr;
617 hash_value = info->hash;
618 buff = (const u8 *)(get_load_addr() + flash_entry_addr);
620 if (image_num == 0) {
622 * The first image includes hash values in its content.
623 * For hash calculation, we need to save the original
624 * hash values to a local variable that will be
625 * copied back for comparsion and set all zeros to
626 * the orignal hash values for calculating new value.
627 * First image original format :
628 * x...x (datum1) x...x(orig. hash values) x...x(datum2)
629 * Replaced first image format :
630 * x...x (datum1) 0...0(hash values) x...x(datum2)
632 memcpy(internal_hash, hash_value,
633 sizeof(internal_hash));
634 memset(hash_value, 0, sizeof(internal_hash));
636 if (image_size_to_hash == 0) {
637 printf("Warning: Image_%d hash checksum is disabled, ",
639 printf("skip the image validation.\n");
642 switch (hash_algorithm_id) {
644 sha1_starts(&hash1_text);
645 sha1_update(&hash1_text, buff, image_size_to_hash);
646 sha1_finish(&hash1_text, hash_160_output);
647 hash_output = hash_160_output;
650 sha256_starts(&hash256_text);
651 sha256_update(&hash256_text, buff, image_size_to_hash);
652 sha256_finish(&hash256_text, hash_256_output);
653 hash_output = hash_256_output;
656 sha512_starts(&hash512_text);
657 sha512_update(&hash512_text, buff, image_size_to_hash);
658 sha512_finish(&hash512_text, hash_512_output);
659 hash_output = hash_512_output;
662 printf("Error: Unsupported hash_algorithm_id = %d\n",
667 memcpy(hash_value, internal_hash,
668 sizeof(internal_hash));
669 if (memcmp(hash_value, hash_output, hash_algorithm_id) != 0) {
670 printf("Error: Image_%d checksum is not correct\n",
675 printf("Image checksum...OK!\n");
679 #elif defined(CONFIG_ARMADA_32BIT)
680 static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h)
683 return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb);
685 printf("Error: Invalid A38x image (header version 0x%x unknown)!\n",
690 static uint8_t image_checksum8(const void *start, size_t len)
704 static uint32_t image_checksum32(const void *start, size_t len)
707 const u32 *p = start;
718 static int check_image_header(void)
721 u32 checksum32, exp_checksum32;
723 const struct a38x_main_hdr_v1 *hdr =
724 (struct a38x_main_hdr_v1 *)get_load_addr();
725 const size_t image_size = a38x_header_size(hdr);
730 checksum = image_checksum8(hdr, image_size);
731 checksum -= hdr->checksum;
732 if (checksum != hdr->checksum) {
733 printf("Error: Bad A38x image header checksum. 0x%x != 0x%x\n",
734 checksum, hdr->checksum);
738 offset = le32_to_cpu(hdr->srcaddr);
739 size = le32_to_cpu(hdr->blocksize);
741 if (hdr->blockid == 0x78) { /* SATA id */
743 printf("Error: Bad A38x image srcaddr.\n");
750 if (hdr->blockid == 0xAE) /* SDIO id */
753 if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
754 printf("Error: Bad A38x image blocksize.\n");
758 checksum32 = image_checksum32((u8 *)hdr + offset, size - 4);
759 exp_checksum32 = *(u32 *)((u8 *)hdr + offset + size - 4);
760 if (checksum32 != exp_checksum32) {
761 printf("Error: Bad A38x image data checksum. 0x%08x != 0x%08x\n",
762 checksum32, exp_checksum32);
766 printf("Image checksum...OK!\n");
770 #if defined(CONFIG_ARMADA_38X)
771 static int a38x_image_is_secure(const struct a38x_main_hdr_v1 *hdr)
773 u32 image_size = a38x_header_size(hdr);
774 struct a38x_opt_hdr_v1 *ohdr;
777 if (hdr->version != 1)
783 ohdr = (struct a38x_opt_hdr_v1 *)(hdr + 1);
785 if (ohdr->headertype == A38X_OPT_HDR_V1_SECURE_TYPE)
788 ohdr_size = (ohdr->headersz_msb << 16) | le16_to_cpu(ohdr->headersz_lsb);
790 if (!*((u8 *)ohdr + ohdr_size - 4))
793 ohdr = (struct a38x_opt_hdr_v1 *)((u8 *)ohdr + ohdr_size);
794 if ((u8 *)ohdr >= (u8 *)hdr + image_size)
801 #else /* Not ARMADA? */
802 static int check_image_header(void)
804 printf("bubt cmd does not support this SoC device or family!\n");
809 #if defined(CONFIG_ARMADA_3700) || defined(CONFIG_ARMADA_32BIT)
810 static u64 fuse_read_u64(u32 bank)
815 ret = fuse_read(bank, 0, &val[0]);
819 ret = fuse_read(bank, 1, &val[1]);
823 return ((u64)val[1] << 32) | val[0];
827 #if defined(CONFIG_ARMADA_3700)
828 static inline u8 maj3(u8 val)
830 /* return majority vote of 3 bits */
831 return ((val & 0x7) == 3 || (val & 0x7) > 4) ? 1 : 0;
835 static int bubt_check_boot_mode(const struct bubt_dev *dst)
837 #if defined(CONFIG_ARMADA_3700) || defined(CONFIG_ARMADA_32BIT)
838 int mode, secure_mode;
839 #if defined(CONFIG_ARMADA_3700)
840 const struct tim_boot_flash_sign *boot_modes = tim_boot_flash_signs;
841 const struct common_tim_data *hdr =
842 (struct common_tim_data *)get_load_addr();
843 u32 id = hdr->boot_flash_sign;
844 int is_secure = hdr->trusted != 0;
845 u64 otp_secure_bits = fuse_read_u64(1);
846 int otp_secure_boot = ((maj3(otp_secure_bits >> 0) << 0) |
847 (maj3(otp_secure_bits >> 4) << 1)) == 2;
848 unsigned int otp_boot_device = (maj3(otp_secure_bits >> 48) << 0) |
849 (maj3(otp_secure_bits >> 52) << 1) |
850 (maj3(otp_secure_bits >> 56) << 2) |
851 (maj3(otp_secure_bits >> 60) << 3);
852 #elif defined(CONFIG_ARMADA_32BIT)
853 const struct a38x_boot_mode *boot_modes = a38x_boot_modes;
854 const struct a38x_main_hdr_v1 *hdr =
855 (struct a38x_main_hdr_v1 *)get_load_addr();
856 u32 id = hdr->blockid;
857 #if defined(CONFIG_ARMADA_38X)
858 int is_secure = a38x_image_is_secure(hdr);
859 u64 otp_secure_bits = fuse_read_u64(EFUSE_LINE_SECURE_BOOT);
860 int otp_secure_boot = otp_secure_bits & 0x1;
861 unsigned int otp_boot_device = (otp_secure_bits >> 8) & 0x7;
865 for (mode = 0; boot_modes[mode].name; mode++) {
866 if (boot_modes[mode].id == id)
870 if (!boot_modes[mode].name) {
871 printf("Error: unknown boot device in image header: 0x%x\n", id);
875 if (strcmp(boot_modes[mode].name, dst->name) != 0) {
876 printf("Error: image meant to be booted from \"%s\", not \"%s\"!\n",
877 boot_modes[mode].name, dst->name);
881 #if defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_3700)
882 if (otp_secure_bits == (u64)-1) {
883 printf("Error: cannot read OTP secure bits\n");
886 if (otp_secure_boot && !is_secure) {
887 printf("Error: secure boot is enabled in OTP but image does not have secure boot header!\n");
889 } else if (!otp_secure_boot && is_secure) {
890 #if defined(CONFIG_ARMADA_3700)
892 * Armada 3700 BootROM rejects trusted image when secure boot is not enabled.
893 * Armada 385 BootROM accepts image with secure boot header also when secure boot is not enabled.
895 printf("Error: secure boot is disabled in OTP but image has secure boot header!\n");
898 } else if (otp_boot_device && otp_boot_device != id) {
899 for (secure_mode = 0; boot_modes[secure_mode].name; secure_mode++) {
900 if (boot_modes[secure_mode].id == otp_boot_device)
903 printf("Error: boot source is set to \"%s\" in OTP but image is for \"%s\"!\n",
904 boot_modes[secure_mode].name ?: "unknown", dst->name);
913 static int bubt_verify(const struct bubt_dev *dst)
917 /* Check a correct image header exists */
918 err = check_image_header();
920 printf("Error: Image header verification failed\n");
924 err = bubt_check_boot_mode(dst);
926 printf("Error: Image boot mode verification failed\n");
933 static int bubt_read_file(struct bubt_dev *src)
938 printf("Error: Read not supported on device \"%s\"\n",
943 image_size = src->read(net_boot_file_name);
944 if (image_size <= 0) {
945 printf("Error: Failed to read file %s from %s\n",
946 net_boot_file_name, src->name);
953 static int bubt_is_dev_active(struct bubt_dev *dev)
956 printf("Device \"%s\" not supported by U-Boot image\n",
961 if (!dev->active()) {
962 printf("Device \"%s\" is inactive\n", dev->name);
969 struct bubt_dev *find_bubt_dev(char *dev_name)
973 for (dev = 0; dev < BUBT_MAX_DEV; dev++) {
974 if (strcmp(bubt_devs[dev].name, dev_name) == 0)
975 return &bubt_devs[dev];
981 #define DEFAULT_BUBT_SRC "tftp"
983 #ifndef DEFAULT_BUBT_DST
984 #ifdef CONFIG_MVEBU_SPI_BOOT
985 #define DEFAULT_BUBT_DST "spi"
986 #elif defined(CONFIG_MVEBU_NAND_BOOT)
987 #define DEFAULT_BUBT_DST "nand"
988 #elif defined(CONFIG_MVEBU_MMC_BOOT)
989 #define DEFAULT_BUBT_DST "mmc"
991 #define DEFAULT_BUBT_DST "error"
993 #endif /* DEFAULT_BUBT_DST */
995 int do_bubt_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
997 struct bubt_dev *src, *dst;
999 char src_dev_name[8];
1000 char dst_dev_name[8];
1005 copy_filename(net_boot_file_name,
1006 CONFIG_MVEBU_UBOOT_DFLT_NAME,
1007 sizeof(net_boot_file_name));
1009 copy_filename(net_boot_file_name, argv[1],
1010 sizeof(net_boot_file_name));
1013 strncpy(dst_dev_name, argv[2], 8);
1015 name = DEFAULT_BUBT_DST;
1016 strncpy(dst_dev_name, name, 8);
1020 strncpy(src_dev_name, argv[3], 8);
1022 strncpy(src_dev_name, DEFAULT_BUBT_SRC, 8);
1024 /* Figure out the destination device */
1025 dst = find_bubt_dev(dst_dev_name);
1027 printf("Error: Unknown destination \"%s\"\n", dst_dev_name);
1031 if (!bubt_is_dev_active(dst))
1034 /* Figure out the source device */
1035 src = find_bubt_dev(src_dev_name);
1037 printf("Error: Unknown source \"%s\"\n", src_dev_name);
1041 if (!bubt_is_dev_active(src))
1044 printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n",
1045 net_boot_file_name, src->name, dst->name);
1047 image_size = bubt_read_file(src);
1051 err = bubt_verify(dst);
1055 err = bubt_write_file(dst, image_size);
1063 bubt, 4, 0, do_bubt_cmd,
1064 "Burn a u-boot image to flash",
1065 "[file-name] [destination [source]]\n"
1066 "\t-file-name The image file name to burn. Default = " CONFIG_MVEBU_UBOOT_DFLT_NAME "\n"
1067 "\t-destination Flash to burn to [spi, nand, mmc]. Default = " DEFAULT_BUBT_DST "\n"
1068 "\t-source The source to load image from [tftp, usb, mmc]. Default = " DEFAULT_BUBT_SRC "\n"
1070 "\tbubt - Burn flash-image.bin from tftp to active boot device\n"
1071 "\tbubt flash-image-new.bin nand - Burn flash-image-new.bin from tftp to NAND flash\n"
1072 "\tbubt backup-flash-image.bin mmc usb - Burn backup-flash-image.bin from usb to MMC\n"