defconfig: espressobin: enable NET_RANDOM_ETHADDR
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
--- configs/mvebu_espressobin-88f3720_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/mvebu_espressobin-88f3720_defconfig +1 -0
@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_RTL8152=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_SHA1=y CONFIG_SHA256=y +CONFIG_NET_RANDOM_ETHADDR=y
Signature · 1 line
2.28.0
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 2 lines · On Tuesday 08 September 2020 08:35:00 Andre Heider wrote:
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
Well, this is not fully truth as MAC address is stored in SPI, just in non-standard format, in U-Boot env stored in env partition and it is hard to use outside of U-Boot, plus easy to erase / overwrite / lost.
I'm not a big fan of this change. This looks like a workaround / hack for boards where MAC address was erased (e.g. by broken U-Boot distro scripts) or for early boards where MAC address was not written at all (as I was told).
And on these boards this patch would cause that U-Boot would see on every boot different MAC address. This would cause another mess in network for U-Boot netboot as DHCP/TFTP server would see for one board every time different MAC address.
Is not really better to instruct user how to fix board where e.g. broken distro scripts erased MAC address? We have already paragraph in README.marvell about it.
Also this change affects "default" defconfig value. And based on above arguments I do not think that this change should be enabled by default.
I understand that for some situations it may be useful (e.g. mass board reparation process via netboot), but as this is config option, users in such situation can enable this option manually.
I think that for default behavior is not provide network access in U-Boot if for some reasons factory permanent MAC address was removed. User can easier and faster detect this issue and fix it.
Quoted 17 lines
Signed-off-by Andre Heider <[email protected]>--- configs/mvebu_espressobin-88f3720_defconfig | 1 + 1 file changed, 1 insertion(+)configs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_RTL8152=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_SHA1=y CONFIG_SHA256=y +CONFIG_NET_RANDOM_ETHADDR=ySignature · 1 line
2.28.0
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 7 lines · Pali Roh?r
Quoted 2 lines · On Tuesday 08 September 2020 08:35:00 Andre Heider wrote:
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
Well, this is not fully truth as MAC address is stored in SPI, just in non-standard format, in U-Boot env stored in env partition and it is hard to use outside of U-Boot, plus easy to erase / overwrite / lost.
True, but updating the bootloader usually implies wiping the env, so it's very easy to lose it.
Quoted 17 lines
I'm not a big fan of this change. This looks like a workaround / hack for boards where MAC address was erased (e.g. by broken U-Boot distro scripts) or for early boards where MAC address was not written at all (as I was told).
And on these boards this patch would cause that U-Boot would see on every boot different MAC address. This would cause another mess in network for U-Boot netboot as DHCP/TFTP server would see for one board every time different MAC address.
Is not really better to instruct user how to fix board where e.g. broken distro scripts erased MAC address? We have already paragraph in README.marvell about it.
Also this change affects "default" defconfig value. And based on above arguments I do not think that this change should be enabled by default.
Quoted 7 lines
I understand that for some situations it may be useful (e.g. mass board reparation process via netboot), but as this is config option, users in such situation can enable this option manually.
I think that for default behavior is not provide network access in U-Boot if for some reasons factory permanent MAC address was removed. User can easier and faster detect this issue and fix it.
It can be argued both ways I guess. If this option wouldn't make sense it wouldn't exist.
Out of the box working network access is probably what most users care about.
Changing this default means that you need to build the whole firmware yourself, and let's face it: building it for this board is a total clusterfuck. Most users will just download a binary. I don't care too much for this patch, but I would consider what fits most users.
Right now most users will probably run the downstream binaries provided by armbian, and as you know, that even has single hardcoded MAC, used for all boards. So this would already be an improvement ;)
Thanks,
Andre
Quoted 18 lines
Quoted 18 lines
Signed-off-by Andre Heider <[email protected]>--- configs/mvebu_espressobin-88f3720_defconfig | 1 + 1 file changed, 1 insertion(+)configs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_RTL8152=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_SHA1=y CONFIG_SHA256=y +CONFIG_NET_RANDOM_ETHADDR=ySignature · 1 line
2.28.0
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 11 lines · Andre Heider
Quoted 7 lines · Pali Roh?r
Quoted 2 lines · On Tuesday 08 September 2020 08:35:00 Andre Heider wrote:
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
Well, this is not fully truth as MAC address is stored in SPI, just in non-standard format, in U-Boot env stored in env partition and it is hard to use outside of U-Boot, plus easy to erase / overwrite / lost.
True, but updating the bootloader usually implies wiping the env, so it's very easy to lose it.
It most certainly should NOT wipe out the existing environment, it should be using the same environment location as before.
Quoted 31 lines
Quoted 17 lines
I'm not a big fan of this change. This looks like a workaround / hack for boards where MAC address was erased (e.g. by broken U-Boot distro scripts) or for early boards where MAC address was not written at all (as I was told).
And on these boards this patch would cause that U-Boot would see on every boot different MAC address. This would cause another mess in network for U-Boot netboot as DHCP/TFTP server would see for one board every time different MAC address.
Is not really better to instruct user how to fix board where e.g. broken distro scripts erased MAC address? We have already paragraph in README.marvell about it.
Also this change affects "default" defconfig value. And based on above arguments I do not think that this change should be enabled by default.
Quoted 7 lines
I understand that for some situations it may be useful (e.g. mass board reparation process via netboot), but as this is config option, users in such situation can enable this option manually.
I think that for default behavior is not provide network access in U-Boot if for some reasons factory permanent MAC address was removed. User can easier and faster detect this issue and fix it.
It can be argued both ways I guess. If this option wouldn't make sense it wouldn't exist.
Out of the box working network access is probably what most users care about.
Quoted 8 lines
Changing this default means that you need to build the whole firmware yourself, and let's face it: building it for this board is a total clusterfuck. Most users will just download a binary. I don't care too much for this patch, but I would consider what fits most users.
Right now most users will probably run the downstream binaries provided by armbian, and as you know, that even has single hardcoded MAC, used for all boards. So this would already be an improvement ;)
Note that when CONFIG_NET_RANDOM_ETHADDR is set, we only use a random MAC address when we haven't found one either on the hardware or environment. It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200908/27ed1860/attachment.sig>
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 10 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Quoted 9 lines · Andre Heider
Quoted 7 lines · Pali Roh?r
Quoted 2 lines · On Tuesday 08 September 2020 08:35:00 Andre Heider wrote:
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
Well, this is not fully truth as MAC address is stored in SPI, just in non-standard format, in U-Boot env stored in env partition and it is hard to use outside of U-Boot, plus easy to erase / overwrite / lost.
Quoted 5 lines
Quoted 2 lines
True, but updating the bootloader usually implies wiping the env, so it's very easy to lose it.
It most certainly should NOT wipe out the existing environment, it should be using the same environment location as before.
The main issue is that downstream distributions are doing it. Plus they probably have custom U-Boot patches. Nothing which mainline U-Boot can forbid or change.
Also if somebody is updating from old Marvell factory U-Boot to mainline U-Boot, SPI env offset may be different and therefore it wipes env.
And also, if U-Boot is upgrading from ancient version to new, it is suggested to reset env to have e.g. new distroboot support.
So any of above situation can lead to erasing env and therefore it is a very good idea to create backup of MAC address(es).
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
I'm not a big fan of this change. This looks like a workaround / hack for boards where MAC address was erased (e.g. by broken U-Boot distro scripts) or for early boards where MAC address was not written at all (as I was told).
And on these boards this patch would cause that U-Boot would see on every boot different MAC address. This would cause another mess in network for U-Boot netboot as DHCP/TFTP server would see for one board every time different MAC address.
Is not really better to instruct user how to fix board where e.g. broken distro scripts erased MAC address? We have already paragraph in README.marvell about it.
Also this change affects "default" defconfig value. And based on above arguments I do not think that this change should be enabled by default.
I understand that for some situations it may be useful (e.g. mass board reparation process via netboot), but as this is config option, users in such situation can enable this option manually.
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
I think that for default behavior is not provide network access in U-Boot if for some reasons factory permanent MAC address was removed. User can easier and faster detect this issue and fix it.
It can be argued both ways I guess. If this option wouldn't make sense it wouldn't exist.
As I wrote, I understand that this option is useful in some situations.
Quoted 2 lines
Quoted 2 lines
Out of the box working network access is probably what most users care about.
Of course! But what does "working network access" means? Somebody wants to have DHCP, even semi/half-working and does not care about RFC compliance. Somebody does not want to have mess in the network and so every device must use only assigned MAC / IP (v4/v6) address and not any different. And somebody just to want working TFTP, does not care about DHCP, IP or MAC address.
And for some of these situation is CONFIG_NET_RANDOM_ETHADDR great, for some harmless and for other is harmful (in context that all these devices got assigned MAC address in factory).
Also I know that in some networks is forbidden to use other than factory MAC address (users are not allowed to connect device with changed MAC address).
Quoted 8 lines
Quoted 8 lines
Changing this default means that you need to build the whole firmware yourself, and let's face it: building it for this board is a total clusterfuck. Most users will just download a binary. I don't care too much for this patch, but I would consider what fits most users.
Right now most users will probably run the downstream binaries provided by armbian, and as you know, that even has single hardcoded MAC, used for all boards. So this would already be an improvement ;)
I think that we do not have to care about people who use downstream patched U-Boot. In most case default U-Boot defconfig may be changed or be different.
Change is in this patch is only about default mainline U-Boot configuration. I think it should be sane default and for me sane default is the least surprise. So if configuration is missing either throw error so can immediately fix it or make it predicable / deterministic.
Quoted 3 lines
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.
I know.
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 111 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 11 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Quoted 10 lines · Andre Heider
Quoted 8 lines · Pali Roh?r
Quoted 2 lines · On Tuesday 08 September 2020 08:35:00 Andre Heider wrote:
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
Well, this is not fully truth as MAC address is stored in SPI, just in non-standard format, in U-Boot env stored in env partition and it is hard to use outside of U-Boot, plus easy to erase / overwrite / lost.
Quoted 5 lines
Quoted 2 lines
True, but updating the bootloader usually implies wiping the env, so it's very easy to lose it.
It most certainly should NOT wipe out the existing environment, it should be using the same environment location as before.
The main issue is that downstream distributions are doing it. Plus they probably have custom U-Boot patches. Nothing which mainline U-Boot can forbid or change.
Also if somebody is updating from old Marvell factory U-Boot to mainline U-Boot, SPI env offset may be different and therefore it wipes env.
And also, if U-Boot is upgrading from ancient version to new, it is suggested to reset env to have e.g. new distroboot support.
So any of above situation can lead to erasing env and therefore it is a very good idea to create backup of MAC address(es).
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
I'm not a big fan of this change. This looks like a workaround / hack for boards where MAC address was erased (e.g. by broken U-Boot distro scripts) or for early boards where MAC address was not written at all (as I was told).
And on these boards this patch would cause that U-Boot would see on every boot different MAC address. This would cause another mess in network for U-Boot netboot as DHCP/TFTP server would see for one board every time different MAC address.
Is not really better to instruct user how to fix board where e.g. broken distro scripts erased MAC address? We have already paragraph in README.marvell about it.
Also this change affects "default" defconfig value. And based on above arguments I do not think that this change should be enabled by default.
I understand that for some situations it may be useful (e.g. mass board reparation process via netboot), but as this is config option, users in such situation can enable this option manually.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
I think that for default behavior is not provide network access in U-Boot if for some reasons factory permanent MAC address was removed. User can easier and faster detect this issue and fix it.
It can be argued both ways I guess. If this option wouldn't make sense it wouldn't exist.
As I wrote, I understand that this option is useful in some situations.
Quoted 2 lines
Quoted 2 lines
Out of the box working network access is probably what most users care about.
Of course! But what does "working network access" means? Somebody wants to have DHCP, even semi/half-working and does not care about RFC compliance. Somebody does not want to have mess in the network and so every device must use only assigned MAC / IP (v4/v6) address and not any different. And somebody just to want working TFTP, does not care about DHCP, IP or MAC address.
And for some of these situation is
CONFIG_NET_RANDOM_ETHADDRgreat, for some harmless and for other is harmful (in context that all these devices got assigned MAC address in factory).Also I know that in some networks is forbidden to use other than factory MAC address (users are not allowed to connect device with changed MAC address).
Quoted 10 lines
Quoted 10 lines
Changing this default means that you need to build the whole firmware yourself, and let's face it: building it for this board is a total clusterfuck. Most users will just download a binary. I don't care too much for this patch, but I would consider what fits most users.
Right now most users will probably run the downstream binaries provided by armbian, and as you know, that even has single hardcoded MAC, used for all boards. So this would already be an improvement ;)
I think that we do not have to care about people who use downstream patched U-Boot. In most case default U-Boot defconfig may be changed or be different.
Change is in this patch is only about default mainline U-Boot configuration. I think it should be sane default and for me sane default is the least surprise. So if configuration is missing either throw error so can immediately fix it or make it predicable / deterministic.
Quoted 3 lines
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your device
to OTP with command xyz"
What do you think?
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Hi Marek,
Quoted 23 lines · Marek Beh?n
Quoted 7 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 3 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Quoted 6 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your device
to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for CONFIG_NET_RANDOM_ETHADDR then. But globalscale does not do that.
Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
For me CONFIG_NET_RANDOM_ETHADDR is a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offset around in a firmware update).
So I think CONFIG_NET_RANDOM_ETHADDR is enough.
But it would be nice if e.g. a board could set specific env vars as indestructible/unwipeable/precious/whatever, which instructs env default -a to keep those (which is common after updating the bootloader). Maybe that's an idea worth pursuing?
Thanks,
Andre
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 42 lines · On Fri, 11 Sep 2020 17:52:26 +0200 Andre Heider <[email protected]> wrote:
Hi Marek,
Quoted 24 lines · Marek Beh?n
Quoted 7 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 3 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Quoted 6 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your
device to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for
CONFIG_NET_RANDOM_ETHADDRthen. But globalscale does not do that.Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
Quoted 7 lines
For me
CONFIG_NET_RANDOM_ETHADDRis a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offset around in a firmware update).So I think
CONFIG_NET_RANDOM_ETHADDRis enough.
I understand Pali's concerns, though.
The thing is that if we enable CONFIG_NET_RANDOM_ETHADDR by default, many users that have managed to wipe their env won't care about that they are using randomly generated MAC address and won't solve the issue, which is again the spirit of correctly configure networks.
If we do not enable CONFIG_NET_RANDOM_ETHADDR, the worst that can happen is that the device won't boot from network. This will force the users to solve the issue, which is not that hard
setenv ethaddr aa:bb:cc:dd:ee:ff (address from the sticker) saveenv
If the users boots from SD/eMMC/SATA/USB, Linux won't have problem with network, since it will generate random MAC address anyway.
The worst case scenario does not look that bad to me if we don't enable CONFIG_NET_RANDOM_ETHADDR by default.
I think the option CONFIG_NET_RANDOM_ETHADDR should be used only by developers when they are developing on devices that have not yet burned the MAC addresses, or on some embedded devices that don't have space for saving a MAC address (no storage for env or anything else, do such devices exist?).
But it shouldn't be used as a default setting for a device that has storage where it can store the address.
Quoted 5 lines
But it would be nice if e.g. a board could set specific env vars as indestructible/unwipeable/precious/whatever, which instructs
env default -ato keep those (which is common after updating the bootloader). Maybe that's an idea worth pursuing?
Yes, that would be nice :)
Quoted 2 lines
Thanks,
Andre
Marek
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 60 lines · Marek Beh?n
Quoted 42 lines · On Fri, 11 Sep 2020 17:52:26 +0200 Andre Heider <[email protected]> wrote:
Hi Marek,
Quoted 24 lines · Marek Beh?n
Quoted 7 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 3 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Quoted 6 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your
device to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for
CONFIG_NET_RANDOM_ETHADDRthen. But globalscale does not do that.Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
Quoted 7 lines
For me
CONFIG_NET_RANDOM_ETHADDRis a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offset around in a firmware update).So I think
CONFIG_NET_RANDOM_ETHADDRis enough.I understand Pali's concerns, though.
The thing is that if we enable
CONFIG_NET_RANDOM_ETHADDRby default, many users that have managed to wipe their env won't care about that they are using randomly generated MAC address and won't solve the issue, which is again the spirit of correctly configure networks.
Quoted 7 lines
If we do not enable
CONFIG_NET_RANDOM_ETHADDR, the worst that can happen is that the device won't boot from network. This will force the users to solve the issue, which is not that hard
setenv ethaddr aa:bb:cc:dd:ee:ff (address from the sticker) saveenv
If the users boots from SD/eMMC/SATA/USB, Linux won't have problem with network, since it will generate random MAC address anyway.
Good point, so let's assume the user doesn't have a mac stored.
Without CONFIG_NET_RANDOM_ETHADDR:
* u-boot refuses to do anything network related
* Linux generates a random mac, network works
With CONFIG_NET_RANDOM_ETHADDR:
* u-boot generates a random mac, network works
* Linux uses the same random mac, passed on from u-boot throught the device-tree, network works
It's still random, but at least it's consistent ;)
Quoted 8 lines
The worst case scenario does not look that bad to me if we don't enable
CONFIG_NET_RANDOM_ETHADDRby default.I think the option
CONFIG_NET_RANDOM_ETHADDRshould be used only by developers when they are developing on devices that have not yet burned the MAC addresses, or on some embedded devices that don't have space for saving a MAC address (no storage for env or anything else, do such devices exist?).
It looks like it's used for more than that though:
$ git ls-files configs|wc -l 1362
$ git grep CONFIG_NET_RANDOM_ETHADDR configs|wc -l 209
Some popular sbc's are part of that list.
Quoted 16 lines
But it shouldn't be used as a default setting for a device that has storage where it can store the address.
Quoted 5 lines
But it would be nice if e.g. a board could set specific env vars as indestructible/unwipeable/precious/whatever, which instructs
env default -ato keep those (which is common after updating the bootloader). Maybe that's an idea worth pursuing?Yes, that would be nice :)
Quoted 2 lines
Thanks,
AndreMarek
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 74 lines · Andre Heider
Quoted 59 lines · Marek Beh?n
Quoted 41 lines · On Fri, 11 Sep 2020 17:52:26 +0200 Andre Heider <[email protected]> wrote:
Hi Marek,
Quoted 23 lines · Marek Beh?n
Quoted 6 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 3 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Quoted 6 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your
device to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for
CONFIG_NET_RANDOM_ETHADDRthen. But globalscale does not do that.Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
Quoted 7 lines
For me
CONFIG_NET_RANDOM_ETHADDRis a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offset around in a firmware update).So I think
CONFIG_NET_RANDOM_ETHADDRis enough.I understand Pali's concerns, though.
The thing is that if we enable
CONFIG_NET_RANDOM_ETHADDRby default, many users that have managed to wipe their env won't care about that they are using randomly generated MAC address and won't solve the issue, which is again the spirit of correctly configure networks.Quoted 7 lines
If we do not enable
CONFIG_NET_RANDOM_ETHADDR, the worst that can happen is that the device won't boot from network. This will force the users to solve the issue, which is not that hard
setenv ethaddr aa:bb:cc:dd:ee:ff (address from the sticker) saveenv
If the users boots from SD/eMMC/SATA/USB, Linux won't have problem with network, since it will generate random MAC address anyway.Good point, so let's assume the user doesn't have a mac stored.
Without
CONFIG_NET_RANDOM_ETHADDR:
* u-boot refuses to do anything network related
* Linux generates a random mac, network works
Quoted 6 lines
With
CONFIG_NET_RANDOM_ETHADDR:
* u-boot generates a random mac, network works
* Linux uses the same random mac, passed on from u-boot throught the device-tree, network worksIt's still random, but at least it's consistent ;)
It's also only used when we cannot find the MAC. At the end of the day, the final decision here is Konstantin's (as the listed maintainer). I personally think enabling the option is good given the apparent number of ways the real MAC will have been lost from SW, but if the maintainer wants to instead opt for a verbose failure message, that's fine too.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200911/86b86915/attachment.sig>
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
I agree with Tom here, I have a few different systems that use this feature, it is useful. I think most if not all of the systems I have using it have Marvell SoC's
Dennis
Quoted 91 lines · Tom Rini
Quoted 74 lines · Andre Heider
Quoted 59 lines · Marek Beh?n
Quoted 41 lines · On Fri, 11 Sep 2020 17:52:26 +0200 Andre Heider <[email protected]> wrote:
Hi Marek,
Quoted 23 lines · Marek Beh?n
Quoted 6 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 3 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Quoted 6 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your
device to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for
CONFIG_NET_RANDOM_ETHADDRthen. But globalscale does not do that.Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
Quoted 7 lines
For me
CONFIG_NET_RANDOM_ETHADDRis a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offset around in a firmware update).So I think
CONFIG_NET_RANDOM_ETHADDRis enough.I understand Pali's concerns, though.
The thing is that if we enable
CONFIG_NET_RANDOM_ETHADDRby default, many users that have managed to wipe their env won't care about that they are using randomly generated MAC address and won't solve the issue, which is again the spirit of correctly configure networks.Quoted 7 lines
If we do not enable
CONFIG_NET_RANDOM_ETHADDR, the worst that can happen is that the device won't boot from network. This will force the users to solve the issue, which is not that hard
setenv ethaddr aa:bb:cc:dd:ee:ff (address from the sticker) saveenv
If the users boots from SD/eMMC/SATA/USB, Linux won't have problem with network, since it will generate random MAC address anyway.Good point, so let's assume the user doesn't have a mac stored.
Without
CONFIG_NET_RANDOM_ETHADDR:
* u-boot refuses to do anything network related
* Linux generates a random mac, network worksQuoted 6 lines
With
CONFIG_NET_RANDOM_ETHADDR:
* u-boot generates a random mac, network works
* Linux uses the same random mac, passed on from u-boot throught the device-tree, network worksIt's still random, but at least it's consistent ;)
It's also only used when we cannot find the MAC. At the end of the day, the final decision here is Konstantin's (as the listed maintainer). I personally think enabling the option is good given the apparent number of ways the real MAC will have been lost from SW, but if the maintainer wants to instead opt for a verbose failure message, that's fine too.
--
Tom
Hello,
Quoted 108 lines
-----Original Message-----
From: Dennis Gilmore <[email protected]>
Sent: Friday, September 11, 2020 20:16
To: Tom Rini <[email protected]>
Cc: Andre Heider <[email protected]>; Marek Beh?n <[email protected]>; Pali Roh?r <[email protected]>; Stefan Roese <[email protected]>; Kostya Porotchkin <[email protected]>; U-Boot Mailing List <[email protected]>
Subject: [EXT] Re: [PATCH] defconfig: espressobin: enableNET_RANDOM_ETHADDRExternal Email
----------------------------------------------------------------------
I agree with Tom here, I have a few different systems that use this feature, it is useful. I think most if not all of the systems I have using it have Marvell SoC'sDennis
Quoted 6 lines · Tom Rini
Quoted 4 lines · Andre Heider
Quoted 3 lines · Marek Beh?n
On Fri, 11 Sep 2020 17:52:26 +0200 Andre Heider
<[email protected]> wrote:Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Hi Marek,
Quoted 4 lines · Marek Beh?n
Quoted 2 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 1 line · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, weonly
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 2 lines
use a random MAC address when we haven't found one either on the hardware or environment.
I know.
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC
address.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of
your device to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for
CONFIG_NET_RANDOM_ETHADDRthen. But globalscale does not dothat.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
For me
CONFIG_NET_RANDOM_ETHADDRis a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offsetaround in a firmware update).
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
So I think
CONFIG_NET_RANDOM_ETHADDRis enough.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
I understand Pali's concerns, though.
The thing is that if we enable
CONFIG_NET_RANDOM_ETHADDRby default, many users that have managed to wipe their env won't care about that they are using randomly generated MAC address and won't solve the issue, which is again the spirit of correctly configure networks.If we do not enable
CONFIG_NET_RANDOM_ETHADDR, the worst thatcan
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
happen is that the device won't boot from network. This will force the users to solve the issue, which is not that hard
setenv ethaddr aa:bb:cc:dd:ee:ff (address from the sticker) saveenv
If the users boots from SD/eMMC/SATA/USB, Linux won't haveproblem
Quoted 13 lines
Quoted 13 lines
Quoted 1 line
with network, since it will generate random MAC address anyway.
Good point, so let's assume the user doesn't have a mac stored.
Without
CONFIG_NET_RANDOM_ETHADDR:
* u-boot refuses to do anything network related
* Linux generates a random mac, network worksWith
CONFIG_NET_RANDOM_ETHADDR:
* u-boot generates a random mac, network works
* Linux uses the same random mac, passed on from u-boot throught the device-tree, network works
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
It's still random, but at least it's consistent ;)
It's also only used when we cannot find the MAC. At the end of the day, the final decision here is Konstantin's (as the listed maintainer). I personally think enabling the option is good given the apparent number of ways the real MAC will have been lost from SW, but if the maintainer wants to instead opt for a verbose failure message, that's
fine too.
I have no objections about this configuration option.
It is better to have a random MAC address rather then no MAC at all.
Regards
Kosta
Quoted 3 lines
Quoted 3 lines
--
Tom
Hi Kosta,
On 13.09.20 11:21, Kostya Porotchkin wrote:
<snip>
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Good point, so let's assume the user doesn't have a mac stored.
Without
CONFIG_NET_RANDOM_ETHADDR:
* u-boot refuses to do anything network related
* Linux generates a random mac, network worksWith
CONFIG_NET_RANDOM_ETHADDR:
* u-boot generates a random mac, network works
* Linux uses the same random mac, passed on from u-boot throught the device-tree, network worksIt's still random, but at least it's consistent ;)
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
It's also only used when we cannot find the MAC. At the end of the day, the final decision here is Konstantin's (as the listed maintainer). I personally think enabling the option is good given the apparent number of ways the real MAC will have been lost from SW, but if the maintainer wants to instead opt for a verbose failure message, that's
fine too.
I have no objections about this configuration option.
It is better to have a random MAC address rather then no MAC at all.
This is also my feeling.
Kosta, can you please send a Reviewed-by or Acked-by tag then?
Thanks,
Stefan
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
In reply to Marek BehúnQuoted 53 lines · On Friday 11 September 2020 18:22:04 Marek Beh?n wrote:
Quoted 42 lines · On Fri, 11 Sep 2020 17:52:26 +0200 Andre Heider <[email protected]> wrote:
Hi Marek,
Quoted 24 lines · Marek Beh?n
Quoted 7 lines · On Wed, 9 Sep 2020 00:38:31 +0200 Pali Roh?r <[email protected]> wrote:
Quoted 3 lines · On Tuesday 08 September 2020 08:52:56 Tom Rini wrote:
Note that when
CONFIG_NET_RANDOM_ETHADDRis set, we only use a random MAC address when we haven't found one either on the hardware or environment.I know.
Quoted 8 lines
Quoted 3 lines
It also prints a warning that you are using a random MAC, so if it's documented on how to recover the real MAC a user should see that warning and fix it.
In case you did backup of MAC address or you have MAC address printed on sticker, you can restore it. If you loaded distribution U-Boot which erase MAC address and you have not did any backup, then your MAC address is forever lost.
On Turris MOX we write the MAC address into OTP of the SOC during manufacturing.
It is possible to write code that burns the MAC address into OTP, I consider this a better option than enabling random MAC address.
Quoted 6 lines
Maybe we can enable random MAC address, and if MAC address is not found in environment nor OTP, issue a warning, something like
"WARNING: MAC address lost, please burn the MAC address of your
device to OTP with command xyz"What do you think?
if there's a mac stored in otp during manufacturing, that's of course the best solution. There's no need for
CONFIG_NET_RANDOM_ETHADDRthen. But globalscale does not do that.Doing it afterwards, so u-boot claiming some otp space for itself, and instructing the user how to write to it sounds too dangerous/error-prone.
Quoted 7 lines
For me
CONFIG_NET_RANDOM_ETHADDRis a knob that should be enabled if there's no mac address stored in a sane way (where saving it just to an u-boot env during manufacturing doesn't count as sane, especially if the vendor moves the spi env offset around in a firmware update).So I think
CONFIG_NET_RANDOM_ETHADDRis enough.
Quoted 6 lines
I understand Pali's concerns, though.
The thing is that if we enable
CONFIG_NET_RANDOM_ETHADDRby default, many users that have managed to wipe their env won't care about that they are using randomly generated MAC address and won't solve the issue, which is again the spirit of correctly configure networks.
Yes, CONFIG_NET_RANDOM_ETHADDR does not solve the issue. It is just a workaround which hides real issue.
Quoted 10 lines
If we do not enable
CONFIG_NET_RANDOM_ETHADDR, the worst that can happen is that the device won't boot from network. This will force the users to solve the issue, which is not that hard
setenv ethaddr aa:bb:cc:dd:ee:ff (address from the sticker) saveenv
If the users boots from SD/eMMC/SATA/USB, Linux won't have problem with network, since it will generate random MAC address anyway.The worst case scenario does not look that bad to me if we don't enable
CONFIG_NET_RANDOM_ETHADDRby default.
I see it in the same way.
CONFIG_NET_RANDOM_ETHADDR does not affect Linux kernel as it always generates a random mac address when it does not have correct one.
Moreover CONFIG_NET_RANDOM_ETHADDR introduce another issue. In case there is no valid mac address, U-Boot generates one. But it does not pass this generates mac address to kernel and therefore kernel generates another new random mac address.
I just do not see a benefit from having CONFIG_NET_RANDOM_ETHADDR enabled by default for Espressobin. Real issue is hidden, people would be confused (why it still have different mac address) and distributions, like armbian would continue "workarounding" it by hardcoding one static mac address for all devices into boot scripts or other places.
Quoted 21 lines
I think the option
CONFIG_NET_RANDOM_ETHADDRshould be used only by developers when they are developing on devices that have not yet burned the MAC addresses, or on some embedded devices that don't have space for saving a MAC address (no storage for env or anything else, do such devices exist?).But it shouldn't be used as a default setting for a device that has storage where it can store the address.
Quoted 5 lines
But it would be nice if e.g. a board could set specific env vars as indestructible/unwipeable/precious/whatever, which instructs
env default -ato keep those (which is common after updating the bootloader). Maybe that's an idea worth pursuing?Yes, that would be nice :)
Quoted 2 lines
Thanks,
AndreMarek
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 4 lines · On Mon, 21 Sep 2020 15:05:22 +0200 Pali Roh?r <[email protected]> wrote:
Moreover
CONFIG_NET_RANDOM_ETHADDRintroduce another issue. In case there is no valid mac address, U-Boot generates one. But it does not pass this generates mac address to kernel and therefore kernel generates another new random mac address.
I think it does :) At least on A3720, if the net controller has MAC address set by U-Boot, I think the same one will be used by kernel.
Marek
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 10 lines · On Monday 21 September 2020 15:21:44 Marek Behun wrote:
Quoted 4 lines · On Mon, 21 Sep 2020 15:05:22 +0200 Pali Roh?r <[email protected]> wrote:
Moreover
CONFIG_NET_RANDOM_ETHADDRintroduce another issue. In case there is no valid mac address, U-Boot generates one. But it does not pass this generates mac address to kernel and therefore kernel generates another new random mac address.I think it does :) At least on A3720, if the net controller has MAC address set by U-Boot, I think the same one will be used by kernel.
I mean the case when mac address is not already set in env. The case when CONFIG_NET_RANDOM_ETHADDR code configure mac address, when env variable is not set.
U-Boot set mac address into FDT file only from env.
turris_mox.c code calls eth_env_set_enetaddr() to set env with correct mac address.
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
Quoted 12 lines · Pali Roh?r
Quoted 10 lines · On Monday 21 September 2020 15:21:44 Marek Behun wrote:
Quoted 4 lines · On Mon, 21 Sep 2020 15:05:22 +0200 Pali Roh?r <[email protected]> wrote:
Moreover
CONFIG_NET_RANDOM_ETHADDRintroduce another issue. In case there is no valid mac address, U-Boot generates one. But it does not pass this generates mac address to kernel and therefore kernel generates another new random mac address.I think it does :) At least on A3720, if the net controller has MAC address set by U-Boot, I think the same one will be used by kernel.
Quoted 8 lines
I mean the case when mac address is not already set in env. The case when
CONFIG_NET_RANDOM_ETHADDRcode configure mac address, when env variable is not set.U-Boot set mac address into FDT file only from env.
turris_mox.ccode callseth_env_set_enetaddr()to set env with correct mac address.
If the random address that U-Boot generates is NOT being sent to the kernel, that's a bug to go and fix. That's not usually the case for random MAC addresses generated in U-Boot.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200921/9b8436e7/attachment.sig>
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
In reply to Andre HeiderQuoted 10 lines
-----Original Message-----
From: Andre Heider <[email protected]>
Sent: Tuesday, September 8, 2020 09:35
To: Stefan Roese <[email protected]>; Kostya Porotchkin <[email protected]>
Cc: Pali Roh?r <[email protected]>; u-boot at lists.denx.de
Subject: [EXT] [PATCH] defconfig: espressobin: enableNET_RANDOM_ETHADDR
Quoted 7 lines
External Email
----------------------------------------------------------------------
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.Signed-off-by Andre Heider <[email protected]>
Quoted 14 lines
--- configs/mvebu_espressobin-88f3720_defconfig | 1 + 1 file changed, 1 insertion(+)configs/mvebu_espressobin-88f3720_defconfig +0
-0@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_RTL8152=y
CONFIG_USB_ETHER_SMSC95XX=yCONFIG_SHA1=yCONFIG_SHA256=y+CONFIG_NET_RANDOM_ETHADDR=y
--
2.28.0
PATCH 1/1 defconfig: espressobin: enable NET_RANDOM_ETHADDR
In reply to Andre HeiderQuoted 14 lines · Andre Heider
The hardware does not provide a MAC address. Enable this so that network access works with just the default environment.
Signed-off-by Andre Heider <[email protected]>--- configs/mvebu_espressobin-88f3720_defconfig | 1 + 1 file changed, 1 insertion(+)configs/mvebu_espressobin-88f3720_defconfig +0
-0
configs/mvebu_espressobin-88f3720_defconfig CONFIG_USB_ETHER_RTL8152=y · line 87
Quoted 4 lines
configs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_RTL8152=y CONFIG_USB_ETHER_SMSC95XX=y CONFIG_SHA1=y CONFIG_SHA256=y +CONFIG_NET_RANDOM_ETHADDR=y
Applied to u-boot-marvell/master
Thanks,
Stefan