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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions config/boards/rock-s0.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ BOARD_NAME="Rock S0"
BOARDFAMILY=rockchip64
BOARD_MAINTAINER=brentr

BOOTCONFIG=rock-s0-rk3308_defconfig
BOOT_FDT_FILE=rockchip/rk3308-rock-s0.dtb

KERNEL_TARGET=current,edge
KERNEL_TEST_TARGET=current

BOOTCONFIG=rock-s0-rk3308_defconfig
BOOT_FDT_FILE=rockchip/rk3308-rock-s0.dtb

DEFAULT_CONSOLE=serial
SERIALCON=ttyS0
MODULES_BLACKLIST="rockchipdrm analogix_dp dw_mipi_dsi dw_hdmi gpu_sched lima hantro_vpu panfrost"
Expand All @@ -28,5 +28,13 @@ function post_family_config__rocks0() {
declare -g BOOTDIR="u-boot-${BOARD}"
declare -g BOOTSCRIPT=boot-rockchip64-ttyS0.cmd:boot.cmd

unset family_tweaks_bsp # disable from rockchip64_common
family_tweaks_bsp() { #overrides rockchip64_common.inc
#Rock S0's Ethernet MAC appears to be derived from rootfs image
#Install udev script to assign its MAC based on SOC's unique serial number
bsp=$SRC/packages/bsp/radxa3308
rules=etc/udev/rules.d

install -m 755 $bsp/lib/udev/fixEtherAddr $destination/lib/udev &&
install -m 644 $bsp/$rules/05-rocks0-MACaddress.rules $destination/$rules
}
}
10 changes: 5 additions & 5 deletions config/boards/rockpi-s.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ BOARD_NAME="Rockpi S"
BOARDFAMILY=rockchip64
BOARD_MAINTAINER=brentr

BOOTCONFIG=rock-pi-s-rk3308_defconfig
BOOT_FDT_FILE=rockchip/rk3308-rock-pi-s.dtb

KERNEL_TARGET=current,edge
KERNEL_TEST_TARGET=current

BOOTCONFIG=rock-pi-s-rk3308_defconfig
BOOT_FDT_FILE=rockchip/rk3308-rock-pi-s.dtb

DEFAULT_CONSOLE=serial
SERIALCON=ttyS0
MODULES_BLACKLIST="rockchipdrm analogix_dp dw_mipi_dsi dw_hdmi gpu_sched lima hantro_vpu panfrost"
Expand All @@ -31,11 +31,11 @@ function post_family_config__rockpis() {
family_tweaks_bsp() { #overrides rockchip64_common.inc
#Install udev script that derives fixed, unique MAC addresses for net interfaces
#that are assigned random ones -- like RockPI-S's WiFi network interfaces
bsp=$SRC/packages/bsp/rockpis
bsp=$SRC/packages/bsp/radxa3308
rules=etc/udev/rules.d

install -m 755 $bsp/lib/udev/fixEtherAddr $destination/lib/udev &&
install -m 644 $bsp/$rules/05-fixMACaddress.rules $destination/$rules
install -m 644 $bsp/$rules/05-rockpis-MACaddress.rules $destination/$rules
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#If a network interface is being assigned a different MAC on each boot, or the
#MAC address is based on the disk image, rather than being unique to hardware,
#enable the corresponding line below to derive that interface's MAC from
#the RK3308 SOC's unique serial number.
#All the two digit hex code prefixes passed to fixEtherAddr should be unique
#and chosen such that (n-2)%4 == 0

#Otherwise, the RockPI-S wifi chip MACs will be different on each boot
KERNEL=="wlan0", ACTION=="add" RUN+="fixEtherAddr %k 0a"
KERNEL=="p2p0", ACTION=="add" RUN+="fixEtherAddr %k 0e"

#v2024.10 u-boot derives built-in ethernet MAC for RockPI-S from the CPUid
#so, the fix for interface end0 should no longer be needed
#KERNEL=="end0", ACTION=="add" RUN+="fixEtherAddr %k 06"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#If a network interface is being assigned a different MAC on each boot, or the
#MAC address is based on the disk image, rather than being unique to hardware,
#enable the corresponding line below to derive that interface's MAC from
#the RK3308 SOC's unique serial number.
#All the two digit hex code prefixes passed to fixEtherAddr should be unique
#and chosen such that (n-2)%4 == 0

#In v2024.10 u-boot, RockS0's built-in ethernet MAC is derived from the CPUid
#so, the fix for interface end0 should no longer be needed
#KERNEL=="end0", ACTION=="add" RUN+="fixEtherAddr %k 06"

This file was deleted.