Skip to content

Conversation

@13627105546
Copy link
Contributor

Note: Please adhere to Contributing Guidelines.

Summary

  • Why : In some embedded scenarios, the Wi-Fi 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_WIFIMAC . When enabled, netinit attempts to fetch the MAC address via boardctl(BOARDIOC_USER_MAC_WIFI, ...) (defined as BOARDIOC_USER + 3 ). This allows board-specific logic to provide the correct Wi-Fi MAC address during network initialization.

Impact

  • Users : Users can now select CONFIG_NETINIT_WIFIMAC in Kconfig if their board supports providing a Wi-Fi MAC address via boardctl .
  • Build : Introduces CONFIG_NETINIT_WIFIMAC . No impact on existing builds unless this new option is enabled.
  • Hardware : Requires board-level support for BOARDIOC_USER_MAC_WIFI 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_WIFIMAC 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.


#if defined(CONFIG_NETINIT_UIDMAC)
#if defined(CONFIG_NETINIT_WIFIMAC)
#define BOARDIOC_USER_MAC_WIFI (BOARDIOC_USER + 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's define a offical boar ioctl to expose the mac address, @13627105546

Support getting MAC from boardctl for Wi-Fi.

Signed-off-by: liqinhui <[email protected]>
@13627105546 13627105546 force-pushed the topic/netinit-wifimac branch from 7cd49c9 to 25bcf5e Compare January 13, 2026 15:10
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.

4 participants