summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongjin Kim <tobetter@gmail.com>2021-12-14 22:39:19 +0300
committerDongjin Kim <tobetter@gmail.com>2021-12-30 12:54:06 +0300
commit68e0027a9fbfc764639182125a4ca26d17601c54 (patch)
tree4e0d17e953e9ec11c6cb7c10f1e0db5323a32f49
parent37ebf598c43ed04692481ffd4f1f196732b28254 (diff)
downloadu-boot-68e0027a9fbfc764639182125a4ca26d17601c54.tar.xz
ODROID-M1: improve loading splash image
Signed-off-by: Dongjin Kim <tobetter@gmail.com> Change-Id: I5917556711cf2d0761567d6ced91992f9759a1d5
-rw-r--r--board/hardkernel/odroid-m1/odroid-m1.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/board/hardkernel/odroid-m1/odroid-m1.c b/board/hardkernel/odroid-m1/odroid-m1.c
index 866fa60fae..638c9db840 100644
--- a/board/hardkernel/odroid-m1/odroid-m1.c
+++ b/board/hardkernel/odroid-m1/odroid-m1.c
@@ -163,22 +163,35 @@ int misc_init_r(void)
void *decomp;
struct bmp_image *bmp;
unsigned int loadaddr = (unsigned int)env_get_ulong("loadaddr", 16, 0);
- unsigned long len = 0x100000;
+ unsigned long len;
char str[80];
int ret;
+ /* Try to load splash image from SPI flash memory */
snprintf(str, sizeof(str),
- "sf read 0x%08x 0x300000 0x%08x",
- loadaddr, (unsigned int)len);
+ "sf read 0x%08x 0x300000 0x100000", loadaddr);
ret = run_command(str, 0);
- if (ret)
- return 1;
+ if (ret) {
+ /* Try to load splash image from CRAMFS */
+ snprintf(str, sizeof(str),
+ "cramfsload 0x%08x boot-logo.bmp.gz", loadaddr);
+ ret = run_command(str, 0);
+ if (ret)
+ return 0;
+ }
+
+ bmp = (struct bmp_image *)map_sysmem(loadaddr, 0);
+
+ /* Check if splash image is uncompressed */
+ if (!((bmp->header.signature[0] == 'B')
+ && (bmp->header.signature[1] == 'M')))
+ bmp = gunzip_bmp(loadaddr, &len, &decomp);
- bmp = gunzip_bmp(loadaddr, &len, &decomp);
if (bmp)
set_bmp_logo("logo.bmp", bmp, 1);
- free(decomp);
+ if (decomp)
+ free(decomp);
return 0;
}