Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Older U-Boots assign RockPI-S and RockS0 their Ethernet MAC based on disk image. #7517

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brentr
Copy link
Collaborator

@brentr brentr commented Nov 25, 2024

Uses the same mechanism we've been using to deal with the RockPI-S random WiFi MAC addresses to derive unique, fixed Ethernet MACs as well.

Description

Radxa appears to have omitted any hardware to store a unique MAC address on each of their RK3308 based devices. Users have trouble when putting two or more devices running copies of the same image on the same LAN. See:

(https://forum.armbian.com/topic/42663-how-to-change-ethernet-mac-address-on-image/)

@Kwiboo pointed out that U-Boot should handle this.
U-Boot v2024.10 added logic to correctly derive the Ethernet MAC from the SOC's unique CPUid, but older versions lacked this.
So, this PR was altered to disable the userspace fix to the end0 interface by default.

(https://armbian.atlassian.net/jira/software/c/projects/AR/issues/AR-2541

The end result is that this PR makes NO code changes. It merely reorganizes these udev scripts for fixing MAC addresses so they can be applied to all Radxa rk3308 based boards (RockS0 and RockPI-S)

How Has This Been Tested?

  • Built RockPI-S image, verified WiFi reassigned, Ethernet left unchanged.
  • Build Rock S0, verified no MACs reassigned, but scripts installed to do so if needed.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

So, use the same mechanism we've been using to deal with the RockPI-S
random WiFi MAC addresses to derive unique, fixed Ethernet MACs as well.
@brentr brentr added Bugfix Pull request is fixing a bug Bug Something isn't working as it should labels Nov 25, 2024
@brentr brentr self-assigned this Nov 25, 2024
@brentr brentr requested a review from a team as a code owner November 25, 2024 04:42
@github-actions github-actions bot added size/medium PR with more then 50 and less then 250 lines Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... BSP Board Support Packages labels Nov 25, 2024
@Kwiboo
Copy link
Contributor

Kwiboo commented Nov 25, 2024

Mainline U-Boot should inject a local-mac-address prop into ethernet0/ethernet1 nodes for all Rockchip aarch64 targets, so this should not be needed for Ethernet as long as the device tree contains an ethernet0-alias, or is this an Armbian only issue?

@brentr
Copy link
Collaborator Author

brentr commented Nov 25, 2024

@Kwiboo
I think you are correct, U-boot is where a hardware unique proper MAC address should assigned.

Interestingly, U-Boot has always been reading the unique RK3308 cpuid# from the board and exporting it to its environment as: (for example)

cpuid#=55524b55313830303500000000072353

But the ethaddr and eth1addr vars generated did not incorporate that cpuid# to ensure uniqueness until recently. (not in v2022.04, anyway)

u-boot v2024.10 does incorporate this fix, so the user space fix is no longer needed.
This also explains why I was able to replicate the problem first reported in the forums.

I'll alter the PR to just add support for the user space fix to the RockS0, but leave it disabled by default.

…unique CPUid

So, disable the userspace derivation of MAC from the CPUid for end0 by default
@brentr brentr changed the title Both RockPI-S and RockS0 assign their Ethernet MAC based on disk image. Older U-Boots assign RockPI-S and RockS0 their Ethernet MAC based on disk image. Nov 25, 2024
@brentr brentr marked this pull request as draft November 28, 2024 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BSP Board Support Packages Bug Something isn't working as it should Bugfix Pull request is fixing a bug Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review size/medium PR with more then 50 and less then 250 lines
Development

Successfully merging this pull request may close these issues.

2 participants