Jump to content
  • 0

reading the zybo MAC in the fsbl


nickwh

Question

I've been working on a project for the Zybo with petalinux tools 2016.4 and I want to use the MAC address in the eprom on the board so that I can easily have multiple boards using the same image.

I found several hopeful posts from which I believed that I understand that I need to edit the hook.c source file used to build the fsbl.

I thought that I found the correct file "<projectname>/components/plnx_workspace/fsbl/src/fsbl_hooks.c" and I modified it to include the necessary lines of code but the command petalinux-built -c fsbl did not create a different image so there was no change - I also built the whole project and nothing changed.

Am I modifying the wrong source file? or perhaps the wrong changes - old and new files are attached.

I am a novice in this arena so sorry if I'm making a very obvious mistake or group of mistakes.

Thanks

 

 

fsbl_hooks.c

fsbl_hooks.c.old

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Hi @nickwh,

I remember I changed my zybo MAC address with the device-tree. In your system.dts (or system-top.dts) you should find "&ǵem0" with local-mac-address = [your address];

If this field is empty I assume you'll get a random MAC address.

Let me know if it works for you !

regards,

Yohan

Link to comment
Share on other sites

Yohan,

Thanks - there are probably several ways to change the MAC in a manualish/code manner: one nice way to do it it is set it in the

project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h

this file is normally almost empty with just a single include put if you locate the target of the include and copy the whole define CONFIG_EXTRA_ENV_S - note the whole define block of code is needed.  Then you can edit the ethaddr= line to whatever you want - it is then set before u-boot brings up the interface so it works for bootp etc.

#include <configs/platform-auto.h>
 

/* Extra U-Boot Env settings */
#define CONFIG_EXTRA_ENV_SETTINGS \

"ethaddr=00:0a:35:00:1e:53\0" \

 

Unfortunately that is not what I want to do - every Zybo has a unique MAC address stored in a serial EPROM and it can be read somewhere in the FSBL - I have a working example from a Petalinux tools 2015.1 Zybo BSP in the prebuilt images but as far as I can tell the source code for the function that achieves this is not included so I can't see how it was done.

Forum member debugasm posted a solution in November 2016 - but I don't understand how to implement it?  The fsbl_hooks.c file was my attempt but this change did nothing so I missed a detail somewhere?

Link to comment
Share on other sites

@nickwh

Yes, your method set MAC address in u-boot.

My method set it directly in linux kernel.

But if you want to read it before boot in EEPROM it is different.

I don't know if you're using uboot-xlnx or directly u-boot, but in u-boot it seems CONFIG_ZYNQ_EEPROM is not set by default.

See http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/zynq-common.h;h=4b6b08885134125187fb38a82a4e4a983c6483e5;hb=HEAD

and : http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/zynq_zybo.h;h=808967cee331dd78380dc61e60f72c6643ea9e36;hb=HEAD

I never done this before, so what I say are only hypotheses. But I think CONFIG_ZYNQ_EEPROM will allow you to read EEPROM through I2C. Maybe try to define it and recompile ?

regards

Yohan

Link to comment
Share on other sites

Yohan,

Thanks again - this definitely looks to be on the right track but I can't find a file named zynq-common.h in my project or zynq_zybo.h so I'm still stuck at the same place in my learning curve.

I am booting into petalinux and I can set the MAC in the device tree blob or with an ifconfig command after boot but it would have been nice to not need to make a new image for each board - especially when the hardware exists to do it for me.

Regards Nick

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...