diff --git a/Makefile b/Makefile index 6a36cc46b12b0677b5fd57a4ec5324f5cc076216..51868d662745c72baa0b1c9960929723296cbda7 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/arch/arm/arm/src/los_exc.c b/arch/arm/arm/src/los_exc.c index 47430b824adc969c35eb2a1660f2d20caabf461b..0dcfe5f79794685c5bc504a7370143bc568703bb 100644 --- a/arch/arm/arm/src/los_exc.c +++ b/arch/arm/arm/src/los_exc.c @@ -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); diff --git a/compat/posix/src/mqueue.c b/compat/posix/src/mqueue.c index 9f1f0318fe507f432cf715378c0dcb4bb918376a..38adb40fb4a3f9246df121ceeb2d26004d0b52c6 100644 --- a/compat/posix/src/mqueue.c +++ b/compat/posix/src/mqueue.c @@ -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 diff --git a/compat/posix/src/time.c b/compat/posix/src/time.c index b94c6a2aa8cc2ef7ae2bf90c6b1b885a889bf85f..43a74fe2036d9aa93bb1fe3a4751e23294f3b09a 100644 --- a/compat/posix/src/time.c +++ b/compat/posix/src/time.c @@ -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 diff --git a/kernel/base/core/los_process.c b/kernel/base/core/los_process.c index 7d273d136c3b902d1402d63a8e6793931c13c1dd..b1d7e46e6c7cf553171148afdef5d8f579916f7d 100644 --- a/kernel/base/core/los_process.c +++ b/kernel/base/core/los_process.c @@ -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) { diff --git a/kernel/base/include/los_vm_filemap.h b/kernel/base/include/los_vm_filemap.h index e0d2d4ca88ab540e5345c78ca4f20961b61f623f..70047b2023f7ff487e255cbf5e92a2b6a9f67425 100644 --- a/kernel/base/include/los_vm_filemap.h +++ b/kernel/base/include/los_vm_filemap.h @@ -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" diff --git a/kernel/base/misc/sysinfo_shellcmd.c b/kernel/base/misc/sysinfo_shellcmd.c index b1b38f00073d139ad1e5a0cdcbef98a614b474ed..31431743cc6bb590fc6919d9a011a09791f1b189 100644 --- a/kernel/base/misc/sysinfo_shellcmd.c +++ b/kernel/base/misc/sysinfo_shellcmd.c @@ -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" diff --git a/kernel/base/misc/vm_shellcmd.c b/kernel/base/misc/vm_shellcmd.c index bb3edcaa63a2e012f1ddd0f0126bb6968d369f23..250c28c090e28e7517650a316687875113580405 100644 --- a/kernel/base/misc/vm_shellcmd.c +++ b/kernel/base/misc/vm_shellcmd.c @@ -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 diff --git a/kernel/base/vm/los_vm_dump.c b/kernel/base/vm/los_vm_dump.c index c05cc97aa0beecdd5fabf0e13f6df0d08f6cc577..124ff65f4e9f2ce31530abbcf15399f53bf92b0c 100644 --- a/kernel/base/vm/los_vm_dump.c +++ b/kernel/base/vm/los_vm_dump.c @@ -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" diff --git a/kernel/base/vm/los_vm_filemap.c b/kernel/base/vm/los_vm_filemap.c index 9447b3daa6ef6f8c6660c2f1d373c5b7d8057555..fbdf836cf7f8050504c57c28815f617453fb1b75 100644 --- a/kernel/base/vm/los_vm_filemap.c +++ b/kernel/base/vm/los_vm_filemap.c @@ -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 diff --git a/kernel/base/vm/los_vm_map.c b/kernel/base/vm/los_vm_map.c index 9524279605d9dadbbf40d441d6b2bfd302093587..566a798592de92e978dc7bdb338d9867d90c63a0 100644 --- a/kernel/base/vm/los_vm_map.c +++ b/kernel/base/vm/los_vm_map.c @@ -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" diff --git a/kernel/base/vm/los_vm_phys.c b/kernel/base/vm/los_vm_phys.c index 59ab9e4e21582bba43a6c756ba34061153084203..d1e006d3967f545dafa5a5b058c39a3218f8d60d 100644 --- a/kernel/base/vm/los_vm_phys.c +++ b/kernel/base/vm/los_vm_phys.c @@ -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; } diff --git a/kernel/common/los_config.c b/kernel/common/los_config.c index c59fe9175b91af38e53f9596051c9a74986bc40b..afd45a7859f746157d6af200559b3be1c7504423 100644 --- a/kernel/common/los_config.c +++ b/kernel/common/los_config.c @@ -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; diff --git a/kernel/common/los_printf.c b/kernel/common/los_printf.c index b5d2a002ce6af6a2b507bb109e7ebf58f0a224cc..98d0eb260abb8f03dff207e971189b6fe421f426 100644 --- a/kernel/common/los_printf.c +++ b/kernel/common/los_printf.c @@ -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) { diff --git a/syscall/los_syscall.h b/syscall/los_syscall.h index 786a1d1863fe72728fdabd912ae3500452c02079..726c9f8bf6847361c40c0ffb431d9b7c22796209 100644 --- a/syscall/los_syscall.h +++ b/syscall/los_syscall.h @@ -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); diff --git a/tools/build/config/qemu_arm_virt_mini.config b/tools/build/config/qemu_arm_virt_mini.config new file mode 100644 index 0000000000000000000000000000000000000000..1300f151bd9a99c0b2381f053e07f3394a3545ea --- /dev/null +++ b/tools/build/config/qemu_arm_virt_mini.config @@ -0,0 +1,14 @@ +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