Skip to content

Conversation

@13627105546
Copy link
Contributor

@13627105546 13627105546 commented Jan 13, 2026

Note: Please adhere to Contributing Guidelines.

Summary

  • Why: In some embedded scenarios, the MAC address is stored in a specific location (e.g., a file like device.info, OTP, or NVM) rather than being generated from a unique ID or fixed at compile time. A mechanism is needed to allow netinit to retrieve this MAC address from the board logic.
  • What: This commit adds a new configuration option CONFIG_NETINIT_MACADDR. When enabled, netinit attempts to fetch the MAC address via boardctl(BOARDIOC_MACADDR, ...). This allows board-specific logic to provide the correct MAC address during network initialization.

Impact

  • Users: Users can now select CONFIG_NETINIT_MACADDR in Kconfig if their board supports providing a MAC address via boardctl.
  • Build: Introduces CONFIG_NETINIT_MACADDR. No impact on existing builds unless this new option is enabled.
  • Hardware: Requires board-level support for BOARDIOC_MACADDR command in board_ioctl if this feature is enabled.
  • Compatibility: Backward compatible. Existing MAC address initialization methods (UIDMAC, ETHERNET, etc.) remain unchanged.

Testing

  • Verification:
  • Verified that the code compiles successfully with CONFIG_NETINIT_MACADDR enabled.
  • Verified that checkpatch.sh passes for the modified files.
  • Target: Verified on local hardware platform where boardctl is implemented to read MAC address from device storage.

@simbit18
Copy link
Contributor

@13627105546 Please fix

../nuttx/tools/checkpatch.sh -c -u -m -g b0b90ac72886a7d2ee8d9a16e057a4b2c801984e..HEAD
❌ Missing git commit message
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
Error: Process completed with exit code 1.

@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from 7cd49c9 to 25bcf5e Compare January 13, 2026 15:10
jerpelea
jerpelea previously approved these changes Jan 20, 2026
@jerpelea jerpelea changed the title netinit: Support the NETINIT_WIFIMAC. netutils/netinit: Support the NETINIT_WIFIMAC. Jan 20, 2026
@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from c710681 to e4972d1 Compare January 20, 2026 09:39
jerpelea
jerpelea previously approved these changes Jan 20, 2026
@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch 2 times, most recently from 6020df4 to 0029809 Compare January 20, 2026 10:16
Copy link
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@13627105546 this is a new Feature, please add a Documentation to it

@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from 0029809 to 853eaac Compare January 21, 2026 02:11
@13627105546
Copy link
Contributor Author

@13627105546 this is a new Feature, please add a Documentation to it

I have supplemented the documentation (apache/nuttx#18031) with Documentation/reference/user/13_boardctl.rst

@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch 2 times, most recently from 91d08d8 to 0b39906 Compare January 21, 2026 03:55
@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from 0b39906 to 0e36954 Compare January 21, 2026 08:53
@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from 0e36954 to 51a755b Compare January 21, 2026 12:07
@13627105546 13627105546 changed the title netutils/netinit: Support the NETINIT_WIFIMAC. netutils/netinit: Support the NETINIT_MACADDR. Jan 21, 2026
Support getting MAC from boardctl(BOARDIOC_MACADDR) via NETINIT_MACADDR.

Signed-off-by: daichuan <daichuan@xiaomi.com>
@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from 51a755b to 963cccc Compare January 21, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants