void spl_parse_image_header(const struct image_header *header) { u32 header_size = sizeof(struct image_header); if (image_get_magic(header) == IH_MAGIC) { if (spl_image.flags & SPL_COPY_PAYLOAD_ONLY) { /* * On some system (e.g. powerpc), the load-address and * entry-point is located at address 0. We can't load * to 0-0x40. So skip header in this case. */ spl_image.load_addr = image_get_load(header); spl_image.entry_point = image_get_ep(header); spl_image.size = image_get_data_size(header); } else { spl_image.entry_point = image_get_load(header); /* Load including the header */ spl_image.load_addr = spl_image.entry_point - header_size; spl_image.size = image_get_data_size(header) + header_size; } spl_image.os = image_get_os(header); spl_image.name = image_get_name(header); debug("spl: payload image: %.*s load addr: 0x%x size: %d\n", (int)sizeof(spl_image.name), spl_image.name, spl_image.load_addr, spl_image.size); } else { /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); spl_set_header_raw_uboot(); } }
int spl_nand_load_image(void) { nand_init(); nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); spl_set_header_raw_uboot(); nand_deselect(); return 0; }
int spl_nand_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { nand_init(); nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); spl_set_header_raw_uboot(spl_image); nand_deselect(); return 0; }
int spl_parse_image_header(const struct image_header *header) { u32 header_size = sizeof(struct image_header); if (image_get_magic(header) == IH_MAGIC) { if (spl_image.flags & SPL_COPY_PAYLOAD_ONLY) { /* * On some system (e.g. powerpc), the load-address and * entry-point is located at address 0. We can't load * to 0-0x40. So skip header in this case. */ spl_image.load_addr = image_get_load(header); spl_image.entry_point = image_get_ep(header); spl_image.size = image_get_data_size(header); } else { spl_image.entry_point = image_get_load(header); /* Load including the header */ spl_image.load_addr = spl_image.entry_point - header_size; spl_image.size = image_get_data_size(header) + header_size; } spl_image.os = image_get_os(header); spl_image.name = image_get_name(header); debug("spl: payload image: %.*s load addr: 0x%x size: %d\n", (int)sizeof(spl_image.name), spl_image.name, spl_image.load_addr, spl_image.size); } else { #ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE /* * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the * code which loads images in SPL cannot guarantee that * absolutely all read errors will be reported. * An example is the LPC32XX MLC NAND driver, which * will consider that a completely unreadable NAND block * is bad, and thus should be skipped silently. */ panic("** no mkimage signature but raw image not supported"); #elif defined(CONFIG_SPL_ABORT_ON_RAW_IMAGE) /* Signature not found, proceed to other boot methods. */ return -EINVAL; #else /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); spl_set_header_raw_uboot(); #endif } return 0; }
int spl_parse_image_header(struct spl_image_info *spl_image, const struct image_header *header) { if (image_get_magic(header) == IH_MAGIC) { #ifdef CONFIG_SPL_LEGACY_IMAGE_SUPPORT u32 header_size = sizeof(struct image_header); if (spl_image->flags & SPL_COPY_PAYLOAD_ONLY) { /* * On some system (e.g. powerpc), the load-address and * entry-point is located at address 0. We can't load * to 0-0x40. So skip header in this case. */ spl_image->load_addr = image_get_load(header); spl_image->entry_point = image_get_ep(header); spl_image->size = image_get_data_size(header); } else { spl_image->entry_point = image_get_load(header); /* Load including the header */ spl_image->load_addr = spl_image->entry_point - header_size; spl_image->size = image_get_data_size(header) + header_size; } spl_image->os = image_get_os(header); spl_image->name = image_get_name(header); debug("spl: payload image: %.*s load addr: 0x%lx size: %d\n", (int)sizeof(spl_image->name), spl_image->name, spl_image->load_addr, spl_image->size); #else /* LEGACY image not supported */ debug("Legacy boot image support not enabled, proceeding to other boot methods"); return -EINVAL; #endif } else { #ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE /* * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the * code which loads images in SPL cannot guarantee that * absolutely all read errors will be reported. * An example is the LPC32XX MLC NAND driver, which * will consider that a completely unreadable NAND block * is bad, and thus should be skipped silently. */ panic("** no mkimage signature but raw image not supported"); #endif #ifdef CONFIG_SPL_OS_BOOT ulong start, end; if (!bootz_setup((ulong)header, &start, &end)) { spl_image->name = "Linux"; spl_image->os = IH_OS_LINUX; spl_image->load_addr = CONFIG_SYS_LOAD_ADDR; spl_image->entry_point = CONFIG_SYS_LOAD_ADDR; spl_image->size = end - start; debug("spl: payload zImage, load addr: 0x%lx size: %d\n", spl_image->load_addr, spl_image->size); return 0; } #endif #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); spl_set_header_raw_uboot(spl_image); #else /* RAW image not supported, proceed to other boot methods. */ debug("Raw boot image support not enabled, proceeding to other boot methods"); return -EINVAL; #endif } return 0; }