All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot
@ 2017-08-15 18:14 York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation York Sun
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: York Sun @ 2017-08-15 18:14 UTC (permalink / raw)
  To: u-boot

This patch set extends FIT support for falcon boot. The difference
between U-Boot FIT and Linux FIT lies not only on the images inside,
but also the data offset. U-Boot FIT image has data outside of the
FIT structure while Linux FIT image can have data embedded within.
Linux FIT can use compressed image as well.

Changes in v3:
Replace ifdef with if IS_ENABLED().
Add help to new Kconfig optons.
Update doc/uImage.FIT/source_file_format.txt with embedded and external data
Update doc/uImage.FIT/multi_spl.its to explain the priority of booting image.

Changes in v2:
Combine Kconfig change and actual code into one patch
Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara
Split from previous patch, rebased on top of "SPL: FIT: allow loading
multiple images" by Andre Przywara.

York Sun (5):
  tools: pblimage: Fix address calculation
  cmd: spl: Fix compiling warning
  spl: fit: Eanble GZIP support for image decompression
  spl: fit: Support both external and embedded data
  spl: fit: Add booting OS first

 cmd/spl.c                             |   8 +-
 common/spl/spl_fit.c                  | 144 ++++++++++++++++++++++++----------
 doc/uImage.FIT/multi_spl.its          |   7 ++
 doc/uImage.FIT/source_file_format.txt |   4 +
 lib/Kconfig                           |  12 +++
 lib/Makefile                          |   5 +-
 tools/pblimage.c                      |   2 +-
 7 files changed, 135 insertions(+), 47 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation
  2017-08-15 18:14 [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot York Sun
@ 2017-08-15 18:14 ` York Sun
  2017-09-13  2:20   ` York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 2/5] cmd: spl: Fix compiling warning York Sun
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: York Sun @ 2017-08-15 18:14 UTC (permalink / raw)
  To: u-boot

The image size should be added to the initial pbl command, not bit
"ORed".

Signed-off-by: York Sun <york.sun@nxp.com>
---

Changes in v3: None
Changes in v2: None

 tools/pblimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/pblimage.c b/tools/pblimage.c
index ffc3268..d25a733 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c
@@ -293,7 +293,7 @@ int pblimage_check_params(struct image_tool_params *params)
 		pbi_crc_cmd2 = 0;
 		pbl_cmd_initaddr = params->addr & PBL_ADDR_24BIT_MASK;
 		pbl_cmd_initaddr |= PBL_ACS_CONT_CMD;
-		pbl_cmd_initaddr |= uboot_size;
+		pbl_cmd_initaddr += uboot_size;
 		pbl_end_cmd[0] = 0x09610000;
 		pbl_end_cmd[1] = 0x00000000;
 		pbl_end_cmd[2] = 0x096100c0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 2/5] cmd: spl: Fix compiling warning
  2017-08-15 18:14 [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation York Sun
@ 2017-08-15 18:14 ` York Sun
  2017-09-13  2:21   ` York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression York Sun
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: York Sun @ 2017-08-15 18:14 UTC (permalink / raw)
  To: u-boot

Fix warning "cast from pointer to integer of different size".

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v3: None
Changes in v2: None

 cmd/spl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/spl.c b/cmd/spl.c
index 057764a..562140a 100644
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -108,12 +108,12 @@ static int spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	c = find_cmd_tbl(argv[1], &cmd_spl_export_sub[0],
 		ARRAY_SIZE(cmd_spl_export_sub));
-	if ((c) && ((int)c->cmd <= SPL_EXPORT_LAST)) {
+	if ((c) && ((long)c->cmd <= SPL_EXPORT_LAST)) {
 		argc -= 2;
 		argv += 2;
-		if (call_bootm(argc, argv, subcmd_list[(int)c->cmd]))
+		if (call_bootm(argc, argv, subcmd_list[(long)c->cmd]))
 			return -1;
-		switch ((int)c->cmd) {
+		switch ((long)c->cmd) {
 #ifdef CONFIG_OF_LIBFDT
 		case SPL_EXPORT_FDT:
 			printf("Argument image is now in RAM: 0x%p\n",
@@ -147,7 +147,7 @@ static int do_spl(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	c = find_cmd_tbl(argv[1], &cmd_spl_sub[0], ARRAY_SIZE(cmd_spl_sub));
 	if (c) {
-		cmd = (int)c->cmd;
+		cmd = (long)c->cmd;
 		switch (cmd) {
 		case SPL_EXPORT:
 			argc--;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression
  2017-08-15 18:14 [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 2/5] cmd: spl: Fix compiling warning York Sun
@ 2017-08-15 18:14 ` York Sun
  2017-08-26 13:38   ` Simon Glass
  2017-09-13  2:21   ` York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first York Sun
  4 siblings, 2 replies; 16+ messages in thread
From: York Sun @ 2017-08-15 18:14 UTC (permalink / raw)
  To: u-boot

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

---

Changes in v3:
Replace ifdef with if IS_ENABLED().
Add help to new Kconfig optons.

Changes in v2:
Combine Kconfig change and actual code into one patch

 common/spl/spl_fit.c | 32 ++++++++++++++++++++++++++++++--
 lib/Kconfig          | 12 ++++++++++++
 lib/Makefile         |  5 +++--
 3 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index d2a352e..fe41ce0 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -11,6 +11,10 @@
 #include <libfdt.h>
 #include <spl.h>
 
+#ifndef CONFIG_SYS_BOOTM_LEN
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)
+#endif
+
 /**
  * spl_fit_get_image_node(): By using the matching configuration subnode,
  * retrieve the name of an image, specified by a property name and an index
@@ -135,6 +139,19 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 	ulong overhead;
 	int nr_sectors;
 	int align_len = ARCH_DMA_MINALIGN - 1;
+	uint8_t image_comp = -1, type = -1;
+
+	if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
+		if (fit_image_get_comp(fit, node, &image_comp))
+			puts("Cannot get image compression format.\n");
+		else
+			debug("%s ", genimg_get_comp_name(image_comp));
+
+		if (fit_image_get_type(fit, node, &type))
+			puts("Cannot get image type.\n");
+		else
+			debug("%s ", genimg_get_type_name(type));
+	}
 
 	offset = fdt_getprop_u32(fit, node, "data-offset");
 	if (offset == FDT_ERROR)
@@ -154,7 +171,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 	if (info->read(info, sector + get_aligned_image_offset(info, offset),
 		       nr_sectors, (void*)load_ptr) != nr_sectors)
 		return -EIO;
-	debug("image: dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset,
+	debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset,
 	      (unsigned long)length);
 
 	src = (void *)load_ptr + overhead;
@@ -162,7 +179,18 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 	board_fit_image_post_process(&src, &length);
 #endif
 
-	memcpy((void*)load_addr, src, length);
+	if (IS_ENABLED(CONFIG_SPL_OS_BOOT)	&&
+	    IS_ENABLED(CONFIG_SPL_GZIP)		&&
+	    image_comp == IH_COMP_GZIP		&&
+	    type == IH_TYPE_KERNEL) {
+		if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN,
+			   src, &length)) {
+			puts("Uncompressing error\n");
+			return -EIO;
+		}
+	} else {
+		memcpy((void *)load_addr, src, length);
+	}
 
 	if (image_info) {
 		image_info->load_addr = load_addr;
diff --git a/lib/Kconfig b/lib/Kconfig
index 2f5a210..3b5e3b4 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -160,6 +160,18 @@ config LZO
 	bool "Enable LZO decompression support"
 	help
 	  This enables support for LZO compression algorithm.r
+
+config SPL_GZIP
+	bool "Enable gzip decompression support for SPL build"
+	select SPL_ZLIB
+	help
+	  This enables support for GZIP compression altorithm for SPL boot.
+
+config SPL_ZLIB
+	bool
+	help
+	  This enables compression lib for SPL boot.
+
 endmenu
 
 config ERRNO_STR
diff --git a/lib/Makefile b/lib/Makefile
index eacc7d6..455cc9d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_EFI) += efi/
 obj-$(CONFIG_EFI_LOADER) += efi_loader/
 obj-$(CONFIG_LZMA) += lzma/
 obj-$(CONFIG_LZO) += lzo/
-obj-$(CONFIG_ZLIB) += zlib/
 obj-$(CONFIG_BZIP2) += bzip2/
 obj-$(CONFIG_TIZEN) += tizen/
 obj-$(CONFIG_FIT) += libfdt/
@@ -26,7 +25,6 @@ obj-y += crc16.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o
 obj-$(CONFIG_FIT) += fdtdec_common.o
 obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
-obj-$(CONFIG_GZIP) += gunzip.o
 obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
 obj-y += initcall.o
@@ -49,6 +47,9 @@ obj-$(CONFIG_RSA) += rsa/
 obj-$(CONFIG_SHA1) += sha1.o
 obj-$(CONFIG_SHA256) += sha256.o
 
+obj-$(CONFIG_$(SPL_)ZLIB) += zlib/
+obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o
+
 obj-$(CONFIG_SPL_SAVEENV) += qsort.o
 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/
 ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_SPL_OF_PLATDATA),yy)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data
  2017-08-15 18:14 [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot York Sun
                   ` (2 preceding siblings ...)
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression York Sun
@ 2017-08-15 18:14 ` York Sun
  2017-08-26 13:38   ` Simon Glass
  2017-09-13  2:21   ` York Sun
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first York Sun
  4 siblings, 2 replies; 16+ messages in thread
From: York Sun @ 2017-08-15 18:14 UTC (permalink / raw)
  To: u-boot

SPL supports U-Boot image in FIT format which has data outside of
FIT structure. This adds support for embedded data for normal FIT
images.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

---

Changes in v3:
Update doc/uImage.FIT/source_file_format.txt with embedded and external data

Changes in v2:
Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara

 common/spl/spl_fit.c                  | 52 ++++++++++++++++++++++-------------
 doc/uImage.FIT/source_file_format.txt |  4 +++
 2 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index fe41ce0..9449a22 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -132,14 +132,16 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 			      void *fit, ulong base_offset, int node,
 			      struct spl_image_info *image_info)
 {
-	ulong offset;
+	int offset;
 	size_t length;
+	int len;
 	ulong load_addr, load_ptr;
 	void *src;
 	ulong overhead;
 	int nr_sectors;
 	int align_len = ARCH_DMA_MINALIGN - 1;
 	uint8_t image_comp = -1, type = -1;
+	const void *data;
 
 	if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
 		if (fit_image_get_comp(fit, node, &image_comp))
@@ -153,28 +155,40 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 			debug("%s ", genimg_get_type_name(type));
 	}
 
-	offset = fdt_getprop_u32(fit, node, "data-offset");
-	if (offset == FDT_ERROR)
-		return -ENOENT;
-	offset += base_offset;
-	length = fdt_getprop_u32(fit, node, "data-size");
-	if (length == FDT_ERROR)
-		return -ENOENT;
-	load_addr = fdt_getprop_u32(fit, node, "load");
-	if (load_addr == FDT_ERROR && image_info)
+	if (fit_image_get_load(fit, node, &load_addr))
 		load_addr = image_info->load_addr;
-	load_ptr = (load_addr + align_len) & ~align_len;
 
-	overhead = get_aligned_image_overhead(info, offset);
-	nr_sectors = get_aligned_image_size(info, length, offset);
+	if (!fit_image_get_data_offset(fit, node, &offset)) {
+		/* External data */
+		offset += base_offset;
+		if (fit_image_get_data_size(fit, node, &len))
+			return -ENOENT;
 
-	if (info->read(info, sector + get_aligned_image_offset(info, offset),
-		       nr_sectors, (void*)load_ptr) != nr_sectors)
-		return -EIO;
-	debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset,
-	      (unsigned long)length);
+		load_ptr = (load_addr + align_len) & ~align_len;
+		length = len;
+
+		overhead = get_aligned_image_overhead(info, offset);
+		nr_sectors = get_aligned_image_size(info, length, offset);
+
+		if (info->read(info,
+			       sector + get_aligned_image_offset(info, offset),
+			       nr_sectors, (void *)load_ptr) != nr_sectors)
+			return -EIO;
+
+		debug("External data: dst=%lx, offset=%x, size=%lx\n",
+		      load_ptr, offset, (unsigned long)length);
+		src = (void *)load_ptr + overhead;
+	} else {
+		/* Embedded data */
+		if (fit_image_get_data(fit, node, &data, &length)) {
+			puts("Cannot get image data/size\n");
+			return -ENOENT;
+		}
+		debug("Embedded data: dst=%lx, size=%lx\n", load_addr,
+		      (unsigned long)length);
+		src = (void *)data;
+	}
 
-	src = (void *)load_ptr + overhead;
 #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
 	board_fit_image_post_process(&src, &length);
 #endif
diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
index 136d3d7..3ce47ed 100644
--- a/doc/uImage.FIT/source_file_format.txt
+++ b/doc/uImage.FIT/source_file_format.txt
@@ -288,6 +288,10 @@ The 'data-offset' property can be substituted with 'data-position', which
 defines an absolute position or address as the offset. This is helpful when
 booting U-Boot proper before performing relocation.
 
+Normal kernel FIT image has data embedded within FIT structure. Normal U-Boot
+image has external data. Existence of 'data-offset' can be used to identify
+which format is used.
+
 9) Examples
 -----------
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first
  2017-08-15 18:14 [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot York Sun
                   ` (3 preceding siblings ...)
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data York Sun
@ 2017-08-15 18:14 ` York Sun
  2017-08-26 13:38   ` Simon Glass
  2017-09-13  2:22   ` York Sun
  4 siblings, 2 replies; 16+ messages in thread
From: York Sun @ 2017-08-15 18:14 UTC (permalink / raw)
  To: u-boot

If CONFIG_SPL_OS_BOOT is enabled, boot OS if kernel image is found
in FIT structure.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

---
This presums the kernel image doesn't exist in a FIT image intended for
U-Boot. If kernel image normally co-exists with U-Boot and other images
and user intends to boot U-Boot, this patch needs to rewrite to favor
"loadables" over either "firmware" or "kernel" so user can select which
image to boot.

Changes in v3:
Update doc/uImage.FIT/multi_spl.its to explain the priority of booting image.

Changes in v2:
Split from previous patch, rebased on top of "SPL: FIT: allow loading
multiple images" by Andre Przywara.

 common/spl/spl_fit.c         | 60 ++++++++++++++++++++++++++++++--------------
 doc/uImage.FIT/multi_spl.its |  7 ++++++
 2 files changed, 48 insertions(+), 19 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 9449a22..49ccf1c 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -222,13 +222,16 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 	ulong size;
 	unsigned long count;
 	struct spl_image_info image_info;
-	int node, images, ret;
+	bool boot_os = false;
+	int node = -1;
+	int images, ret;
 	int base_offset, align_len = ARCH_DMA_MINALIGN - 1;
 	int index = 0;
 
 	/*
-	 * Figure out where the external images start. This is the base for the
-	 * data-offset properties in each image.
+	 * For FIT with external data, figure out where the external images
+	 * start. This is the base for the data-offset properties in each
+	 * image.
 	 */
 	size = fdt_totalsize(fit);
 	size = (size + 3) & ~3;
@@ -247,6 +250,9 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 	 *
 	 * In fact the FIT has its own load address, but we assume it cannot
 	 * be before CONFIG_SYS_TEXT_BASE.
+	 *
+	 * For FIT with data embedded, data is loaded as part of FIT image.
+	 * For FIT with external data, data is not loaded in this step.
 	 */
 	fit = (void *)((CONFIG_SYS_TEXT_BASE - size - info->bl_len -
 			align_len) & ~align_len);
@@ -264,8 +270,17 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 		return -1;
 	}
 
+#ifdef CONFIG_SPL_OS_BOOT
+	/* Find OS image first */
+	node = spl_fit_get_image_node(fit, images, FIT_KERNEL_PROP, 0);
+	if (node < 0)
+		debug("No kernel image.\n");
+	else
+		boot_os = true;
+#endif
 	/* find the U-Boot image */
-	node = spl_fit_get_image_node(fit, images, "firmware", 0);
+	if (node < 0)
+		node = spl_fit_get_image_node(fit, images, "firmware", 0);
 	if (node < 0) {
 		debug("could not find firmware image, trying loadables...\n");
 		node = spl_fit_get_image_node(fit, images, "loadables", 0);
@@ -287,24 +302,31 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 	if (ret)
 		return ret;
 
+#ifdef CONFIG_SPL_OS_BOOT
+	if (!fit_image_get_os(fit, node, &spl_image->os))
+		debug("Image OS is %s\n", genimg_get_os_name(spl_image->os));
+#else
 	spl_image->os = IH_OS_U_BOOT;
+#endif
 
-	/* Figure out which device tree the board wants to use */
-	node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0);
-	if (node < 0) {
-		debug("%s: cannot find FDT node\n", __func__);
-		return node;
-	}
+	if (!boot_os) {
+		/* Figure out which device tree the board wants to use */
+		node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0);
+		if (node < 0) {
+			debug("%s: cannot find FDT node\n", __func__);
+			return node;
+		}
 
-	/*
-	 * Read the device tree and place it after the image.
-	 * Align the destination address to ARCH_DMA_MINALIGN.
-	 */
-	image_info.load_addr = spl_image->load_addr + spl_image->size;
-	ret = spl_load_fit_image(info, sector, fit, base_offset, node,
-				 &image_info);
-	if (ret < 0)
-		return ret;
+		/*
+		 * Read the device tree and place it after the image.
+		 * Align the destination address to ARCH_DMA_MINALIGN.
+		 */
+		image_info.load_addr = spl_image->load_addr + spl_image->size;
+		ret = spl_load_fit_image(info, sector, fit, base_offset, node,
+					 &image_info);
+		if (ret < 0)
+			return ret;
+	}
 
 	/* Now check if there are more images for us to load */
 	for (; ; index++) {
diff --git a/doc/uImage.FIT/multi_spl.its b/doc/uImage.FIT/multi_spl.its
index e5551d4..d43563d 100644
--- a/doc/uImage.FIT/multi_spl.its
+++ b/doc/uImage.FIT/multi_spl.its
@@ -4,6 +4,13 @@
  * (Bogus) example FIT image description file demonstrating the usage
  * of multiple images loaded by the SPL.
  * Several binaries will be loaded@their respective load addresses.
+ *
+ * For booting U-Boot, "firmware" is searched first. If not found, "loadables"
+ * is used to identify images to be loaded into memory. If falcon boot is
+ * enabled, "kernel" is searched first. If not found, it falls back to the
+ * same flow as booting U-Boot. Changing image type will result skipping
+ * specific image.
+ *
  * Finally the one image specifying an entry point will be entered by the SPL.
  */
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression York Sun
@ 2017-08-26 13:38   ` Simon Glass
  2017-09-13  2:21   ` York Sun
  1 sibling, 0 replies; 16+ messages in thread
From: Simon Glass @ 2017-08-26 13:38 UTC (permalink / raw)
  To: u-boot

On 15 August 2017 at 12:14, York Sun <york.sun@nxp.com> wrote:
> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
> SPL boot, eg. falcon boot compressed kernel image.
>
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> ---
>
> Changes in v3:
> Replace ifdef with if IS_ENABLED().
> Add help to new Kconfig optons.
>
> Changes in v2:
> Combine Kconfig change and actual code into one patch
>
>  common/spl/spl_fit.c | 32 ++++++++++++++++++++++++++++++--
>  lib/Kconfig          | 12 ++++++++++++
>  lib/Makefile         |  5 +++--
>  3 files changed, 45 insertions(+), 4 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data York Sun
@ 2017-08-26 13:38   ` Simon Glass
  2017-08-30 17:12     ` York Sun
  2017-09-13  2:21   ` York Sun
  1 sibling, 1 reply; 16+ messages in thread
From: Simon Glass @ 2017-08-26 13:38 UTC (permalink / raw)
  To: u-boot

On 15 August 2017 at 12:14, York Sun <york.sun@nxp.com> wrote:
> SPL supports U-Boot image in FIT format which has data outside of
> FIT structure. This adds support for embedded data for normal FIT
> images.
>
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> ---
>
> Changes in v3:
> Update doc/uImage.FIT/source_file_format.txt with embedded and external data
>
> Changes in v2:
> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara
>
>  common/spl/spl_fit.c                  | 52 ++++++++++++++++++++++-------------
>  doc/uImage.FIT/source_file_format.txt |  4 +++
>  2 files changed, 37 insertions(+), 19 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Please see nit below.

>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index fe41ce0..9449a22 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -132,14 +132,16 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
>                               void *fit, ulong base_offset, int node,
>                               struct spl_image_info *image_info)
>  {
> -       ulong offset;
> +       int offset;
>         size_t length;
> +       int len;
>         ulong load_addr, load_ptr;
>         void *src;
>         ulong overhead;
>         int nr_sectors;
>         int align_len = ARCH_DMA_MINALIGN - 1;
>         uint8_t image_comp = -1, type = -1;
> +       const void *data;
>
>         if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
>                 if (fit_image_get_comp(fit, node, &image_comp))
> @@ -153,28 +155,40 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
>                         debug("%s ", genimg_get_type_name(type));
>         }
>
> -       offset = fdt_getprop_u32(fit, node, "data-offset");
> -       if (offset == FDT_ERROR)
> -               return -ENOENT;
> -       offset += base_offset;
> -       length = fdt_getprop_u32(fit, node, "data-size");
> -       if (length == FDT_ERROR)
> -               return -ENOENT;
> -       load_addr = fdt_getprop_u32(fit, node, "load");
> -       if (load_addr == FDT_ERROR && image_info)
> +       if (fit_image_get_load(fit, node, &load_addr))
>                 load_addr = image_info->load_addr;
> -       load_ptr = (load_addr + align_len) & ~align_len;
>
> -       overhead = get_aligned_image_overhead(info, offset);
> -       nr_sectors = get_aligned_image_size(info, length, offset);
> +       if (!fit_image_get_data_offset(fit, node, &offset)) {
> +               /* External data */
> +               offset += base_offset;
> +               if (fit_image_get_data_size(fit, node, &len))
> +                       return -ENOENT;
>
> -       if (info->read(info, sector + get_aligned_image_offset(info, offset),
> -                      nr_sectors, (void*)load_ptr) != nr_sectors)
> -               return -EIO;
> -       debug("image dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset,
> -             (unsigned long)length);
> +               load_ptr = (load_addr + align_len) & ~align_len;
> +               length = len;
> +
> +               overhead = get_aligned_image_overhead(info, offset);
> +               nr_sectors = get_aligned_image_size(info, length, offset);
> +
> +               if (info->read(info,
> +                              sector + get_aligned_image_offset(info, offset),
> +                              nr_sectors, (void *)load_ptr) != nr_sectors)
> +                       return -EIO;
> +
> +               debug("External data: dst=%lx, offset=%x, size=%lx\n",
> +                     load_ptr, offset, (unsigned long)length);
> +               src = (void *)load_ptr + overhead;
> +       } else {
> +               /* Embedded data */
> +               if (fit_image_get_data(fit, node, &data, &length)) {
> +                       puts("Cannot get image data/size\n");
> +                       return -ENOENT;
> +               }
> +               debug("Embedded data: dst=%lx, size=%lx\n", load_addr,
> +                     (unsigned long)length);
> +               src = (void *)data;
> +       }
>
> -       src = (void *)load_ptr + overhead;
>  #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
>         board_fit_image_post_process(&src, &length);
>  #endif
> diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
> index 136d3d7..3ce47ed 100644
> --- a/doc/uImage.FIT/source_file_format.txt
> +++ b/doc/uImage.FIT/source_file_format.txt
> @@ -288,6 +288,10 @@ The 'data-offset' property can be substituted with 'data-position', which
>  defines an absolute position or address as the offset. This is helpful when
>  booting U-Boot proper before performing relocation.
>
> +Normal kernel FIT image has data embedded within FIT structure. Normal U-Boot
> +image has external data. Existence of 'data-offset' can be used to identify

I think actually external data is normal for SPL but not for U-Boot
proper. I don't know if that is worth mentioning though.

> +which format is used.
> +
>  9) Examples
>  -----------
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first York Sun
@ 2017-08-26 13:38   ` Simon Glass
  2017-09-13  2:22   ` York Sun
  1 sibling, 0 replies; 16+ messages in thread
From: Simon Glass @ 2017-08-26 13:38 UTC (permalink / raw)
  To: u-boot

On 15 August 2017 at 12:14, York Sun <york.sun@nxp.com> wrote:
> If CONFIG_SPL_OS_BOOT is enabled, boot OS if kernel image is found
> in FIT structure.
>
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> ---
> This presums the kernel image doesn't exist in a FIT image intended for
> U-Boot. If kernel image normally co-exists with U-Boot and other images
> and user intends to boot U-Boot, this patch needs to rewrite to favor
> "loadables" over either "firmware" or "kernel" so user can select which
> image to boot.
>
> Changes in v3:
> Update doc/uImage.FIT/multi_spl.its to explain the priority of booting image.
>
> Changes in v2:
> Split from previous patch, rebased on top of "SPL: FIT: allow loading
> multiple images" by Andre Przywara.
>
>  common/spl/spl_fit.c         | 60 ++++++++++++++++++++++++++++++--------------
>  doc/uImage.FIT/multi_spl.its |  7 ++++++
>  2 files changed, 48 insertions(+), 19 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data
  2017-08-26 13:38   ` Simon Glass
@ 2017-08-30 17:12     ` York Sun
  2017-08-30 18:13       ` York Sun
  0 siblings, 1 reply; 16+ messages in thread
From: York Sun @ 2017-08-30 17:12 UTC (permalink / raw)
  To: u-boot

On 08/26/2017 06:39 AM, Simon Glass wrote:
> On 15 August 2017 at 12:14, York Sun <york.sun@nxp.com> wrote:
>> SPL supports U-Boot image in FIT format which has data outside of
>> FIT structure. This adds support for embedded data for normal FIT
>> images.
>>
>> Signed-off-by: York Sun <york.sun@nxp.com>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
>>
>> ---
>>
>> Changes in v3:
>> Update doc/uImage.FIT/source_file_format.txt with embedded and external data
>>
>> Changes in v2:
>> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara
>>
>>   common/spl/spl_fit.c                  | 52 ++++++++++++++++++++++-------------
>>   doc/uImage.FIT/source_file_format.txt |  4 +++
>>   2 files changed, 37 insertions(+), 19 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Please see nit below.
> 
<snip>

>> diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
>> index 136d3d7..3ce47ed 100644
>> --- a/doc/uImage.FIT/source_file_format.txt
>> +++ b/doc/uImage.FIT/source_file_format.txt
>> @@ -288,6 +288,10 @@ The 'data-offset' property can be substituted with 'data-position', which
>>   defines an absolute position or address as the offset. This is helpful when
>>   booting U-Boot proper before performing relocation.
>>
>> +Normal kernel FIT image has data embedded within FIT structure. Normal U-Boot
>> +image has external data. Existence of 'data-offset' can be used to identify
> 
> I think actually external data is normal for SPL but not for U-Boot
> proper. I don't know if that is worth mentioning though.
> 

I will change to "U-Boot SPL image has external data" when merging this 
patch.

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data
  2017-08-30 17:12     ` York Sun
@ 2017-08-30 18:13       ` York Sun
  0 siblings, 0 replies; 16+ messages in thread
From: York Sun @ 2017-08-30 18:13 UTC (permalink / raw)
  To: u-boot

On 08/30/2017 10:12 AM, York Sun wrote:
> On 08/26/2017 06:39 AM, Simon Glass wrote:
>> On 15 August 2017 at 12:14, York Sun <york.sun@nxp.com> wrote:
>>> SPL supports U-Boot image in FIT format which has data outside of
>>> FIT structure. This adds support for embedded data for normal FIT
>>> images.
>>>
>>> Signed-off-by: York Sun <york.sun@nxp.com>
>>> Reviewed-by: Tom Rini <trini@konsulko.com>
>>>
>>> ---
>>>
>>> Changes in v3:
>>> Update doc/uImage.FIT/source_file_format.txt with embedded and external data
>>>
>>> Changes in v2:
>>> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara
>>>
>>>    common/spl/spl_fit.c                  | 52 ++++++++++++++++++++++-------------
>>>    doc/uImage.FIT/source_file_format.txt |  4 +++
>>>    2 files changed, 37 insertions(+), 19 deletions(-)
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> Please see nit below.
>>
> <snip>
> 
>>> diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
>>> index 136d3d7..3ce47ed 100644
>>> --- a/doc/uImage.FIT/source_file_format.txt
>>> +++ b/doc/uImage.FIT/source_file_format.txt
>>> @@ -288,6 +288,10 @@ The 'data-offset' property can be substituted with 'data-position', which
>>>    defines an absolute position or address as the offset. This is helpful when
>>>    booting U-Boot proper before performing relocation.
>>>
>>> +Normal kernel FIT image has data embedded within FIT structure. Normal U-Boot
>>> +image has external data. Existence of 'data-offset' can be used to identify
>>
>> I think actually external data is normal for SPL but not for U-Boot
>> proper. I don't know if that is worth mentioning though.
>>
> 
> I will change to "U-Boot SPL image has external data" when merging this
> patch.
> 

I should say "U-Boot image for SPL boot has external data".

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation York Sun
@ 2017-09-13  2:20   ` York Sun
  0 siblings, 0 replies; 16+ messages in thread
From: York Sun @ 2017-09-13  2:20 UTC (permalink / raw)
  To: u-boot

On 08/15/2017 11:15 AM, York Sun wrote:
> The image size should be added to the initial pbl command, not bit
> "ORed".
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 

Applied to fsl-qoriq master.

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 2/5] cmd: spl: Fix compiling warning
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 2/5] cmd: spl: Fix compiling warning York Sun
@ 2017-09-13  2:21   ` York Sun
  0 siblings, 0 replies; 16+ messages in thread
From: York Sun @ 2017-09-13  2:21 UTC (permalink / raw)
  To: u-boot

On 08/15/2017 11:15 AM, York Sun wrote:
> Fix warning "cast from pointer to integer of different size".
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None

Applied to fsl-qoriq master.

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression York Sun
  2017-08-26 13:38   ` Simon Glass
@ 2017-09-13  2:21   ` York Sun
  1 sibling, 0 replies; 16+ messages in thread
From: York Sun @ 2017-09-13  2:21 UTC (permalink / raw)
  To: u-boot

On 08/15/2017 11:15 AM, York Sun wrote:
> Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
> SPL boot, eg. falcon boot compressed kernel image.
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> 
> ---
> 
> Changes in v3:
> Replace ifdef with if IS_ENABLED().
> Add help to new Kconfig optons.
> 
> Changes in v2:
> Combine Kconfig change and actual code into one patch
> 

Applied to fsl-qoriq master.

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data York Sun
  2017-08-26 13:38   ` Simon Glass
@ 2017-09-13  2:21   ` York Sun
  1 sibling, 0 replies; 16+ messages in thread
From: York Sun @ 2017-09-13  2:21 UTC (permalink / raw)
  To: u-boot

On 08/15/2017 11:15 AM, York Sun wrote:
> SPL supports U-Boot image in FIT format which has data outside of
> FIT structure. This adds support for embedded data for normal FIT
> images.
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> 
> ---
> 
> Changes in v3:
> Update doc/uImage.FIT/source_file_format.txt with embedded and external data
> 
> Changes in v2:
> Rebase on top of "SPL: FIT: factor out spl_load_fit_image()" by Andre Przywara
> 

Applied to fsl-qoriq master.

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first
  2017-08-15 18:14 ` [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first York Sun
  2017-08-26 13:38   ` Simon Glass
@ 2017-09-13  2:22   ` York Sun
  1 sibling, 0 replies; 16+ messages in thread
From: York Sun @ 2017-09-13  2:22 UTC (permalink / raw)
  To: u-boot

On 08/15/2017 11:15 AM, York Sun wrote:
> If CONFIG_SPL_OS_BOOT is enabled, boot OS if kernel image is found
> in FIT structure.
> 
> Signed-off-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> 
> ---
> This presums the kernel image doesn't exist in a FIT image intended for
> U-Boot. If kernel image normally co-exists with U-Boot and other images
> and user intends to boot U-Boot, this patch needs to rewrite to favor
> "loadables" over either "firmware" or "kernel" so user can select which
> image to boot.
> 
> Changes in v3:
> Update doc/uImage.FIT/multi_spl.its to explain the priority of booting image.
> 
> Changes in v2:
> Split from previous patch, rebased on top of "SPL: FIT: allow loading
> multiple images" by Andre Przywara.

Applied to fsl-qoriq master.

York

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-09-13  2:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-15 18:14 [U-Boot] [PATCH v3 0/5] Extend FIT support for falcon boot York Sun
2017-08-15 18:14 ` [U-Boot] [PATCH v3 1/5] tools: pblimage: Fix address calculation York Sun
2017-09-13  2:20   ` York Sun
2017-08-15 18:14 ` [U-Boot] [PATCH v3 2/5] cmd: spl: Fix compiling warning York Sun
2017-09-13  2:21   ` York Sun
2017-08-15 18:14 ` [U-Boot] [PATCH v3 3/5] spl: fit: Eanble GZIP support for image decompression York Sun
2017-08-26 13:38   ` Simon Glass
2017-09-13  2:21   ` York Sun
2017-08-15 18:14 ` [U-Boot] [PATCH v3 4/5] spl: fit: Support both external and embedded data York Sun
2017-08-26 13:38   ` Simon Glass
2017-08-30 17:12     ` York Sun
2017-08-30 18:13       ` York Sun
2017-09-13  2:21   ` York Sun
2017-08-15 18:14 ` [U-Boot] [PATCH v3 5/5] spl: fit: Add booting OS first York Sun
2017-08-26 13:38   ` Simon Glass
2017-09-13  2:22   ` York Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.