system/nxinit: improve init.rc parser (per-cpu configs, --option fix) - #3737
Open
JianyuWang0623 wants to merge 2 commits into
Open
system/nxinit: improve init.rc parser (per-cpu configs, --option fix)#3737JianyuWang0623 wants to merge 2 commits into
JianyuWang0623 wants to merge 2 commits into
Conversation
On the basis of init.rc, add default parsing of cpu-specific configs.
- /etc/init.d/init.rc
- /etc/init.d/init.cpu${CPUID}.rc
Refactor function `init_parse_configs()` to parse files from the default path
instead of identifying and parsing directories or files, as the functionality
is unnecessary.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
The init_parse_arguments() function checked for '--' by only comparing the first two characters, causing options like --system, --nofork to be misinterpreted as the '--' argument separator. This truncated the remaining arguments. Add an isblank() check on the third character to ensure only standalone '--' followed by whitespace triggers the separator logic. Assisted-by: GitHubCopilot:claude-4.6-opus Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
JianyuWang0623
force-pushed
the
nxinit-parser-enhancements
branch
from
August 21, 2026 04:49
f7eb424 to
b5ff501
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Please adhere to Contributing Guidelines.
Summary
This series improves the
system/nxinitinit.rc parser. It contains twoself-contained, independent commits:
parse default cpu-specific configs — On top of the configured rc file
(
CONFIG_SYSTEM_NXINIT_RC_FILE_PATH, e.g./etc/init.d/init.rc),init_parse_configs()now also loads an optional per-cpu config derivedfrom that path (
<rc-path>.cpu${CPUID}, e.g./etc/init.d/init.cpu0.rc).The configurable rc path support is preserved and the unused directory
scanning path is dropped.
fix argument parser treating --option as -- separator —
init_parse_arguments()only compared the first two characters whendetecting the
--separator, so options like--system/--noforkweremistaken for the standalone
--separator and the remaining arguments weretruncated. Add an
isblank()check on the third character so only astandalone
--followed by whitespace triggers the separator logic.Both commits are independent parser improvements and can be reviewed in any
order.
Impact
nxinitgains optional per-cpu init.rc support and correctlypasses through long options (e.g.
--system) to services/actions. Existingsingle-file init.rc setups are unaffected (the per-cpu file is optional).
system/nxinit/{parser.c,parser.h,init.c}are touched.configs that do not use per-cpu files or
---style options is unchanged.Testing
Host:
Target:
lckfb-szpi-esp32s3:adbVerification:
./tools/checkpatch.sh -fpasses cleanly on all touched files(
parser.c,parser.h,init.c) —All checks pass.the target above; init.rc is parsed and services start as expected.