How to read serial number (serial#) in uboot

Hi.

I want to send serial number to dhcp server.

It is ok to read serial number from eeprom in linux: cat /proc/device-tree/serial-number

I can also do it in uboot interactive console:

fdt addr $fdt_addr
fdt get value serialnum / serial-number

Problem with this approach is that sometimes some kind of race appears and uboot hangs.

Can I know, why nvidias uboot doesn’t set standard serial# environment variable?

Hi maxlapshin,

You could use i2c tool to read serial number from eeprom first.

2c dev 3
i2c probe
i2c md 50 0 100 <- CVM
i2c md 57 0 100 <- CVB

We don’t currently parse the serial # and stick it in the DTB in U-Boot

Also, could you share us the log when this hang happens? How is the reproducing rate? I mean how often do you hit this issue?

Is this i2c address stable? Is this eeprom inside module or it is on motherboard?

If you want the serial number of module, then please read the eeprom on CVM.

Ok, thank you.

I thought it would be a good idea to read device tree from memory in uboot, but if you say that it is better to read eeprom, then I will do so.