diff --git a/system/init/CMakeLists.txt b/system/init/CMakeLists.txt new file mode 100644 index 00000000000..02c7c0b808c --- /dev/null +++ b/system/init/CMakeLists.txt @@ -0,0 +1,39 @@ +# ############################################################################## +# apps/system/init/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +if(CONFIG_SYSTEM_INIT) + + set(CSRCS init.c action.c builtin.c import.c parser.c service.c) + + nuttx_add_application( + MODULE + ${CONFIG_SYSTEM_INIT} + NAME + ${CONFIG_SYSTEM_INIT_PROGNAME} + STACKSIZE + ${CONFIG_SYSTEM_INIT_STACKSIZE} + PRIORITY + ${CONFIG_SYSTEM_INIT_PRIORITY} + SRCS + ${CSRCS}) + +endif() diff --git a/system/init/Kconfig b/system/init/Kconfig new file mode 100644 index 00000000000..41ed04cbf2a --- /dev/null +++ b/system/init/Kconfig @@ -0,0 +1,124 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config SYSTEM_INIT + tristate "System Init" + default n + depends on LIBC_EXECFUNCS + depends on SCHED_CHILD_STATUS + ---help--- + Enable system init. + +if SYSTEM_INIT + +# +# Basic +# + +config SYSTEM_INIT_PRIORITY + int "Thread priority" + default 100 + +config SYSTEM_INIT_STACKSIZE + int "Stack size" + default DEFAULT_TASK_STACKSIZE + +config SYSTEM_INIT_PROGNAME + string "Program name" + default "init" + +# +# RC +# + +config SYSTEM_INIT_RC_LINE_MAX + int "Max line length of RC file" + default 128 + ---help--- + Maximum line length of RC file. + More details: https://android.googlesource.com/platform/system/core/+/master/init/README.md + +# +# Action +# + +config SYSTEM_INIT_ACTION_CMD_ARGS_MAX + int "Max number of command arguments" + default 8 + ---help--- + Maximum number of command arguments. + Form: + ``` + on + + + + ... + ``` + +config SYSTEM_INIT_ACTION_WARN_SLOW + int "Warn if command takes too long" + default 50 + depends on SYSTEM_INIT_WARN + ---help--- + Warning if command took more than `SYSTEM_INIT_ACTION_WARN_SLOW` ms. + +config SYSTEM_INIT_ACTION_MANAGER_EVENT_MAX + int "Max number of action manager events" + default 32 + ---help--- + Maximum number of action manager events. + ``` + struct action_manager_s + { + ... + FAR char *events[CONFIG_SYSTEM_INIT_ACTION_MANAGER_EVENT_MAX]; + ... + }; + ``` + +# +# Service +# + +config SYSTEM_INIT_SERVICE_ARGS_MAX + int "Max number of service arguments" + default 8 + range 3 64 + ---help--- + Maximum number of service arguments, + including "name", "pathname" and key word "service"(at least 3). Form: + ``` + service [ ]* +