From f13b90e4308ba3d60683799b9ce62fb3705ac277 Mon Sep 17 00:00:00 2001 From: boxi Date: Mon, 26 Apr 2021 19:29:34 +0800 Subject: [PATCH] fix: Provide a separate configuration macro for boot environment in RAM. Provide a separate configuration macro for boot environment in RAM. Depends on: Need to copy boot environment data to the specified ram by boot. Closes #I3OADR Change-Id: Ie36a92c0a44f245482d1602c3a6851395944776d --- arch/arm/arm/src/startup/reset_vector_mp.S | 4 ++-- kernel/common/Kconfig | 17 ++++++++++++++++- kernel/common/los_rootfs.c | 8 ++++---- kernel/common/los_rootfs.h | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/arm/arm/src/startup/reset_vector_mp.S b/arch/arm/arm/src/startup/reset_vector_mp.S index 964b0137..4889b165 100644 --- a/arch/arm/arm/src/startup/reset_vector_mp.S +++ b/arch/arm/arm/src/startup/reset_vector_mp.S @@ -115,9 +115,9 @@ __exception_handlers: .global reset_vector .type reset_vector,function -#ifdef LOSCFG_QUICK_START +#ifdef LOSCFG_BOOTENV_RAM __quickstart_args_start: - .fill 512,1,0 + .fill LOSCFG_BOOTENV_RAMSIZE,1,0 __quickstart_args_end: .global OsGetArgsAddr diff --git a/kernel/common/Kconfig b/kernel/common/Kconfig index 66af51a1..dbf2f11b 100644 --- a/kernel/common/Kconfig +++ b/kernel/common/Kconfig @@ -28,8 +28,23 @@ endchoice config BOOTENV_ADDR int "Address of boot command line (KB)" - depends on PLATFORM_ROOTFS + depends on PLATFORM_ROOTFS && (STORAGE_SPINOR || STORAGE_SPINAND || STORAGE_EMMC) range 0 1024 default 512 help Boot command line addr, range from 0 to 1MB. + +config BOOTENV_RAM + bool "Storage bootenv in RAM" + default n + depends on PLATFORM_ROOTFS + help + Answer Y to read bootenv from ram. Need boot copy to RAM. + +config BOOTENV_RAMSIZE + int "Size of boot environment in RAM (Byte)" + depends on PLATFORM_ROOTFS && BOOTENV_RAM + range 128 1024 + default 512 + help + Boot environment in Ram space size, range from 128 to 1024 byte. diff --git a/kernel/common/los_rootfs.c b/kernel/common/los_rootfs.c index 3457826c..7d9f39e1 100644 --- a/kernel/common/los_rootfs.c +++ b/kernel/common/los_rootfs.c @@ -219,7 +219,7 @@ STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSi #ifndef LOSCFG_SECURITY_BOOT STATIC INT32 GetArgs(CHAR **args) { -#ifdef LOSCFG_QUICK_START +#ifdef LOSCFG_BOOTENV_RAM *args = OsGetArgsAddr(); return LOS_OK; @@ -387,7 +387,7 @@ STATIC INT32 GetRootType(CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32 PRINT_ERR("Cannot get bootargs!\n"); return LOS_NOK; } -#ifndef LOSCFG_QUICK_START +#ifndef LOSCFG_BOOTENV_RAM CHAR *argsBak = NULL; argsBak = args; #endif @@ -399,7 +399,7 @@ STATIC INT32 GetRootType(CHAR **rootType, CHAR **fsType, INT32 *rootAddr, INT32 p = strsep(&args, " "); } if ((*fsType != NULL) && (*rootType != NULL)) { -#ifndef LOSCFG_QUICK_START +#ifndef LOSCFG_BOOTENV_RAM free(argsBak); #endif return LOS_OK; @@ -415,7 +415,7 @@ ERROUT: free(*fsType); *fsType = NULL; } -#ifndef LOSCFG_QUICK_START +#ifndef LOSCFG_BOOTENV_RAM free(argsBak); #endif return LOS_NOK; diff --git a/kernel/common/los_rootfs.h b/kernel/common/los_rootfs.h index c73813b8..f2de0986 100644 --- a/kernel/common/los_rootfs.h +++ b/kernel/common/los_rootfs.h @@ -76,7 +76,7 @@ INT32 OsMountRootfs(VOID); VOID OsSetCmdLineAddr(UINT64 addr); UINT64 OsGetCmdLineAddr(VOID); -#ifdef LOSCFG_QUICK_START +#ifdef LOSCFG_BOOTENV_RAM CHAR *OsGetArgsAddr(VOID); #endif #endif /* _LOS_ROOTFS_H */