update openharmony 1.0.1
This commit is contained in:
6
kernel/common/patchfs/Kconfig
Normal file
6
kernel/common/patchfs/Kconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
config PLATFORM_PATCHFS
|
||||
bool "Enable PATCHFS"
|
||||
default n
|
||||
depends on FS_JFFS
|
||||
help
|
||||
Answer Y to enable LiteOS support patchfs.
|
||||
13
kernel/common/patchfs/Makefile
Normal file
13
kernel/common/patchfs/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
MODULE_NAME := $(notdir $(shell pwd))
|
||||
|
||||
LOCAL_SRCS := $(wildcard *.c)
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/kernel/common \
|
||||
-I $(LITEOSTOPDIR)/kernel/common/patchfs \
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
|
||||
|
||||
include $(MODULE)
|
||||
235
kernel/common/patchfs/los_partition_utils.c
Normal file
235
kernel/common/patchfs/los_partition_utils.c
Normal file
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_partition_utils.h"
|
||||
#if defined(LOSCFG_STORAGE_SPINOR)
|
||||
#include "mtd_partition.h"
|
||||
#endif
|
||||
|
||||
STATIC INT32 MatchPartPos(CHAR *p, const CHAR *partInfoName, INT32 *partInfo)
|
||||
{
|
||||
UINT32 offset;
|
||||
CHAR *value = NULL;
|
||||
|
||||
if (strncmp(p, partInfoName, strlen(partInfoName)) == 0) {
|
||||
value = p + strlen(partInfoName);
|
||||
offset = strspn(value, DEC_NUMBER_STRING);
|
||||
if (strcmp(p + strlen(p) - 1, "M") == 0) {
|
||||
if ((offset < strlen(value) - 1) || (sscanf_s(value, "%d", partInfo) <= 0)) {
|
||||
goto ERROUT;
|
||||
}
|
||||
*partInfo = *partInfo * BYTES_PER_MBYTE;
|
||||
} else if (strcmp(p + strlen(p) - 1, "K") == 0) {
|
||||
if ((offset < (strlen(value) - 1)) || (sscanf_s(value, "%d", partInfo) <= 0)) {
|
||||
goto ERROUT;
|
||||
}
|
||||
*partInfo = *partInfo * BYTES_PER_KBYTE;
|
||||
} else if (sscanf_s(value, "0x%x", partInfo) > 0) {
|
||||
value += strlen("0x");
|
||||
if (strspn(value, HEX_NUMBER_STRING) < strlen(value)) {
|
||||
goto ERROUT;
|
||||
}
|
||||
} else {
|
||||
goto ERROUT;
|
||||
}
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
|
||||
ERROUT:
|
||||
PRINT_ERR("Invalid format: %s\n", p + strlen(partInfoName));
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
STATIC INT32 MatchPartInfo(CHAR *p, struct PartitionInfo *partInfo)
|
||||
{
|
||||
const CHAR *storageTypeArgName = partInfo->storageTypeArgName;
|
||||
const CHAR *fsTypeArgName = partInfo->fsTypeArgName;
|
||||
const CHAR *addrArgName = partInfo->addrArgName;
|
||||
const CHAR *partSizeArgName = partInfo->partSizeArgName;
|
||||
|
||||
if ((partInfo->storageType == NULL) && (strncmp(p, storageTypeArgName, strlen(storageTypeArgName)) == 0)) {
|
||||
partInfo->storageType = strdup(p + strlen(storageTypeArgName));
|
||||
if (partInfo->storageType == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
if ((partInfo->fsType == NULL) && (strncmp(p, fsTypeArgName, strlen(fsTypeArgName)) == 0)) {
|
||||
partInfo->fsType = strdup(p + strlen(fsTypeArgName));
|
||||
if (partInfo->fsType == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
if (partInfo->startAddr < 0) {
|
||||
if (MatchPartPos(p, addrArgName, &partInfo->startAddr) != LOS_OK) {
|
||||
return LOS_NOK;
|
||||
} else if (partInfo->startAddr >= 0) {
|
||||
return LOS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (partInfo->partSize < 0) {
|
||||
if (MatchPartPos(p, partSizeArgName, &partInfo->partSize) != LOS_OK) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC INT32 GetPartitionBootArgs(const CHAR *argName, CHAR **args)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 len = 0;
|
||||
CHAR *cmdLine = NULL;
|
||||
INT32 cmdLineLen;
|
||||
CHAR *tmp = NULL;
|
||||
|
||||
cmdLine = (CHAR *)malloc(COMMAND_LINE_SIZE);
|
||||
if (cmdLine == NULL) {
|
||||
PRINT_ERR("Malloc cmdLine space failed!\n");
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR)
|
||||
struct MtdDev *mtd = GetMtd(FLASH_TYPE);
|
||||
if (mtd == NULL) {
|
||||
PRINT_ERR("Get spinor mtd failed!\n");
|
||||
goto ERROUT;
|
||||
}
|
||||
cmdLineLen = mtd->read(mtd, COMMAND_LINE_ADDR, COMMAND_LINE_SIZE, cmdLine);
|
||||
if ((cmdLineLen != COMMAND_LINE_SIZE)) {
|
||||
PRINT_ERR("Read spinor command line failed!\n");
|
||||
goto ERROUT;
|
||||
}
|
||||
#else
|
||||
cmdLineLen = 0;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < cmdLineLen; i += len + 1) {
|
||||
len = strlen(cmdLine + i);
|
||||
tmp = strstr(cmdLine + i, argName);
|
||||
if (tmp != NULL) {
|
||||
*args = strdup(tmp + strlen(argName));
|
||||
if (*args == NULL) {
|
||||
goto ERROUT;
|
||||
}
|
||||
free(cmdLine);
|
||||
return LOS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
PRINTK("no patch partition bootargs\n");
|
||||
|
||||
ERROUT:
|
||||
free(cmdLine);
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
INT32 GetPartitionInfo(struct PartitionInfo *partInfo)
|
||||
{
|
||||
CHAR *args = NULL;
|
||||
CHAR *argsBak = NULL;
|
||||
CHAR *p = NULL;
|
||||
|
||||
if (GetPartitionBootArgs(partInfo->cmdlineArgName, &args) != LOS_OK) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
argsBak = args;
|
||||
|
||||
p = strsep(&args, " ");
|
||||
while (p != NULL) {
|
||||
if (MatchPartInfo(p, partInfo) != LOS_OK) {
|
||||
goto ERROUT;
|
||||
}
|
||||
p = strsep(&args, " ");
|
||||
}
|
||||
if ((partInfo->fsType != NULL) && (partInfo->storageType != NULL)) {
|
||||
free(argsBak);
|
||||
return LOS_OK;
|
||||
}
|
||||
PRINT_ERR("Cannot find %s type\n", partInfo->partName);
|
||||
|
||||
ERROUT:
|
||||
PRINT_ERR("Invalid %s information!\n", partInfo->partName);
|
||||
if (partInfo->storageType != NULL) {
|
||||
free(partInfo->storageType);
|
||||
partInfo->storageType = NULL;
|
||||
}
|
||||
if (partInfo->fsType != NULL) {
|
||||
free(partInfo->fsType);
|
||||
partInfo->fsType = NULL;
|
||||
}
|
||||
free(argsBak);
|
||||
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
const CHAR *GetDevNameOfPartition(const struct PartitionInfo *partInfo)
|
||||
{
|
||||
const CHAR *devName = NULL;
|
||||
|
||||
if (strcmp(partInfo->storageType, STORAGE_TYPE) == 0) {
|
||||
#if defined(LOSCFG_STORAGE_SPINOR)
|
||||
INT32 ret = add_mtd_partition(FLASH_TYPE, partInfo->startAddr, partInfo->partSize, partInfo->partNum);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("Failed to add %s partition! error = %d\n", partInfo->partName, ret);
|
||||
} else {
|
||||
if (partInfo->devName != NULL) {
|
||||
devName = partInfo->devName;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
PRINT_ERR("Failed to find %s dev type: %s\n", partInfo->partName, partInfo->storageType);
|
||||
}
|
||||
|
||||
return devName;
|
||||
}
|
||||
|
||||
INT32 ResetDevNameofPartition(const struct PartitionInfo *partInfo)
|
||||
{
|
||||
INT32 ret;
|
||||
#if defined(LOSCFG_STORAGE_SPINOR)
|
||||
ret = delete_mtd_partition(partInfo->partNum, FLASH_TYPE);
|
||||
if (ret != ENOERR) {
|
||||
int err = get_errno();
|
||||
PRINT_ERR("Failed to delete %s, errno %d: %s\n", partInfo->devName, err, strerror(err));
|
||||
ret = LOS_NOK;
|
||||
}
|
||||
#else
|
||||
ret = LOS_NOK;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
73
kernel/common/patchfs/los_partition_utils.h
Normal file
73
kernel/common/patchfs/los_partition_utils.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _LOS_PARTITION_UTILS_H
|
||||
#define _LOS_PARTITION_UTILS_H
|
||||
|
||||
#include "menuconfig.h"
|
||||
#include "los_typedef.h"
|
||||
#include "los_base.h"
|
||||
|
||||
#define BYTES_PER_MBYTE 0x100000
|
||||
#define BYTES_PER_KBYTE 0x400
|
||||
#define DEC_NUMBER_STRING "0123456789"
|
||||
#define HEX_NUMBER_STRING "0123456789abcdefABCDEF"
|
||||
|
||||
#define COMMAND_LINE_ADDR LOSCFG_BOOTENV_ADDR * BYTES_PER_KBYTE
|
||||
#define COMMAND_LINE_SIZE 1024
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR)
|
||||
#define FLASH_TYPE "spinor"
|
||||
#define STORAGE_TYPE "flash"
|
||||
#define FS_TYPE "jffs2"
|
||||
#else
|
||||
#define STORAGE_TYPE "emmc"
|
||||
#endif
|
||||
|
||||
struct PartitionInfo {
|
||||
const CHAR *partName;
|
||||
const CHAR *cmdlineArgName;
|
||||
const CHAR *storageTypeArgName;
|
||||
CHAR *storageType;
|
||||
const CHAR *fsTypeArgName;
|
||||
CHAR *fsType;
|
||||
const CHAR *addrArgName;
|
||||
INT32 startAddr;
|
||||
const CHAR *partSizeArgName;
|
||||
INT32 partSize;
|
||||
CHAR *devName;
|
||||
UINT32 partNum;
|
||||
};
|
||||
|
||||
INT32 GetPartitionInfo(struct PartitionInfo *partInfo);
|
||||
const CHAR *GetDevNameOfPartition(const struct PartitionInfo *partInfo);
|
||||
INT32 ResetDevNameofPartition(const struct PartitionInfo *partInfo);
|
||||
|
||||
#endif /* _LOS_PARTITION_UTILS_H */
|
||||
101
kernel/common/patchfs/los_patchfs.c
Executable file
101
kernel/common/patchfs/los_patchfs.c
Executable file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_patchfs.h"
|
||||
#include "los_partition_utils.h"
|
||||
|
||||
#include "sys/mount.h"
|
||||
#include "inode/inode.h"
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_PATCHFS
|
||||
|
||||
INT32 OsMountPatchFs(VOID)
|
||||
{
|
||||
INT32 ret;
|
||||
struct PartitionInfo partInfo = {
|
||||
PATCHPART_NAME, PATCH_CMDLINE_ARGNAME,
|
||||
PATCH_STORAGE_ARGNAME, NULL,
|
||||
PATCH_FSTYPE_ARGNAME, NULL,
|
||||
PATCH_ADDR_ARGNAME, -1,
|
||||
PATCH_SIZE_ARGNAME, -1,
|
||||
NULL, PATCH_PARTITIONNUM
|
||||
};
|
||||
|
||||
#ifdef LOSCFG_SECURITY_BOOT
|
||||
partInfo.storageType = strdup(STORAGE_TYPE);
|
||||
if (partInfo.storageType == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
partInfo.fsType = strdup(FS_TYPE);
|
||||
if (partInfo.fsType == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
partInfo.startAddr = PATCHFS_FLASH_ADDR;
|
||||
partInfo.partSize = PATCHFS_FLASH_SIZE;
|
||||
#else
|
||||
ret = GetPartitionInfo(&partInfo);
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
partInfo.startAddr = (partInfo.startAddr >= 0) ? partInfo.startAddr : PATCHFS_FLASH_ADDR;
|
||||
partInfo.partSize = (partInfo.partSize >= 0) ? partInfo.partSize : PATCHFS_FLASH_SIZE;
|
||||
#endif
|
||||
|
||||
ret = LOS_NOK;
|
||||
partInfo.devName = strdup(PATCH_FLASH_DEV_NAME);
|
||||
if (partInfo.devName == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
const CHAR *devName = GetDevNameOfPartition(&partInfo);
|
||||
if (devName != NULL) {
|
||||
ret = mkdir(PATCHFS_MOUNT_POINT, 0);
|
||||
if (ret == LOS_OK) {
|
||||
ret = mount(devName, PATCHFS_MOUNT_POINT, partInfo.fsType, MS_RDONLY, NULL);
|
||||
if (ret != LOS_OK) {
|
||||
int err = get_errno();
|
||||
PRINT_ERR("Failed to mount %s, errno %d: %s\n", partInfo.partName, err, strerror(err));
|
||||
}
|
||||
} else {
|
||||
int err = get_errno();
|
||||
PRINT_ERR("Failed to mkdir %s, errno %d: %s\n", PATCHFS_MOUNT_POINT, err, strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret != LOS_OK) && (devName != NULL)) {
|
||||
ResetDevNameofPartition(&partInfo);
|
||||
}
|
||||
|
||||
free(partInfo.devName);
|
||||
free(partInfo.storageType);
|
||||
free(partInfo.fsType);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // LOSCFG_PLATFORM_PATCHFS
|
||||
66
kernel/common/patchfs/los_patchfs.h
Normal file
66
kernel/common/patchfs/los_patchfs.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _LOS_PATCHFS_H
|
||||
#define _LOS_PATCHFS_H
|
||||
|
||||
#include "los_typedef.h"
|
||||
#include "los_base.h"
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#define PATCH_PARTITIONNUM 1
|
||||
#ifdef TEE_ENABLE
|
||||
#define PATCHFS_FLASH_ADDR 0xC00000
|
||||
#define PATCHFS_FLASH_SIZE 0x200000
|
||||
#else
|
||||
#define PATCHFS_FLASH_ADDR 0xD00000
|
||||
#define PATCHFS_FLASH_SIZE 0x300000
|
||||
#endif
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR)
|
||||
#define PATCH_FLASH_DEV_NAME "/dev/spinorblk"__stringify(PATCH_PARTITIONNUM)
|
||||
#else
|
||||
#define PATCH_FLASH_DEV_NAME "/dev/mmcblk"__stringify(PATCH_PARTITIONNUM)
|
||||
#endif
|
||||
|
||||
#define PATCHFS_MOUNT_POINT "/patch"
|
||||
|
||||
#define PATCHPART_NAME "patchfs"
|
||||
#define PATCH_CMDLINE_ARGNAME "patchfs="
|
||||
#define PATCH_STORAGE_ARGNAME "patch="
|
||||
#define PATCH_FSTYPE_ARGNAME "patchfstype="
|
||||
#define PATCH_ADDR_ARGNAME "patchaddr="
|
||||
#define PATCH_SIZE_ARGNAME "patchsize="
|
||||
|
||||
INT32 OsMountPatchFs(VOID);
|
||||
|
||||
#endif /* _LOS_PATCHFS_H */
|
||||
Reference in New Issue
Block a user