Skip to contentSkip to conversation

splash: sort include files

PATCH New Tomas Melin 3 participants 5 messages Jan 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/2 splash: sort include files

Sort include files in accordance to U-Boot coding style.

---

Changes in v5:
- None

Changes in v4:
- Added missing changelog

Changes in v3:
- Change patch order so that include sort patch comes prior to adding new include

Changes in v2:
- Add separate patch for sorting include files

 common/splash_source.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
common/splash_source.c +7 -6
index 230b2db..5f6e961 100644
@@ -7,15 +7,16 @@
  */
 
 #include <common.h>
-#include <nand.h>
+#include <bmp_layout.h>
 #include <errno.h>
-#include <splash.h>
-#include <spi_flash.h>
+#include <fs.h>
+#include <image.h>
+#include <nand.h>
+#include <sata.h>
 #include <spi.h>
+#include <spi_flash.h>
+#include <splash.h>
 #include <usb.h>
-#include <sata.h>
-#include <bmp_layout.h>
-#include <fs.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.1.4
#1 lore raw

PATCH v5 2/2 splash: add support for loading splash from a FIT image

Enable support for loading a splash image from within a FIT image. The image is assumed to be generated with mkimage -E flag to hold the data external to the FIT.

---

Changes in v5:
- Change two debug() statements to use printf(), update printed error msg

Changes in v4:
- Added missing changelog

Changes in v3:
- Add documentation to README.splashprepare
- Change printf() to debug()
- Coding style fixes

Changes in v2:
- Add helper functions to image-fit.c for getting required FIT data fields
- Add comments

 common/image-fit.c       | 48 ++++++++++++++++++++++++++++++++
 common/splash_source.c   | 72 +++++++++++++++++++++++++++++++++++++++++++++++-
 doc/README.splashprepare | 15 ++++++----
 include/image.h          |  4 +++
 include/splash.h         |  5 ++--
 5 files changed, 136 insertions(+), 8 deletions(-)
common/image-fit.c +48 -0
index 77dc011..2bc536c 100644
@@ -777,6 +777,54 @@ int fit_image_get_data(const void *fit, int noffset,
 }
 
 /**
+ * Get 'data-offset' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_offset: holds the data-offset property
+ *
+ * returns:
+ *     0, on success
+ *     -ENOENT if the property could not be found
+ */
+int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset)
+{
+	const fdt32_t *val;
+
+	val = fdt_getprop(fit, noffset, FIT_DATA_OFFSET_PROP, NULL);
+	if (!val)
+		return -ENOENT;
+
+	*data_offset = fdt32_to_cpu(*val);
+
+	return 0;
+}
+
+/**
+ * Get 'data-size' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_size: holds the data-size property
+ *
+ * returns:
+ *     0, on success
+ *     -ENOENT if the property could not be found
+ */
+int fit_image_get_data_size(const void *fit, int noffset, int *data_size)
+{
+	const fdt32_t *val;
+
+	val = fdt_getprop(fit, noffset, FIT_DATA_SIZE_PROP, NULL);
+	if (!val)
+		return -ENOENT;
+
+	*data_size = fdt32_to_cpu(*val);
+
+	return 0;
+}
+
+/**
  * fit_image_hash_get_algo - get hash algorithm name
  * @fit: pointer to the FIT format image header
  * @noffset: hash node offset
common/splash_source.c +71 -1

89 lines not on this page · raw message

doc/README.splashprepare +10 -5
index 56c1bef..f1418de 100644
@@ -5,7 +5,7 @@ The splash_screen_prepare() function is a weak function defined in
 common/splash.c. It is called as part of the splash screen display
 sequence. It gives the board an opportunity to prepare the splash
 image data before it is processed and sent to the frame buffer by
-U-Boot.  Define your own version to use this feature.
+U-Boot. Define your own version to use this feature.
 
 CONFIG_SPLASH_SOURCE
 
@@ -20,7 +20,12 @@ splashsource works as follows:
 - If splashsource is undefined, use the first splash location as default.
 - If splashsource is set to an unsupported value, do not load a splash screen.
 
-A splash source location can describe either storage with raw data, or storage
-formatted with a file system. In case of a filesystem, the splash screen data is
-loaded as a file. The name of the splash screen file can be controlled with the
-environment variable "splashfile".
+A splash source location can describe either storage with raw data, a storage
+formatted with a file system or a FIT image. In case of a filesystem, the splash
+screen data is loaded as a file. The name of the splash screen file can be
+controlled with the environment variable "splashfile".
+
+To enable loading the splash image from a FIT image, CONFIG_FIT must be
+enabled. Struct splash_location field 'name' should match the splash image
+name within the FIT and the FIT should start at the 'offset' field address in
+the specified storage.
include/image.h +4 -0
index 2b1296c..94df589 100644
@@ -870,6 +870,8 @@ int bootz_setup(ulong image, ulong *start, ulong *end);
 
 /* image node */
 #define FIT_DATA_PROP		"data"
+#define FIT_DATA_OFFSET_PROP	"data-offset"
+#define FIT_DATA_SIZE_PROP	"data-size"
 #define FIT_TIMESTAMP_PROP	"timestamp"
 #define FIT_DESC_PROP		"description"
 #define FIT_ARCH_PROP		"arch"
@@ -948,6 +950,8 @@ int fit_image_get_load(const void *fit, int noffset, ulong *load);
 int fit_image_get_entry(const void *fit, int noffset, ulong *entry);
 int fit_image_get_data(const void *fit, int noffset,
 				const void **data, size_t *size);
+int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset);
+int fit_image_get_data_size(const void *fit, int noffset, int *data_size);
 
 int fit_image_hash_get_algo(const void *fit, int noffset, char **algo);
 int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
include/splash.h +3 -2
index 136eac7..228aff4 100644
@@ -33,8 +33,9 @@ enum splash_storage {
 };
 
 enum splash_flags {
-	SPLASH_STORAGE_RAW,
-	SPLASH_STORAGE_FS,
+	SPLASH_STORAGE_RAW, /* Stored in raw memory */
+	SPLASH_STORAGE_FS,  /* Stored within a file system */
+	SPLASH_STORAGE_FIT, /* Stored inside a FIT image */
 };
 
 struct splash_location {
Signature · 1 line
2.1.4
#3 lore raw

PATCH v5 2/2 splash: add support for loading splash from a FIT image

In reply to Tomas Melin
Quoted 22 lines · On Fri, 13 Jan 2017 13:20:14 +0200 Tomas Melin tomas.melin at vaisala.com wrote:

Enable support for loading a splash image from within a FIT image. The image is assumed to be generated with mkimage -E flag to hold the data external to the FIT.

---

Changes in v5:
- Change two debug() statements to use printf(), update printed error msg

Changes in v4:
- Added missing changelog

Changes in v3:
- Add documentation to README.splashprepare
- Change printf() to debug()
- Coding style fixes

Changes in v2:
- Add helper functions to image-fit.c for getting required FIT data fields
- Add comments

Quoted 6 lines
 common/image-fit.c       | 48 ++++++++++++++++++++++++++++++++
 common/splash_source.c   | 72 +++++++++++++++++++++++++++++++++++++++++++++++-
 doc/README.splashprepare | 15 ++++++----
 include/image.h          |  4 +++
 include/splash.h         |  5 ++--
 5 files changed, 136 insertions(+), 8 deletions(-)

applied to u-boot-video/master. Thanks!

--
Anatolij

#4 lore raw

PATCH v5 1/2 splash: sort include files

In reply to Tomas Melin
Quoted 15 lines · On Fri, 13 Jan 2017 13:20:13 +0200 Tomas Melin tomas.melin at vaisala.com wrote:

Sort include files in accordance to U-Boot coding style.

---

Changes in v5:
- None

Changes in v4:
- Added missing changelog

Changes in v3:
- Change patch order so that include sort patch comes prior to adding new include

Quoted 5 lines

Changes in v2:
- Add separate patch for sorting include files

 common/splash_source.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

applied to u-boot-video/master. Thanks!

--
Anatolij