fix(luckfox-config): handle duplicate alias emission from CONFIG_DTC_SYMBOLS#357
Open
gionag wants to merge 1 commit into
Open
fix(luckfox-config): handle duplicate alias emission from CONFIG_DTC_SYMBOLS#357gionag wants to merge 1 commit into
gionag wants to merge 1 commit into
Conversation
…SYMBOLS
`luckfox_get_device_name()` looks up a device node path by grepping the
`fdt_dump` output for `"<node_alias> =".` On kernels built with
`CONFIG_DTC_SYMBOLS=y` (the stock luckfox_rv1106_linux_defconfig among
others), each alias is emitted twice: once under `/aliases` and once
under `/__symbols__`. The function therefore returns two lines joined
by a newline, which luckfox_i2c_app / luckfox_spi_app / luckfox_uart_app
all splice directly into a dtbo template:
&{$i2c_device_name}{
status="okay";
...
};
With a multi-line substitution this becomes an invalid `&{ ... }` target
spanning two lines, and the subsequent `dtc -I dts -O dtb` call fails:
Error: /tmp/.overlay.dts:5.1-2 syntax error
FATAL ERROR: Unable to parse input tree
cat: can't open '/tmp/.overlay.dtbo': No such file or directory
Complete configuration loading
— note the script still prints "Complete configuration loading" with
rc=0, so the symptom visible to users is simply that `luckfox-config
load` (and the interactive menu's I2C/SPI/UART toggles) apparently
succeed but no overlay ever lands under
/sys/kernel/config/device-tree/overlays/.
Pipe the grep output through `head -1` so only the first alias match is
used. The /aliases entry is the authoritative one; /__symbols__ carries
the same string for overlay resolver purposes and is structurally
redundant here.
Reproduction:
* Any board whose kernel has CONFIG_DTC_SYMBOLS=y (stock luckfox
defconfigs enable this for OF_OVERLAY/OF_DTBO support).
* `luckfox-config load` (or the TUI) tries to enable I2C/SPI/UART.
* /tmp/.overlay.dts is malformed; no overlay registered.
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.
Summary
luckfox_get_device_name()in/usr/bin/luckfox-configlooks up a DT node path by grepping/tmp/.fdt_dump.txtfor the alias name. On kernels built withCONFIG_DTC_SYMBOLS=y(the setting shipped by the stockluckfox_rv1106_linux_defconfig, enabled to supportOF_OVERLAY/OF_DTBO), each alias string is emitted twice — once under/aliasesand once under/__symbols__.The grep therefore returns two lines. The caller splices that multi-line string straight into a dtbo template:
dtc -I dts -O dtbthen fails:The script still exits rc=0 and prints `Complete configuration loading`, so the user sees no error — but no overlay is registered and `/dev/i2c-3` / `/dev/spidev*` / `/dev/ttyS*` never appears.
Fix
Pipe the grep through `head -1`. The `/aliases` entry is the authoritative one; `/symbols` carries the same string for overlay resolver purposes and is structurally redundant here.
Repro
Test plan