On 23/07/2019 11:34, Leif Lindholm wrote:
On Fri, Jul 19, 2019 at 06:29:07PM +0100, Michael Brown wrote:
Older device trees tend to use the alias "ethernet".  Newer device
trees tend to use "ethernet0" since older versions of U-Boot would
skip aliases that do not include an index number.  See, for example,
Linux kernel commit 10b6c0c ("ARM: dts: bcm2835: add index to the
ethernet alias") and U-Boot commit f8e57c6 ("fdt_support: Fixup
'ethernet' aliases not ending in digits").

Accept either "ethernet" or "ethernet0" as being the alias to the node
for which the MAC address should be updated.

Why is this patch useful?
I understand the problem, but we include the .dtb from our own
edk2-non-osi tree. And it seems that device tree already provides an
alias to support both:
https://github.com/tianocore/edk2-non-osi/blob/master/Platform/RaspberryPi/RPi3/DeviceTree/bcm2710-rpi-3-b.dts

Would it be more useful to warn loudly if "ethernet" isn't present?
(And just *replace* ethernet[0] with ethernet below.)

The device tree can also be provided by the VC4 firmware, e.g. with a config.txt containing e.g.

  device_tree_address=0x10000
  device_tree_end=0x20000
  device_tree=bcm2710-rpi-3-b-plus.dtb

It is also possible to omit the explicit "device_tree=..." and have just

  device_tree_address=0x10000
  device_tree_end=0x20000

This configuration will cause the VC4 firmware to automatically load the appropriate device tree file. I have tested that this allows me to boot from a 3B or 3B+ using a single SD card image that contains all of the .dtb files from

  https://github.com/raspberrypi/firmware/tree/master/boot

These "official" raspberrypi-firmware .dtb files are built from the stock Linux kernel .dts files, and contain only "ethernet0".

To address your specific questions:

> Why is this patch useful?

It allows us to boot using the "official" .dtb files without any unexpected behaviour.

This in turn allows us to boot with the VC4 firmware automatically selecting the appropriate .dtb file for the hardware. This is extremely useful when trying to provide a single SD card image that will work on a wide range of hardware.

> Would it be more useful to warn loudly if "ethernet" isn't present?
> (And just *replace* ethernet[0] with ethernet below.)

This would also solve the problem. I would find it mildly surprising behaviour if I were debugging around it, since the "official" .dtb files have moved in the other direction (going from "ethernet" to "ethernet0"), but I would not expect it to break anything.

Another option would be to have UpdateMacAddress() ensure that both "ethernet" and "ethernet0" aliases exist.

I am happy to work up a new version of the patch: just let me know which option you prefer.

Many thanks,

Michael

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44243): https://edk2.groups.io/g/devel/message/44243
Mute This Topic: https://groups.io/mt/32529756/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to