* [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset)
@ 2019-02-08 9:51 Mark Jonas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name Mark Jonas
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Mark Jonas @ 2019-02-08 9:51 UTC (permalink / raw)
To: u-boot
We store a splash screen in SPI-NOR. We chose to use a FIT image as a
container because we want to
- store more than just the splash screen in SPI-NOR,
- do not create a bunch of MTD partitions,
- do not waste storage space, and
- avoid the overhead of a real file system.
In general U-Boot already supports this. But there were some ripples we
had to smooth out. The following patches resolve these.
Changes since v1:
- Document default name in README.splashprepare
- Use ALIGN() macro
- Reviewed by Simon Glass
Changes since v2:
- Reviewed by Stefano Babic and Tomas Melin
Leo Ruan (2):
splash: Use splashfile instead of location->name
splash: Load internal and external data from FIT
common/splash_source.c | 65 +++++++++++++++++++++++++++++++-----------------
doc/README.splashprepare | 9 ++++---
2 files changed, 48 insertions(+), 26 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name
2019-02-08 9:51 [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Mark Jonas
@ 2019-02-08 9:51 ` Mark Jonas
2019-02-08 12:21 ` Melin Tomas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 2/2] splash: Load internal and external data from FIT Mark Jonas
2019-03-29 16:17 ` [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Jonas Mark
2 siblings, 1 reply; 7+ messages in thread
From: Mark Jonas @ 2019-02-08 9:51 UTC (permalink / raw)
To: u-boot
From: Leo Ruan <tingquan.ruan@cn.bosch.com>
The splash image could be loaded from different sources (e.g. sf, mmc)
with different formats (e.g. raw, file-system). These sources are
structured by a board dependent object 'splash_location'. To decide
where is the splash image loaded, following environment variables are
used to select the splash source and file:
- 'splashsource' is used to select the splash source by setting its
value to specified name of splash location.
- 'splashfile' specify the name of splash image file
But, when loads the splash image from FIT, the name of splash image
within FIT is specified by splash location name. Due to the splash
location name is already used for the splash source, its name may
conflicts with the name of splash image.
To solve the conflict, the environment variable 'splashfile' is used
to specify the splash image in FIT, and keeps the splash location
name for the splash source.
Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>
---
common/splash_source.c | 10 ++++++++--
doc/README.splashprepare | 9 ++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/common/splash_source.c b/common/splash_source.c
index 62763b9..e1e73db 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -303,6 +303,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
{
int res;
int node_offset;
+ const char *splash_file;
int splash_offset;
int splash_size;
struct image_header *img_header;
@@ -335,10 +336,15 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
return -EINVAL;
}
- node_offset = fit_image_get_node(fit_header, location->name);
+ /* Get the splash image node */
+ splash_file = env_get("splashfile");
+ if (!splash_file)
+ splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
+
+ node_offset = fit_image_get_node(fit_header, splash_file);
if (node_offset < 0) {
debug("Could not find splash image '%s' in FIT\n",
- location->name);
+ splash_file);
return -ENOENT;
}
diff --git a/doc/README.splashprepare b/doc/README.splashprepare
index f1418de..3cb5b5a 100644
--- a/doc/README.splashprepare
+++ b/doc/README.splashprepare
@@ -26,6 +26,9 @@ 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.
+enabled. The FIT image has to start at the 'offset' field address in the
+selected splash location. The name of splash image within the FIT shall be
+specified by the environment variable "splashfile".
+
+In case the environment variable "splashfile" is not defined the default name
+'splash.bmp' will be used.
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v3 2/2] splash: Load internal and external data from FIT
2019-02-08 9:51 [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Mark Jonas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name Mark Jonas
@ 2019-02-08 9:51 ` Mark Jonas
2019-03-29 16:17 ` [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Jonas Mark
2 siblings, 0 replies; 7+ messages in thread
From: Mark Jonas @ 2019-02-08 9:51 UTC (permalink / raw)
To: u-boot
From: Leo Ruan <tingquan.ruan@cn.bosch.com>
The FIT image could contain the splash data in 3 different structure:
- The splash data is embedded in FIT image (internal)
In this case, the property 'data' presents in FIT image header. And
internal information 'start' and 'end' represent the location and
size of splash data inside of FIT image.
- The splash data is external with absolute position in FIT image
This case is made by 'mkimage -p [pos]'. The splash data is stored
at the absolute position. Instead the property 'data', the properties
'data-position' and 'data-size' are used to specify the location and
size of the splash data.
- the splash data is external with relative offset in FIT image
This case is made by 'mkimage -E'. The splash data is placed after
the FIT image header with 4 byte alignment. Instead the property
'data', the properties 'data-offset' and 'data-size' are used to
specify the location and size of the splash data.
Currently, the splash only support to load external data with relative
offset from FIT image. This commit make it possible to load the splash
data embedded in FIT image or the external data with absolute position
This inspiration comes from Simon Glass <sjg@chromium.org>, see
common/spl_fit.c
Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefano Babic <sbabic@denx.de>
---
common/splash_source.c | 55 +++++++++++++++++++++++++++++++-------------------
1 file changed, 34 insertions(+), 21 deletions(-)
diff --git a/common/splash_source.c b/common/splash_source.c
index e1e73db..8f276a3 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -304,8 +304,11 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
int res;
int node_offset;
const char *splash_file;
- int splash_offset;
- int splash_size;
+ const void *internal_splash_data;
+ size_t internal_splash_size;
+ int external_splash_addr;
+ int external_splash_size;
+ bool is_splash_external = false;
struct image_header *img_header;
const u32 *fit_header;
u32 fit_size;
@@ -348,29 +351,39 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
return -ENOENT;
}
- res = fit_image_get_data_offset(fit_header, node_offset,
- &splash_offset);
- if (res < 0) {
- printf("Failed to load splash image (err=%d)\n", res);
- return res;
+ /* Extract the splash data from FIT */
+ /* 1. Test if splash is in FIT internal data. */
+ if (!fit_image_get_data(fit_header, node_offset, &internal_splash_data, &internal_splash_size))
+ memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size);
+ /* 2. Test if splash is in FIT external data with fixed position. */
+ else if (!fit_image_get_data_position(fit_header, node_offset, &external_splash_addr))
+ is_splash_external = true;
+ /* 3. Test if splash is in FIT external data with offset. */
+ else if (!fit_image_get_data_offset(fit_header, node_offset, &external_splash_addr)) {
+ /* Align data offset to 4-byte boundary */
+ fit_size = ALIGN(fdt_totalsize(fit_header), 4);
+ /* External splash offset means the offset by end of FIT header */
+ external_splash_addr += location->offset + fit_size;
+ is_splash_external = true;
+ } else {
+ printf("Failed to get splash image from FIT\n");
+ return -ENODATA;
}
- res = fit_image_get_data_size(fit_header, node_offset, &splash_size);
- if (res < 0) {
- printf("Failed to load splash image (err=%d)\n", res);
- return res;
+ if (is_splash_external) {
+ res = fit_image_get_data_size(fit_header, node_offset, &external_splash_size);
+ if (res < 0) {
+ printf("Failed to get size of splash image (err=%d)\n", res);
+ return res;
+ }
+
+ /* Read in the splash data */
+ location->offset = external_splash_addr;
+ res = splash_storage_read_raw(location, bmp_load_addr, external_splash_size);
+ if (res < 0)
+ return res;
}
- /* Align data offset to 4-byte boundrary */
- fit_size = fdt_totalsize(fit_header);
- fit_size = (fit_size + 3) & ~3;
-
- /* Read in the splash data */
- location->offset = (location->offset + fit_size + splash_offset);
- res = splash_storage_read_raw(location, bmp_load_addr , splash_size);
- if (res < 0)
- return res;
-
return 0;
}
#endif /* CONFIG_FIT */
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name
2019-02-08 9:51 ` [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name Mark Jonas
@ 2019-02-08 12:21 ` Melin Tomas
0 siblings, 0 replies; 7+ messages in thread
From: Melin Tomas @ 2019-02-08 12:21 UTC (permalink / raw)
To: u-boot
Hi,
On 2/8/19 11:51 AM, Mark Jonas wrote:
> diff --git a/common/splash_source.c b/common/splash_source.c
> index 62763b9..e1e73db 100644
> --- a/common/splash_source.c
> +++ b/common/splash_source.c
> @@ -303,6 +303,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
> {
> int res;
> int node_offset;
> + const char *splash_file;
> int splash_offset;
> int splash_size;
> struct image_header *img_header;
> @@ -335,10 +336,15 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
> return -EINVAL;
> }
>
> - node_offset = fit_image_get_node(fit_header, location->name);
> + /* Get the splash image node */
> + splash_file = env_get("splashfile");
> + if (!splash_file)
> + splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
As mentioned during latest review round, this default name should really
IMO be something else than a file name since it's not a file, it's a FIT
node. splash_file should also probably be splash_node or so.
I'm not even sure is this patch really needed, selecting an appropriate
name for the splash_location.name, matching the splash image node should
work equally.
BR,
Tomas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset)
2019-02-08 9:51 [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Mark Jonas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name Mark Jonas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 2/2] splash: Load internal and external data from FIT Mark Jonas
@ 2019-03-29 16:17 ` Jonas Mark
2019-03-29 16:35 ` Melin Tomas
2 siblings, 1 reply; 7+ messages in thread
From: Jonas Mark @ 2019-03-29 16:17 UTC (permalink / raw)
To: u-boot
Hi,
> We store a splash screen in SPI-NOR. We chose to use a FIT image as a
> container because we want to
> - store more than just the splash screen in SPI-NOR,
> - do not create a bunch of MTD partitions,
> - do not waste storage space, and
> - avoid the overhead of a real file system.
>
> In general U-Boot already supports this. But there were some ripples
> we had to smooth out. The following patches resolve these.
>
> Changes since v1:
> - Document default name in README.splashprepare
> - Use ALIGN() macro
> - Reviewed by Simon Glass
>
> Changes since v2:
> - Reviewed by Stefano Babic and Tomas Melin
>
> Leo Ruan (2):
> splash: Use splashfile instead of location->name
> splash: Load internal and external data from FIT
>
> common/splash_source.c | 65
> +++++++++++++++++++++++++++++++-----------------
> doc/README.splashprepare | 9 ++++---
> 2 files changed, 48 insertions(+), 26 deletions(-)
>
> --
> 2.7.4
Gentle ping^2. Ready to apply?
Greetings,
Mark
Building Technologies, Panel Software Fire (BT-FIR/ENG1) Bosch Sicherheitssysteme GmbH | Postfach 11 11 | 85626 Grasbrunn | GERMANY | www.boschsecurity.com
Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart HRB 23118
Aufsichtsratsvorsitzender: Christian Fischer; Geschäftsführung: Tanja Rückert, Andreas Bartz, Thomas Quante, Bernhard Schuster
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset)
2019-03-29 16:17 ` [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Jonas Mark
@ 2019-03-29 16:35 ` Melin Tomas
0 siblings, 0 replies; 7+ messages in thread
From: Melin Tomas @ 2019-03-29 16:35 UTC (permalink / raw)
To: u-boot
Hi,
On 3/29/19 6:17 PM, Jonas Mark (BT-FIR/ENG1) wrote:
> Gentle ping^2. Ready to apply?
I was kindof hoping on some follow up on concerns raised during v3, see
below.
On 2/8/19 2:21 PM, Tomas Melin wrote:
>> - node_offset = fit_image_get_node(fit_header, location->name);
>> + /* Get the splash image node */
>> + splash_file = env_get("splashfile");
>> + if (!splash_file)
>> + splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
>
> As mentioned during latest review round, this default name should
> really IMO be something else than a file name since it's not a file,
> it's a FIT node. splash_file should also probably be splash_node or so.
>
> I'm not even sure is this patch really needed, selecting an
> appropriate name for the splash_location.name, matching the splash
> image node should work equally.
BR,
Tomas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset)
@ 2019-03-15 16:38 Jonas Mark
0 siblings, 0 replies; 7+ messages in thread
From: Jonas Mark @ 2019-03-15 16:38 UTC (permalink / raw)
To: u-boot
Hi,
> We store a splash screen in SPI-NOR. We chose to use a FIT image as a
> container because we want to
> - store more than just the splash screen in SPI-NOR,
> - do not create a bunch of MTD partitions,
> - do not waste storage space, and
> - avoid the overhead of a real file system.
>
> In general U-Boot already supports this. But there were some ripples we
> had to smooth out. The following patches resolve these.
>
> Changes since v1:
> - Document default name in README.splashprepare
> - Use ALIGN() macro
> - Reviewed by Simon Glass
>
> Changes since v2:
> - Reviewed by Stefano Babic and Tomas Melin
>
> Leo Ruan (2):
> splash: Use splashfile instead of location->name
> splash: Load internal and external data from FIT
>
> common/splash_source.c | 65
> +++++++++++++++++++++++++++++++-----------------
> doc/README.splashprepare | 9 ++++---
> 2 files changed, 48 insertions(+), 26 deletions(-)
>
> --
> 2.7.4
Gentle ping. Ready to apply?
Greetings,
Mark
Building Technologies, Panel Software Fire (BT-FIR/ENG1)
Bosch Sicherheitssysteme GmbH | Postfach 11 11 | 85626 Grasbrunn | GERMANY | www.boschsecurity.com
Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart HRB 23118
Aufsichtsratsvorsitzender: Christian Fischer; Geschäftsführung: Tanja Rückert, Andreas Bartz, Thomas Quante, Bernhard Schuster
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-03-29 16:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08 9:51 [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Mark Jonas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 1/2] splash: Use splashfile instead of location->name Mark Jonas
2019-02-08 12:21 ` Melin Tomas
2019-02-08 9:51 ` [U-Boot] [PATCH v3 2/2] splash: Load internal and external data from FIT Mark Jonas
2019-03-29 16:17 ` [U-Boot] [PATCH v3 0/2] Load splash from FIT image (internal, external, offset) Jonas Mark
2019-03-29 16:35 ` Melin Tomas
2019-03-15 16:38 Jonas Mark
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.