[Bananapi-r2] Where is board's MAC address stored?

I mean uEnv.txt on boot-partition which overrides saved environment at offset 1m (direct on storage)

1 Like

I’m also trying to save the mac-address in the environment variable and trying to access it via fw_printenv

But I get the following error when I use the command.

Cannot parse config file: No such file or directory

Any ideas on how to resolve it?

I guess you need to create a config file /etc/fw_env.config

/dev/mmcblk0 0x100000 0x2000

But you’ll get read error about wrong crc if do not have called saveenv in uboot

Thanks for your answer, but this is not working for me. Please check my uboot details

U-Boot 2014.04-rc1 (May 11 2018 - 11:39:55)

g_nr_bank = 1.
g_total_rank_size = 0x80000000
DRAM:  2 GiB
WARNING: Caches not enabled
MMC:     emmc: 0,  sdcard: 1
booting from eMMC
dev_num = 0
In:    serial
Out:   serial
Err:   serial
bootargs = board=bpi-r2 earlyprintk console=tty1 fbcon=map:0 console=ttyS0,11520                                                                                                                                   0 vmalloc=496M debug=7 initcall_debug=0 root=/dev/mmcblk0p2 rootfstype=ext4 root   

This is still giving the following output when I do fw_printenv

$fw_printenv
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200

I did try saveenv on the uboot console as you suggested too.

Any idea on how to resolve it?

imho official uboot wrote to mmc only after some patches…most official images using one of the first uboot-versions without this change

with last version it works for me

root@bpi-r2:~# cat /etc/fw_env.config                                           
/dev/mmcblk0 0x100000 0x2000                                                    
root@bpi-r2:~#

root@bpi-r2:~# fw_printenv                                                      
askaddr=askenv addrinput "enter address:";                                      
askdtb=askenv dtbinput "enter dtb-name:";                                       
askkernel=askenv kernelinput "enter uImage-name:";                              
askuboot=askenv ubootinput "enter uboot-name:";                                 
board=bpi-r2                                                                    
boot0=run lskernel;run askkernel;if printenv kernelinput ;then setenv kernel ${k
ernelinput};run lsdtb;run askdtb;if printenv dtbinput ;then setenv fdt ${dtbinpu
t};fi; run newboot2; fi;                                 
...

works for me with settings above and uboot 2020-04-rc2-bpi-pwm

U-Boot 2020.04-rc2-bpi-pwm (Feb 24 2020 - 18:04:12 +0100)                       
                                                                                
CPU:   MediaTek MT7623 E3                                                       
DRAM:  2 GiB                                                                    
WDT:   Started with servicing (60s timeout)                                     
MMC:   mmc@11230000: 0, mmc@11240000: 1                                         
Loading Environment from MMC... Boot From SD(id:1)                              
                                                                                
OK                                                                              
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
Net:                                                                            
Warning: ethernet@1b100000 (eth0) using random MAC address - 3a:de:ca:07:e0:cb  
eth0: ethernet@1b100000

btw. it’s not enough to set mac in uboot alone…you need to load devicetree (with alias and 0-mac) separately first and then change mac and bootup kernel with this modified dtb. it’s a complex setup…imho it’s easier to change mac in dts directly and build kernel by yourself and boot it the normal way without any uboot-hacks