Ethaddr all the same after moving to mainline u-boot

I am running rock-pi-4-rk3399_defconfig and for some reason all my mac addresses are now the same across my 4 boards, both in linux and at the ethaddr variable in u-boot.

Is there a config option I need to enable to use the boards mac address?

Just wanted to note that this will potentially be an issue for me as well, as my router maps fixed IP to a MAC address.
I believe the dietpi image allows for changing the Mac adress in software, but I would fear complications from the router side before the OS boots and can change the address.

Not per say a problem I have yet, but I can imagine it becoming one easily :slight_smile:

What I have found searching in on rockchip it appears the ethaddr is suppoed to be based on the cpuid which I thought should be unique per device but for some reason the uboot cpuid# var are identical on all my RkP4’s even if I run ‘env default -a’ which should blow away any badly saved values.

1 Like

Fixed (in Armbian) not long ago which means you need to build from sources or update from beta repository to test if it works properly: https://github.com/armbian/build/pull/1660

You can also change MAC via user space with armbian-config or nmtui-edit.

Thanks @igorp. Unfortunately my that solution is based on cpuid# and all my boards have the same cpuid# for some reason.

That’s strange. Huh, well then use user land workaround until this is sorted out. That should work.

The reason for this is most probably missing ROCKCHIP_EFUSE driver in u-boot which leads to deriving cpuid# from uninitialised memory region and mostly the same cpuid# on multiple boards.
I observed exactly the same behaviour and hence the patch in Armbian :wink:

Try @igorp’s provided solution or make sure that you have all three below configs enabled in your defconfig that you are using to build mainline u-boot (v2019.10+). This will make your cpuid# and macaddr unique per board.

CONFIG_MISC=yes 
CONFIG_MISC_INIT_R=yes 
CONFIG_ROCKCHIP_EFUSE=yes

BTW As a fun fact cpuid#, when read correctly, contains the value engraved on the lid of your rk3399 CPU :wink:

2 Likes

Thanks @piter75 I was just about to post the same solution, beat me to it.

I am surprised this isnt part of the defconfig for Rock Pi 4 in mainline uboot…

Now on to working out HDMI output in uboot. Thanks all.

1 Like

How did you install mainline u-boot on Rock Pi 4 in the first place?

@crocket the u-boot mainline has a defconfig for rock pi 4.

I cloned the git for u-boot and then ran

make rock-pi-4-rk3399_defconfig

make menuconfig

(navigate to enable the efuses mentioned)

export BL31=

(location depends on where you compiled arm-trusted-firmware)

make all

sudo dd if=idbloader.img of=/dev/sdx seek=64 &&
sudo dd if=u-boot.itb of=/dev/sdx seek=16384

(to write the new uboot to your sdcard, ie whatever sdx is)

1 Like
  • Does mainline u-boot compile idbloader.img automatically for you?
  • Does arm trusted firmware come from rkbin?
  • What is the overall partition layout for u-boot on Rock Pi 4?

Yes

I am using https://github.com/ARM-software/arm-trusted-firmware.git

There are 5 partitions it is documented on http://opensource.rock-chips.com/ somewhere from memory. I used the gpt command in u-boot to recreate the partitions on my SD after installing u-boot. I use partition 4 as a fat 32 EFI partition and partition 5 I format as f2fs and have my main OS (Alpine) on it. I dont touch the other partitions.

I also tend to lean towards using a grub.efi and then use standard grub.cfg to boot but thats personal preference.

Take a look at doc/README.rockchip in the u-boot src tree as well.

1 Like