提交 744b2021 编写于 作者: C Caoruihong

chore: add a mini config for qemu arm virt

support turn off as many features as possible.
current only libc and posix and bsd can not be turned off.
Signed-off-by: NCaoruihong <crh.cao@huawei.com>
Change-Id: I1e97570c67593207a56dc11f357eca4b4a018bfd
上级 e59693e7
......@@ -145,10 +145,9 @@ genconfig:$(MENUCONFIG_CONF)
$< --silentoldconfig $(KCONFIG_FILE_PATH)
##### menuconfig end #######
$(LITEOS_MENUCONFIG_H):
ifneq ($(LITEOS_MENUCONFIG_H), $(wildcard $(LITEOS_MENUCONFIG_H)))
$(LITEOS_MENUCONFIG_H): .config
$(HIDE)$(MAKE) genconfig
endif
$(LITEOS_TARGET): $(__LIBS)
$(HIDE)touch $(LOSCFG_ENTRY_SRC)
......
......@@ -676,7 +676,9 @@ VOID BackTraceSub(UINTPTR regFP)
UINTPTR backFP = regFP;
UINT32 count = 0;
VADDR_T kvaddr;
#ifdef LOSCFG_KERNEL_VM
LosProcessCB *runProcess = OsCurrProcessGet();
#endif
if (FindSuitableStack(regFP, &stackStart, &stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback error fp = 0x%x\n", regFP);
......
......@@ -30,6 +30,7 @@
*/
#include "mqueue.h"
#ifdef LOSCFG_FS_VFS
#include "fcntl.h"
#include "pthread.h"
#include "map_error.h"
......@@ -831,3 +832,4 @@ ssize_t mq_receive(mqd_t personal, char *msg_ptr, size_t msg_len, unsigned int *
return mq_timedreceive(personal, msg_ptr, msg_len, msg_prio, NULL);
}
#endif
......@@ -451,6 +451,7 @@ int clock_settime(clockid_t clockID, const struct timespec *tp)
return settimeofday(&tv, NULL);
}
#ifdef LOSCFG_KERNEL_CPUP
static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
{
uint64_t runtime;
......@@ -519,12 +520,47 @@ static int GetCputime(clockid_t clockID, struct timespec *tp)
return ret;
}
static int CheckClock(const clockid_t clockID)
{
int error = 0;
const pid_t pid = ((pid_t) ~((clockID) >> CPUCLOCK_ID_OFFSET));
if (!((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK)) {
LosProcessCB *spcb = NULL;
if (OsProcessIDUserCheckInvalid(pid) || pid < 0) {
return -EINVAL;
}
spcb = OS_PCB_FROM_PID(pid);
if (OsProcessIsUnused(spcb)) {
error = -EINVAL;
}
} else {
error = -EINVAL;
}
return error;
}
static int CpuClockGetres(const clockid_t clockID, struct timespec *tp)
{
if (clockID > 0) {
return -EINVAL;
}
int error = CheckClock(clockID);
if (!error) {
error = ProcessGetCputime(clockID, tp);
}
return error;
}
#endif
int clock_gettime(clockid_t clockID, struct timespec *tp)
{
UINT32 intSave;
struct timespec64 tmp = {0};
struct timespec64 hwTime = {0};
int ret;
if (clockID > MAX_CLOCKS) {
goto ERROUT;
......@@ -566,61 +602,24 @@ int clock_gettime(clockid_t clockID, struct timespec *tp)
case CLOCK_TAI:
TIME_RETURN(ENOTSUP);
default:
{
{
#ifdef LOSCFG_KERNEL_CPUP
ret = GetCputime(clockID, tp);
int ret = GetCputime(clockID, tp);
TIME_RETURN(-ret);
#else
TIME_RETURN(EINVAL);
TIME_RETURN(EINVAL);
#endif
}
}
}
return 0;
ERROUT:
ERROUT:
TIME_RETURN(EINVAL);
}
static int CheckClock(const clockid_t clockID)
{
int error = 0;
const pid_t pid = ((pid_t) ~((clockID) >> CPUCLOCK_ID_OFFSET));
if (!((UINT32)clockID & CPUCLOCK_PERTHREAD_MASK)) {
LosProcessCB *spcb = NULL;
if (OsProcessIDUserCheckInvalid(pid) || pid < 0) {
return -EINVAL;
}
spcb = OS_PCB_FROM_PID(pid);
if (OsProcessIsUnused(spcb)) {
error = -EINVAL;
}
} else {
error = -EINVAL;
}
return error;
}
static int CpuClockGetres(const clockid_t clockID, struct timespec *tp)
{
if (clockID > 0) {
return -EINVAL;
}
int error = CheckClock(clockID);
if (!error) {
error = ProcessGetCputime(clockID, tp);
}
return error;
}
int clock_getres(clockid_t clockID, struct timespec *tp)
{
int ret;
if (tp == NULL) {
TIME_RETURN(EINVAL);
}
......@@ -650,7 +649,7 @@ int clock_getres(clockid_t clockID, struct timespec *tp)
default:
#ifdef LOSCFG_KERNEL_CPUP
{
ret = CpuClockGetres(clockID, tp);
int ret = CpuClockGetres(clockID, tp);
TIME_RETURN(-ret);
}
#else
......
......@@ -749,8 +749,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSystemProcessCreate(VOID)
LOS_ListTailInsert(&kerInitProcess->childrenList, &idleProcess->siblingList);
idleProcess->group = kerInitProcess->group;
LOS_ListTailInsert(&kerInitProcess->group->processList, &idleProcess->subordinateGroupList);
#ifdef LOSCFG_SECURITY_CAPABILITY
idleProcess->user = kerInitProcess->user;
#endif
#ifdef LOSCFG_FS_VFS
idleProcess->files = kerInitProcess->files;
#endif
ret = OsIdleTaskCreate();
if (ret != LOS_OK) {
......
......@@ -37,7 +37,9 @@
#ifndef __LOS_VM_FILEMAP_H__
#define __LOS_VM_FILEMAP_H__
#ifdef LOSCFG_FS_VFS
#include "fs/file.h"
#endif
#include "los_vm_map.h"
#include "los_vm_page.h"
#include "los_vm_common.h"
......
......@@ -34,6 +34,7 @@
#include "los_sem_pri.h"
#include "los_queue_pri.h"
#include "los_swtmr_pri.h"
#include "los_task_pri.h"
#ifdef LOSCFG_SHELL
#include "shcmd.h"
......
......@@ -42,8 +42,9 @@
#include "los_oom.h"
#include "los_vm_dump.h"
#include "los_process_pri.h"
#ifdef LOSCFG_FS_VFS
#include "fs/path_cache.h"
#endif
#ifdef LOSCFG_KERNEL_VM
......
......@@ -36,7 +36,9 @@
#include "los_vm_dump.h"
#include "los_mmu_descriptor_v6.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#include "los_printf.h"
#include "los_vm_page.h"
#include "los_vm_phys.h"
......
......@@ -42,6 +42,9 @@
#include "los_process_pri.h"
#include "los_vm_lock.h"
#ifndef UNUSED
#define UNUSED(x) (VOID)x
#endif
#ifdef LOSCFG_KERNEL_VM
......
......@@ -40,7 +40,9 @@
#include "los_vm_shm_pri.h"
#include "los_arch_mmu.h"
#include "los_process_pri.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#include "los_task.h"
#include "los_memory_pri.h"
#include "los_vm_boot.h"
......
......@@ -626,7 +626,7 @@ size_t LOS_PhysPagesFree(LOS_DL_LIST *list)
#else
VADDR_T *LOS_PaddrToKVaddr(PADDR_T paddr)
{
if ((paddr < DDR_MEM_ADDR) || (paddr >= (DDR_MEM_ADDR + DDR_MEM_SIZE))) {
if ((paddr < DDR_MEM_ADDR) || (paddr >= ((PADDR_T)DDR_MEM_ADDR + DDR_MEM_SIZE))) {
return NULL;
}
......
......@@ -280,6 +280,13 @@ LITE_OS_SEC_TEXT_INIT INT32 OsMain(VOID)
return LOS_OK;
}
#ifndef LOSCFG_PLATFORM_ADAPT
STATIC VOID SystemInit(VOID)
{
PRINTK("dummy: *** %s ***\n", __FUNCTION__);
}
#endif
STATIC UINT32 OsSystemInitTaskCreate(VOID)
{
UINT32 taskID;
......
......@@ -85,6 +85,7 @@ STATIC VOID UartOutput(const CHAR *str, UINT32 len, BOOL isLock)
#endif
}
#ifdef LOSCFG_PLATFORM_CONSOLE
STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len)
{
ssize_t writen = 0;
......@@ -100,6 +101,7 @@ STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len)
toWrite -= cnt;
}
}
#endif
VOID OutputControl(const CHAR *str, UINT32 len, OutputType type)
{
......
......@@ -36,7 +36,9 @@
#include "los_task.h"
#include "los_mux.h"
#include "los_signal.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#include "syscall.h"
#include "sysinfo.h"
#ifdef LOSCFG_KERNEL_DYNLOAD
......@@ -48,7 +50,9 @@
#include "sys/shm.h"
#include "poll.h"
#include "utime.h"
#ifdef LOSCFG_COMPAT_POSIX
#include "mqueue.h"
#endif
#include "time.h"
#include "sys/time.h"
#include "sys/stat.h"
......@@ -107,6 +111,8 @@ extern int SysFutex(const unsigned int *uAddr, unsigned int flags, int val,
unsigned int absTime, const unsigned int *newUserAddr);
extern int SysSchedGetAffinity(int id, unsigned int *cpuset, int flag);
extern int SysSchedSetAffinity(int id, const unsigned short cpuset, int flag);
#ifdef LOSCFG_COMPAT_POSIX
extern mqd_t SysMqOpen(const char *mqName, int openFlag, mode_t mode, struct mq_attr *attr);
extern int SysMqClose(mqd_t personal);
extern int SysMqGetSetAttr(mqd_t mqd, const struct mq_attr *new, struct mq_attr *old);
......@@ -116,6 +122,8 @@ extern int SysMqTimedSend(mqd_t personal, const char *msg, size_t msgLen, unsign
const struct timespec *absTimeout);
extern ssize_t SysMqTimedReceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio,
const struct timespec *absTimeout);
#endif
extern int SysSigAction(int sig, const sigaction_t *restrict sa, sigaction_t *restrict old, size_t sigsetsize);
extern int SysSigprocMask(int how, const sigset_t_l *restrict set, sigset_t *restrict old, size_t sigsetsize);
extern int SysKill(pid_t pid, int sig);
......
LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7=y
LOSCFG_BOARD_CONFIG_PATH="device/qemu/arm_virt/liteos_a/config/board"
# LOSCFG_HRTIMER_ENABLE is not set
# LOSCFG_IRQ_USE_STANDALONE_STACK is not set
# LOSCFG_KERNEL_MMU is not set
# LOSCFG_KERNEL_EXTKERNEL is not set
# LOSCFG_BASE_CORE_HILOG is not set
# LOSCFG_LIB_ZLIB is not set
# LOSCFG_FS_VFS is not set
# LOSCFG_NET_LWIP_SACK is not set
# LOSCFG_PLATFORM_ADAPT is not set
# LOSCFG_ENABLE_MAGICKEY is not set
# LOSCFG_DRIVERS is not set
# LOSCFG_SECURITY is not set
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册