Commit b55fed18 authored by Yuri Tikhonov's avatar Yuri Tikhonov

RT #112561. bootm: support for 2-files multi-image format

This is to be able to boot 4.2 kernel Image + DTB as one multi-image
file.
Signed-off-by: default avatarYuri Tikhonov <yur@emcraft.com>
parent a8109dfe
...@@ -432,7 +432,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) ...@@ -432,7 +432,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
if (boot_progress) if (boot_progress)
show_boot_progress (7); show_boot_progress (7);
if ((load < blob_end) && (*load_end > blob_start)) { /* Warn about overlap only if we could really corrupt adjacing imgs */
if ((load < blob_end) && (*load_end > blob_start) &&
(load < image_start || *load_end > os.image_start + os.image_len)) {
debug ("images.os.start = 0x%lX, images.os.end = 0x%lx\n", blob_start, blob_end); debug ("images.os.start = 0x%lX, images.os.end = 0x%lx\n", blob_start, blob_end);
debug ("images.os.load = 0x%lx, load_end = 0x%lx\n", load, *load_end); debug ("images.os.load = 0x%lx, load_end = 0x%lx\n", load, *load_end);
......
...@@ -775,10 +775,13 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images, ...@@ -775,10 +775,13 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images,
*rd_end = 0; *rd_end = 0;
/* /*
* Look for a '-' which indicates to ignore the * Look for a '-' which indicates to ignore the ramdisk argument.
* ramdisk argument * Also skip ramdisk if multi-image consists of 2 files (image+dtb).
*/ */
if ((argc >= 3) && (strcmp(argv[2], "-") == 0)) { if (((argc >= 3) && (strcmp(argv[2], "-") == 0)) ||
(images->legacy_hdr_valid &&
image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI) &&
image_multi_count (images->legacy_hdr_os) == 2)) {
debug ("## Skipping init Ramdisk\n"); debug ("## Skipping init Ramdisk\n");
rd_len = rd_data = 0; rd_len = rd_data = 0;
} else if (argc >= 3 || genimg_has_config (images)) { } else if (argc >= 3 || genimg_has_config (images)) {
...@@ -1192,6 +1195,16 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, ...@@ -1192,6 +1195,16 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
goto error; goto error;
} }
#if defined(CONFIG_OF_FORCE_RELOCATE)
/*
* If force dtb relocation is requested, then move dtb to the bootmap
* end. You may want to avoid such force relocation if booting dtb
* separately (i.e. not as a part of multi-image)
*/
if (!getenv ("fdt_no_force_reloc"))
relocate = 1;
#endif
#ifndef CONFIG_SYS_NO_FLASH #ifndef CONFIG_SYS_NO_FLASH
/* move the blob if it is in flash (set relocate) */ /* move the blob if it is in flash (set relocate) */
if (addr2info ((ulong)fdt_blob) != NULL) if (addr2info ((ulong)fdt_blob) != NULL)
...@@ -1529,17 +1542,18 @@ int boot_get_fdt (int flag, int argc, char *argv[], bootm_headers_t *images, ...@@ -1529,17 +1542,18 @@ int boot_get_fdt (int flag, int argc, char *argv[], bootm_headers_t *images,
} else if (images->legacy_hdr_valid && } else if (images->legacy_hdr_valid &&
image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) { image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) {
ulong fdt_data, fdt_len; ulong fdt_data, fdt_len, idx;
/* /*
* Now check if we have a legacy multi-component image, * Now check if we have a legacy multi-component image,
* get second entry data start address and len. * get the appropriate entry data start address and len.
*/ */
printf ("## Flattened Device Tree from multi " printf ("## Flattened Device Tree from multi "
"component Image at %08lX\n", "component Image at %08lX\n",
(ulong)images->legacy_hdr_os); (ulong)images->legacy_hdr_os);
image_multi_getimg (images->legacy_hdr_os, 2, &fdt_data, &fdt_len); idx = (image_multi_count (images->legacy_hdr_os) == 2) ? 1 : 2;
image_multi_getimg (images->legacy_hdr_os, idx, &fdt_data, &fdt_len);
if (fdt_len) { if (fdt_len) {
fdt_blob = (char *)fdt_data; fdt_blob = (char *)fdt_data;
......
...@@ -412,13 +412,19 @@ ...@@ -412,13 +412,19 @@
# define CONFIG_BOOTARGS "stm32_platform=stm32f4x9-som "\ # define CONFIG_BOOTARGS "stm32_platform=stm32f4x9-som "\
"console=ttyS0,115200 panic=10" "console=ttyS0,115200 panic=10"
# define LOADADDR "0xC0007FC0" /*
* These are the good addresses to get Image data right at the 'Load Address'
* (0xC0008000), and thus avoid additional uImage relocation:
* - linux-2.6: 0xC0007FC0 (reserve place for uImage header)
* - linux-4.2: 0xC0007FB4 (reserve place for 2-files multi-image header)
*/
# define LOADADDR "0xC0007FB4"
# define REV_EXTRA_ENV \ # define REV_EXTRA_ENV \
"envmboot=run args addip;bootm ${envmaddr}\0" \ "envmboot=run args addip;bootm ${envmaddr}\0" \
"envmupdate=tftp ${image};" \ "envmupdate=tftp ${image};" \
"cptf ${envmaddr} ${loadaddr} ${filesize}\0" \ "cptf ${envmaddr} ${loadaddr} ${filesize}\0" \
"flashboot=run args addip;" \ "flashboot=run args addip;" \
"stmbufcopy ${loadaddr} ${flashaddr} ${kernelsize};" \ "stmbufcopy ${loadaddr} ${flashaddr} ${kernelsize};" \
"bootm ${loadaddr}\0" \ "bootm ${loadaddr}\0" \
"update=tftp ${image};" \ "update=tftp ${image};" \
...@@ -474,6 +480,7 @@ ...@@ -474,6 +480,7 @@
* Enable support for booting with FDT * Enable support for booting with FDT
*/ */
#define CONFIG_OF_LIBFDT #define CONFIG_OF_LIBFDT
#define CONFIG_OF_FORCE_RELOCATE
#define CONFIG_SYS_BOOTMAPSZ CONFIG_SYS_RAM_SIZE #define CONFIG_SYS_BOOTMAPSZ CONFIG_SYS_RAM_SIZE
#endif /* __CONFIG_H */ #endif /* __CONFIG_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment