From 2943834dd37680f452bd4a23d96dd485c2cf8b40 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Fri, 20 Dec 2019 16:24:56 +0000 Subject: use CramFS XIP file Magic in place of CPIO Removing copying the rootfs to SRAM. Because the rootfs is a CramFS XIP filesystem stored in flash, there is no need to copy it to DDR. Change-Id: I706d709050ae98a9b07fc00bb97c1d824f9399e6 Signed-off-by: Abdellatif El Khlifi --- module/host_boot/include/mod_host_boot.h | 3 ++- module/host_boot/src/mod_host_boot.c | 16 +++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/module/host_boot/include/mod_host_boot.h b/module/host_boot/include/mod_host_boot.h index ea9fd67..d7fe0c4 100644 --- a/module/host_boot/include/mod_host_boot.h +++ b/module/host_boot/include/mod_host_boot.h @@ -20,7 +20,8 @@ struct se_host_config { }; -#define GZIP_MAGIC 0x8B1F +#define CRAMFS_XIP_MAGIC 0x3D45 + /*! * @} */ diff --git a/module/host_boot/src/mod_host_boot.c b/module/host_boot/src/mod_host_boot.c index e447da2..8dc0db3 100755 --- a/module/host_boot/src/mod_host_boot.c +++ b/module/host_boot/src/mod_host_boot.c @@ -134,21 +134,11 @@ static int load_host_images(void) return FWK_E_DATA; } - /* copy rootfs image from FLASH to SRAM, currently only cpio.gzip format - is supported. - TODO: 4MB of data is copied but once we migrate from SPIToC to GPT we - will copy only till end of file. - */ + /* check for valid rootfs image from FLASH */ rootfs_magic = *((uint16_t*)ROOTFS_FLASH_BASE); - if (rootfs_magic == GZIP_MAGIC) { + if (rootfs_magic != CRAMFS_XIP_MAGIC) { host_ctx.log_api->log(MOD_LOG_GROUP_INFO, - "[RAM] Loading Root FS at 0x%x\n", - (void *) HOST_ROOTFS_BASE); - memcpy((void*) HOST_ROOTFS_BASE, (void*) ROOTFS_FLASH_BASE, - HOST_ROOTFS_SIZE); - } else { - host_ctx.log_api->log(MOD_LOG_GROUP_INFO, - "[RAM] No valid rootfs found. Abort Host BOOT!\n"); + "[FLASH] No valid rootfs found. Abort Host BOOT!\n"); return FWK_E_DATA; } return FWK_SUCCESS; -- cgit v1.2.3