add QEMU arm 'virt' CFI flash support, enable rootfs and user-space app
This commit is contained in:
parent
71144b4a1e
commit
9404c9971d
|
@ -71,10 +71,18 @@ static VOID MtdNorParamAssign(partition_param *spinorParam, const struct MtdDev
|
|||
* you can change the SPIBLK_NAME or SPICHR_NAME to NULL.
|
||||
*/
|
||||
spinorParam->flash_mtd = (struct MtdDev *)spinorMtd;
|
||||
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
spinorParam->flash_ops = GetDevSpinorOps();
|
||||
spinorParam->char_ops = GetMtdCharFops();
|
||||
spinorParam->blockname = SPIBLK_NAME;
|
||||
spinorParam->charname = SPICHR_NAME;
|
||||
#else
|
||||
extern struct block_operations *GetCfiBlkOps(void);
|
||||
spinorParam->flash_ops = GetCfiBlkOps();
|
||||
spinorParam->char_ops = NULL;
|
||||
spinorParam->blockname = "/dev/cfiflash";
|
||||
spinorParam->charname = NULL;
|
||||
#endif
|
||||
spinorParam->partition_head = g_spinorPartitionHead;
|
||||
spinorParam->block_size = spinorMtd->eraseSize;
|
||||
}
|
||||
|
@ -88,7 +96,12 @@ static VOID MtdDeinitSpinorParam(VOID)
|
|||
|
||||
static partition_param *MtdInitSpinorParam(partition_param *spinorParam)
|
||||
{
|
||||
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
struct MtdDev *spinorMtd = GetMtd("spinor");
|
||||
#else
|
||||
extern struct MtdDev *GetCfiMtdDev(void);
|
||||
struct MtdDev *spinorMtd = GetCfiMtdDev();
|
||||
#endif
|
||||
if (spinorMtd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -121,7 +134,7 @@ static partition_param *MtdInitSpinorParam(partition_param *spinorParam)
|
|||
/* According the flash-type to init the param of the partition. */
|
||||
static INT32 MtdInitFsparParam(const CHAR *type, partition_param **fsparParam)
|
||||
{
|
||||
if (strcmp(type, "spinor") == 0) {
|
||||
if (strcmp(type, "spinor") == 0 || strcmp(type, "cfi-flash") == 0) {
|
||||
g_spinorPartParam = MtdInitSpinorParam(g_spinorPartParam);
|
||||
*fsparParam = g_spinorPartParam;
|
||||
} else {
|
||||
|
@ -138,7 +151,7 @@ static INT32 MtdInitFsparParam(const CHAR *type, partition_param **fsparParam)
|
|||
/* According the flash-type to deinit the param of the partition. */
|
||||
static INT32 MtdDeinitFsparParam(const CHAR *type)
|
||||
{
|
||||
if (strcmp(type, "spinor") == 0) {
|
||||
if (strcmp(type, "spinor") == 0 || strcmp(type, "cfi-flash") == 0) {
|
||||
MtdDeinitSpinorParam();
|
||||
g_spinorPartParam = NULL;
|
||||
} else {
|
||||
|
@ -356,7 +369,7 @@ static INT32 DeleteParamCheck(UINT32 partitionNum,
|
|||
const CHAR *type,
|
||||
partition_param **param)
|
||||
{
|
||||
if (strcmp(type, "spinor") == 0) {
|
||||
if (strcmp(type, "spinor") == 0 || strcmp(type, "cfi-flash") == 0) {
|
||||
*param = g_spinorPartParam;
|
||||
} else {
|
||||
PRINT_ERR("type error \n");
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "los_base.h"
|
||||
#include "los_typedef.h"
|
||||
#include "string.h"
|
||||
#ifdef LOSCFG_PLATFORM_HI3518EV300
|
||||
#if defined(LOSCFG_PLATFORM_HI3518EV300) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#include "mtd_partition.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_DRIVERS_MMC
|
||||
|
@ -181,6 +181,24 @@ STATIC const CHAR *GetDevName(const CHAR *rootType, INT32 rootAddr, INT32 rootSi
|
|||
rootDev = AddEmmcRootfsPart(rootAddr, rootSize);
|
||||
} else
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#define CFIFLASH_CAPACITY 64 * 1024 * 1024
|
||||
INT32 ret;
|
||||
if (strcmp(rootType, "cfi-flash") == 0) {
|
||||
ret = add_mtd_partition("cfi-flash", rootAddr, rootSize, 0);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("Failed to add cfi-flash root partition!\n");
|
||||
} else {
|
||||
rootDev = "/dev/cfiflash0";
|
||||
ret = add_mtd_partition("cfi-flash", (rootAddr + rootSize),
|
||||
CFIFLASH_CAPACITY - rootAddr - rootSize, 1);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("Failed to add cfi-flash storage partition!\n");
|
||||
}
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PRINT_ERR("Failed to find root dev type: %s\n", rootType);
|
||||
}
|
||||
|
@ -239,8 +257,7 @@ STATIC INT32 GetArgs(CHAR **args)
|
|||
* bootloader it will pass DTB by default.
|
||||
*/
|
||||
(void)ret;
|
||||
PRINT_ERR("Fetching bootargs unimplemented.\n");
|
||||
goto ERROUT;
|
||||
cmdLine = "bootargs=root=cfi-flash fstype=jffs2 rootaddr=0xA00000 rootsize=27M";
|
||||
#endif
|
||||
|
||||
for (i = 0; i < COMMAND_LINE_SIZE; i += len + 1) {
|
||||
|
@ -471,6 +488,19 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
|
|||
PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
ret = mkdir("/storage", DEFAULT_STORAGE_MOUNT_DIR_MODE);
|
||||
if (ret != LOS_OK) {
|
||||
err = get_errno();
|
||||
PRINT_ERR("Failed to reserve inode /storage, errno %d: %s\n", err, strerror(err));
|
||||
} else {
|
||||
ret = mount("/dev/cfiflash1", "/storage", fsType, 0, NULL);
|
||||
if (ret != LOS_OK) {
|
||||
err = get_errno();
|
||||
PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return LOS_OK;
|
||||
|
|
|
@ -34,6 +34,7 @@ LOSCFG_ARCH_CPU="cortex-a7"
|
|||
#
|
||||
# LOSCFG_ARCH_FPU_DISABLE is not set
|
||||
LOSCFG_IRQ_USE_STANDALONE_STACK=y
|
||||
LOSCFG_PLATFORM_ROOTFS=y
|
||||
|
||||
#
|
||||
# Kernel
|
||||
|
@ -43,7 +44,7 @@ LOSCFG_KERNEL_EXTKERNEL=y
|
|||
# LOSCFG_KERNEL_CPPSUPPORT is not set
|
||||
LOSCFG_KERNEL_CPUP=y
|
||||
LOSCFG_CPUP_INCLUDE_IRQ=y
|
||||
# LOSCFG_KERNEL_DYNLOAD is not set
|
||||
LOSCFG_KERNEL_DYNLOAD=y
|
||||
# LOSCFG_KERNEL_VDSO is not set
|
||||
# LOSCFG_KERNEL_TICKLESS is not set
|
||||
# LOSCFG_KERNEL_TRACE is not set
|
||||
|
@ -72,7 +73,7 @@ LOSCFG_FILE_MODE=y
|
|||
# LOSCFG_FS_FAT is not set
|
||||
LOSCFG_FS_RAMFS=y
|
||||
LOSCFG_FS_PROC=y
|
||||
# LOSCFG_FS_JFFS is not set
|
||||
LOSCFG_FS_JFFS=y
|
||||
|
||||
#
|
||||
# Net
|
||||
|
@ -97,7 +98,7 @@ LOSCFG_SHELL=y
|
|||
# LOSCFG_SHELL_LK is not set
|
||||
# LOSCFG_SHELL_EXCINFO is not set
|
||||
# LOSCFG_EXC_INTERACTION is not set
|
||||
# LOSCFG_USER_INIT_DEBUG is not set
|
||||
LOSCFG_USER_INIT_DEBUG=y
|
||||
# LOSCFG_SHELL_CMD_DEBUG is not set
|
||||
# LOSCFG_MEM_DEBUG is not set
|
||||
# LOSCFG_NULL_ADDRESS_PROTECT is not set
|
||||
|
@ -125,7 +126,7 @@ LOSCFG_DRIVERS_HDF_PLATFORM=y
|
|||
# LOSCFG_DRIVERS_HDF_USB is not set
|
||||
LOSCFG_DRIVERS_MEM=y
|
||||
# LOSCFG_DRIVERS_MMC is not set
|
||||
# LOSCFG_DRIVERS_MTD is not set
|
||||
LOSCFG_DRIVERS_MTD=y
|
||||
# LOSCFG_DRIVERS_RANDOM is not set
|
||||
# LOSCFG_DRIVERS_VIDEO is not set
|
||||
# LOSCFG_DRIVERS_HIEVENT is not set
|
||||
|
|
Loading…
Reference in New Issue