Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Overriding MAC address via device_properties?



On Sat, Dec 31, 2022 at 09:06:23AM +0900, Chris wrote:
> Hello,
> 
> I have a few rock64s running NetBSD-9.  I'm trying to migrate them from microSD
> cards to eMMC, and apparently the rock64 u-boot isn't able to write its
> environment to eMMC.
> 
> That's unfortunate, because the rock64 doesn't have a unique per-board MAC
> address.  If the MAC address isn't explicitly set in the u-boot environment,
> all boards will use 9e:6b:01:38:f7:da.
> 
> Attempting to override the MAC address via ifconfig's 'link <address> active'
> kills the awge interface completely.
> 
> I'm planning on untangling that issue, as well as the u-boot issue, but in the
> meantime I need to get these boards running with unique MAC addresses.
> 
> I see this bit in sys/dev/ic/dwc_gmac.c:
> 
>         prop_data_t ea = dict ? prop_dictionary_get(dict, "mac-address") : NULL;
>         if (ea != NULL) {
>                 /*
>                  * If the MAC address is overriden by a device property,
>                  * use that.
>                  */
>                 KASSERT(prop_object_type(ea) == PROP_TYPE_DATA);
>                 KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN);
>                 memcpy(enaddr, prop_data_data_nocopy(ea), ETHER_ADDR_LEN);
>         }
> 
> ... which leads me to believe that there's a way to specify the MAC address via
> a property dictionary.
> 
> However, I haven't been able to find any documentation on where that is
> actually configured.  Adding various permutations of mac-address to
> /boot/{cmdline,config}.txt hasn't worked.

The device properties are kernel internals. They are usually derived from
configuration informations such as device tree or ACPI.
AFAIK there's no way for a user to explicitely set a device property.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index