Skip to contentSkip to conversation

Deal with exfat versus byteorder

PATCH In review Simon Glass 9 participants 47 messages May 1, 2025 – May 8, 2025

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover Deal with exfat versus byteorder

Since exfat has its own byteorder functions we need to be careful about including the normal U-Boot byteorder headers in code included by exfat.

One chain for include/linux/byteorder/little_endian.h is like this:

In file included from arch/sandbox/include/asm/byteorder.h:19,

                 from arch/sandbox/include/asm/byteorder.h:19,
                 from include/compiler.h:132,
                 from include/env.h:12,
                 from include/command.h:13,
                 from include/net-common.h:7,
                 from include/net.h:6,
                 from include/efi.h:23,
                 from include/blk.h:12,
                 from include/part.h:9,
                 from include/fs_internal.h:11,
                 from fs/exfat/io.c:52:

This series tidies things up so that efi.h can include net.h as required.

Changes in v2:
- Add patches for other files exposed by this change

Simon Glass (22):
net: Use a forward declaration for cmd_tbl in net-common.h
congatec: Include env.h to permit reading the environment
dhelectronics: Include env.h to permit reading the environment
imx8ulp_evk: Include env.h to permit reading the environment
venice: Include env.h to permit reading the environment
phytec: Include env.h to permit reading the environment
ronetix: Include env.h to permit reading the environment
toradex: Include env.h to permit reading the environment
advantech: Include env.h in imx8qm_dmsse20_a1
tegra: Include env.h to permit reading the environment
synology: Include env.h to permit reading the environment
amlogic: Include env.h to permit reading the environment
freescale: Include env.h to permit reading the environment
google: Include env.h to permit reading the environment
liebherr: Include env.h to permit reading the environment
technexion: Include env.h to permit reading the environment
elf: Only use network environment-variables if net enabled
net: Include byteorder in net6.h
net: Include string.h in net-legacy.h
net: Include env.h in pcap.c
net: dc2114x: Include env.h to permit reading the environment
net: Move env_get_ip() out of the header file

 arch/arm/mach-tegra/dt-setup.c                |  1 +
 board/Synology/ds414/ds414.c                  |  1 +
 .../imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c     |  1 +
 board/amlogic/jethub-j100/jethub-j100.c       |  1 +
 board/congatec/cgtqmx8/cgtqmx8.c              |  3 +-
 board/dhelectronics/common/dh_common.c        |  1 +
 board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  1 +
 board/freescale/mx7dsabresd/mx7dsabresd.c     |  1 +
 board/gateworks/venice/venice.c               |  1 +
 board/google/chameleonv3/board.c              |  2 +
 board/liebherr/xea/xea.c                      |  1 +
 .../common/phytec_som_detection_blocks.c      |  1 +
 board/ronetix/imx8mq-cm/imx8mq_cm.c           |  1 +
 board/technexion/pico-imx7d/pico-imx7d.c      |  1 +
 board/toradex/colibri_imx7/colibri_imx7.c     |  1 +
 board/toradex/verdin-imx8mm/verdin-imx8mm.c   |  2 +-
 cmd/elf.c                                     | 41 ++++++++++---------
 drivers/net/dc2114x.c                         |  1 +
 include/net-common.h                          |  9 ++--
 include/net-legacy.h                          |  1 +
 include/net6.h                                |  1 +
 net/net-common.c                              |  6 +++
 net/pcap.c                                    |  1 +
 23 files changed, 53 insertions(+), 27 deletions(-)
Signature · 4 lines
2.43.0

base-commit: b5d6220dd2f4612912989f3c2b5a710f2248cb36
branch: fix-net2
#1 lore raw

PATCH v2 1/22 net: Use a forward declaration for cmd_tbl in net-common.h

We don't need to include command.h just for this declaration. It eventually pulls in linux/byteorder which causes a conflict with exfat which has its own byteorder functions.

Use a forward declaration instead.

---

(no changes since v1)

 include/net-common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/net-common.h +2 -1
index 12c50e2a41e..f2613a41ad8 100644
@@ -4,7 +4,6 @@
 #define __NET_COMMON_H__
 
 #include <asm/cache.h>
-#include <command.h>
 #include <env.h>
 #include <hexdump.h>
 #include <linux/if_ether.h>
@@ -13,6 +12,8 @@
 #include <rand.h>
 #include <time.h>
 
+struct cmd_tbl;
+
 #define DEBUG_NET_PKT_TRACE 0	/* Trace all packet data */
 
 /*
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/22 congatec: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

---

(no changes since v1)

 board/congatec/cgtqmx8/cgtqmx8.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
board/congatec/cgtqmx8/cgtqmx8.c +2 -1
index 054e4e10867..087ca007776 100644
@@ -3,7 +3,8 @@
  * Copyright 2018 congatec AG
  * Copyright (C) 2019 Oliver Graute <[email protected]>
  */
-#include <config.h>
+
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <fsl_esdhc.h>
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Signature · 1 line
Tom
#4 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Hi Tom,

Quoted 10 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Regards,
Simon

#5 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Regards,
Simon

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=455004

#7 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 29 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Quoted 4 lines

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

Signature · 1 line
Tom
#8 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Hi Tom,

Quoted 31 lines · Tom Rini
Quoted 29 lines · Simon Glass

Hi Tom,

Quoted 25 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Quoted 7 lines
Quoted 4 lines

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Regards,
Simon

#9 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 33 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Quoted 6 lines
Quoted 2 lines

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Adding headers to headers needs extra care (so that we don't end up with massive implicit include chains).

Quoted 3 lines

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Yes, if there's some problem down the line then some refactoring is likely the thing to look at, not adding more headers to C files (the right path is to unwind the header chain and fix C files, your series doesn't remove env.h from any header).

Signature · 1 line
Tom
#10 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Hi Tom,

Quoted 51 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 33 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Quoted 6 lines
Quoted 2 lines

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Adding headers to headers needs extra care (so that we don't end up with massive implicit include chains).

Quoted 8 lines
Quoted 3 lines

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Yes, if there's some problem down the line then some refactoring is likely the thing to look at, not adding more headers to C files (the right path is to unwind the header chain and fix C files, your series doesn't remove env.h from any header).

I hope we haven't got confused here.

My series removed env.h from being *transitively* included. I had to add it to C files due to that.

Your series doesn't help with including net.h in efi.h - you can try that and see that it still fails.

But as I said, we can move the decls into a separate file.

Regards,
Simon

#11 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 51 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 33 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Quoted 6 lines
Quoted 2 lines

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Adding headers to headers needs extra care (so that we don't end up with massive implicit include chains).

Quoted 8 lines
Quoted 3 lines

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Yes, if there's some problem down the line then some refactoring is likely the thing to look at, not adding more headers to C files (the right path is to unwind the header chain and fix C files, your series doesn't remove env.h from any header).

Quoted 4 lines

I hope we haven't got confused here.

My series removed env.h from being *transitively* included. I had to add it to C files due to that.

Yes, which may or may not be helpful. A transitive include in a C file is not terrible, otherwise many files will have 20+ includes. A transitive include in header file, which in turn pulls in another which pulls in another, is a problem. And the header should be unwound and C files then fixed.

Quoted 2 lines

Your series doesn't help with including net.h in efi.h - you can try that and see that it still fails.

Perhaps I took it out too quickly then, I'd have sworn I build sandbox with that change added.

Quoted 1 line

But as I said, we can move the decls into a separate file.

Yes, that might be the right answer, depending on the problem. I'm not sure adding more headers to headers is good in general.

Signature · 1 line
Tom
#12 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 75 lines · Tom Rini
Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 51 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 33 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Quoted 6 lines
Quoted 2 lines

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Adding headers to headers needs extra care (so that we don't end up with massive implicit include chains).

Quoted 8 lines
Quoted 3 lines

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Yes, if there's some problem down the line then some refactoring is likely the thing to look at, not adding more headers to C files (the right path is to unwind the header chain and fix C files, your series doesn't remove env.h from any header).

Quoted 4 lines

I hope we haven't got confused here.

My series removed env.h from being *transitively* included. I had to add it to C files due to that.

Yes, which may or may not be helpful. A transitive include in a C file is not terrible, otherwise many files will have 20+ includes. A transitive include in header file, which in turn pulls in another which pulls in another, is a problem. And the header should be unwound and C files then fixed.

Quoted 5 lines
Quoted 2 lines

Your series doesn't help with including net.h in efi.h - you can try that and see that it still fails.

Perhaps I took it out too quickly then, I'd have sworn I build sandbox with that change added.

Yeah, I guess I removed it too quick and missed fixing drivers/usb/gadget/epautoconf.c still, along with whatever the right answer is for unwinding the exfat oddity. Likely seeing what the pain is over using the normal byteswap headers instead.

Signature · 1 line
Tom
#13 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Hi Tom,

Quoted 80 lines · Tom Rini
Quoted 78 lines · Tom Rini
Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 51 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 33 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Quoted 6 lines
Quoted 2 lines

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Adding headers to headers needs extra care (so that we don't end up with massive implicit include chains).

Quoted 8 lines
Quoted 3 lines

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Yes, if there's some problem down the line then some refactoring is likely the thing to look at, not adding more headers to C files (the right path is to unwind the header chain and fix C files, your series doesn't remove env.h from any header).

Quoted 4 lines

I hope we haven't got confused here.

My series removed env.h from being *transitively* included. I had to add it to C files due to that.

Yes, which may or may not be helpful. A transitive include in a C file is not terrible, otherwise many files will have 20+ includes. A transitive include in header file, which in turn pulls in another which pulls in another, is a problem. And the header should be unwound and C files then fixed.

Quoted 2 lines

Your series doesn't help with including net.h in efi.h - you can try that and see that it still fails.

Quoted 7 lines
Quoted 2 lines

Perhaps I took it out too quickly then, I'd have sworn I build sandbox with that change added.

Yeah, I guess I removed it too quick and missed fixing drivers/usb/gadget/epautoconf.c still, along with whatever the right answer is for unwinding the exfat oddity. Likely seeing what the pain is over using the normal byteswap headers instead.

OK, are you thinking of taking a look at that? Or do you think it would be better to change exfat to use the linux/byteorder stuff (which I somewhat prefer)?

Regards,
Simon

#14 lore raw

Re: [PATCH v2 02/22] congatec: Include env.h to permit reading the environment

Quoted 86 lines · Simon Glass

Hi Tom,

Quoted 83 lines · Tom Rini
Quoted 80 lines · Tom Rini
Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 51 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 33 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Drop the unnecessary config.h while we are here.

Quoted 7 lines
Quoted 3 lines

Are you sure about that? It was explicitly added in commit ab61cc7d98f6 ("board: congatec: Remove <common.h> and add needed includes") probably because of CFG_SYS_... usage.

Well I assumed it wouldn't build if it had it, but perhaps that is incorrect? I understood that CFG_ things had to be values and you couldn't #idef them?

Quoted 5 lines

The cases where in that series I added config.h were for good reason, either failure to build or tricky size change reasons. All were intentional. An audit-and-remove of config.h would be it's own series as yes, there's perhaps not the need now as whatever complex chain was unwound.

Oh dear, OK. I'll respin the series.

Hmm but I see you have sent a series that does some similar tweak[1]. What was the goal there?

Quoted 6 lines
Quoted 2 lines

I fixed your problem. Please don't bother re-spinning this series, it's not clear what problems it's solving correctly.

OK thanks. The problem was trying to include net.h in include/efi.h:

https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Adding headers to headers needs extra care (so that we don't end up with massive implicit include chains).

Quoted 8 lines
Quoted 3 lines

So long as that works, we're fine. Having said that, even if it were a problem, we could always refactor things to put the Ethernet decls in a separate header.

Yes, if there's some problem down the line then some refactoring is likely the thing to look at, not adding more headers to C files (the right path is to unwind the header chain and fix C files, your series doesn't remove env.h from any header).

Quoted 4 lines

I hope we haven't got confused here.

My series removed env.h from being *transitively* included. I had to add it to C files due to that.

Yes, which may or may not be helpful. A transitive include in a C file is not terrible, otherwise many files will have 20+ includes. A transitive include in header file, which in turn pulls in another which pulls in another, is a problem. And the header should be unwound and C files then fixed.

Quoted 2 lines

Your series doesn't help with including net.h in efi.h - you can try that and see that it still fails.

Perhaps I took it out too quickly then, I'd have sworn I build sandbox with that change added.

Quoted 8 lines
Quoted 4 lines

Yeah, I guess I removed it too quick and missed fixing drivers/usb/gadget/epautoconf.c still, along with whatever the right answer is for unwinding the exfat oddity. Likely seeing what the pain is over using the normal byteswap headers instead.

OK, are you thinking of taking a look at that? Or do you think it would be better to change exfat to use the linux/byteorder stuff (which I somewhat prefer)?

Yes, I would like to hear Marek's thoughts on changing exfat to use the normal byteswap functions.

Signature · 1 line
Tom
#15 lore raw

PATCH v2 3/22 dhelectronics: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/dhelectronics/common/dh_common.c | 1 +
 1 file changed, 1 insertion(+)
board/dhelectronics/common/dh_common.c +1 -0
index 32c50b4f0f5..24fe6ff50b4 100644
@@ -5,6 +5,7 @@
  */
 
 #include <dm.h>
+#include <env.h>
 #include <i2c_eeprom.h>
 #include <net.h>
 
Signature · 1 line
2.43.0
#16 lore raw

PATCH v2 4/22 imx8ulp_evk: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/freescale/imx8ulp_evk/imx8ulp_evk.c | 1 +
 1 file changed, 1 insertion(+)
board/freescale/imx8ulp_evk/imx8ulp_evk.c +1 -0
index 0af61067263..4bf77a488cc 100644
@@ -3,6 +3,7 @@
  * Copyright 2020 NXP
  */
 
+#include <env.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/arch/imx8ulp-pins.h>
Signature · 1 line
2.43.0
#17 lore raw

PATCH v2 5/22 venice: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/gateworks/venice/venice.c | 1 +
 1 file changed, 1 insertion(+)
board/gateworks/venice/venice.c +1 -0
index 98b33624f04..f9bcdd8496e 100644
@@ -3,6 +3,7 @@
  * Copyright 2021 Gateworks Corporation
  */
 
+#include <env.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <led.h>
Signature · 1 line
2.43.0
#18 lore raw

PATCH v2 6/22 phytec: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/phytec/common/phytec_som_detection_blocks.c | 1 +
 1 file changed, 1 insertion(+)
board/phytec/common/phytec_som_detection_blocks.c +1 -0
index 5f3c27ef0c2..b44ff85972f 100644
@@ -4,6 +4,7 @@
  * Author: Daniel Schultz <[email protected]>
  */
 
+#include <env.h>
 #include <malloc.h>
 #include <u-boot/crc.h>
 #include <net.h>
Signature · 1 line
2.43.0
#19 lore raw

PATCH v2 7/22 ronetix: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/ronetix/imx8mq-cm/imx8mq_cm.c | 1 +
 1 file changed, 1 insertion(+)
board/ronetix/imx8mq-cm/imx8mq_cm.c +1 -0
index fbee2c39771..602216854ba 100644
@@ -3,6 +3,7 @@
  * Copyright 2018 NXP
  */
 
+#include <env.h>
 #include <miiphy.h>
 #include <asm-generic/gpio.h>
 #include <asm/arch/imx8mq_pins.h>
Signature · 1 line
2.43.0
#20 lore raw

PATCH v2 8/22 toradex: Include env.h to permit reading the environment

In reply to Simon Glass

Two files read from the environment but don't not include the correct header. Update them.

---

(no changes since v1)

 board/toradex/colibri_imx7/colibri_imx7.c   | 1 +
 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
board/toradex/colibri_imx7/colibri_imx7.c +1 -0
index 7de29e3abfb..69a8a18d3a7 100644
@@ -4,6 +4,7 @@
  */
 
 #include <cpu_func.h>
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/arch/clock.h>
board/toradex/verdin-imx8mm/verdin-imx8mm.c +1 -1
index 9359e0ac6bf..066e8db678f 100644
@@ -3,7 +3,7 @@
  * Copyright 2020-2021 Toradex
  */
 
-#include <config.h>
+#include <env.h>
 #include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
Signature · 1 line
2.43.0
#21 lore raw

PATCH v2 9/22 advantech: Include env.h in imx8qm_dmsse20_a1

In reply to Simon Glass

This file uses the environment but does not include the header file. Update it.

---

(no changes since v1)

 board/advantech/imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c | 1 +
 1 file changed, 1 insertion(+)
board/advantech/imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c +1 -0
index 50b35db5f6c..accd300df04 100644
@@ -4,6 +4,7 @@
  * Copyright 2019-2023 Kococonnector GmbH
  */
 
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <asm/io.h>
Signature · 1 line
2.43.0
Acked-by on v2 9/22
#22 lore raw

Re: [PATCH v2 09/22] advantech: Include env.h in imx8qm_dmsse20_a1

Quoted 25 lines · Simon Glass

This file uses the environment but does not include the header file. Update it.

---

(no changes since v1)

 board/advantech/imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c | 1 +
 1 file changed, 1 insertion(+)
board/advantech/imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c +1 -0
index 50b35db5f6c..accd300df04 100644
@@ -4,6 +4,7 @@
  * Copyright 2019-2023 Kococonnector GmbH
  */
 
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <asm/io.h>
Signature · 1 line
2.43.0
#23 lore raw

PATCH v2 10/22 tegra: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 arch/arm/mach-tegra/dt-setup.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-tegra/dt-setup.c +1 -0
index f4ae602d523..96044ac78ce 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2010-2016, NVIDIA CORPORATION.
  */
 
+#include <env.h>
 #include <fdtdec.h>
 #include <stdlib.h>
 #include <asm/arch-tegra/cboot.h>
Signature · 1 line
2.43.0
#24 lore raw

PATCH v2 11/22 synology: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/Synology/ds414/ds414.c | 1 +
 1 file changed, 1 insertion(+)
board/Synology/ds414/ds414.c +1 -0
index 1a4cea87e1a..02d6a4a1ea8 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2015 Phil Sutter <[email protected]>
  */
 
+#include <env.h>
 #include <init.h>
 #include <miiphy.h>
 #include <asm/global_data.h>
Signature · 1 line
2.43.0
Reviewed-by on v2 11/22
#25 lore raw

Re: [PATCH v2 11/22] synology: Include env.h to permit reading the environment

Quoted 5 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Thanks,
Tony

Quoted 22 lines

---

(no changes since v1)

 board/Synology/ds414/ds414.c | 1 +
 1 file changed, 1 insertion(+)
board/Synology/ds414/ds414.c +1 -1
index 1a4cea87e1a..02d6a4a1ea8 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2015 Phil Sutter <[email protected]>
  */
 
+#include <env.h>
 #include <init.h>
 #include <miiphy.h>
 #include <asm/global_data.h>
--

2.43.0

Reviewed-by on v2 11/22
#26 lore raw

Re: [PATCH v2 11/22] synology: Include env.h to permit reading the environment

In reply to Simon Glass
Quoted 4 lines · Simon Glass

This file reads from the environment but does not include the correct header. Update it.

Thanks,
Stefan

Quoted 12 lines

---

(no changes since v1)

  board/Synology/ds414/ds414.c | 1 +
  1 file changed, 1 insertion(+)
board/Synology/ds414/ds414.c +0 -0
index 1a4cea87e1a..02d6a4a1ea8 100644

board/Synology/ds414/ds414.c line 10

Quoted 7 lines
board/Synology/ds414/ds414.c +1 -0
@@ -4,6 +4,7 @@
   * Copyright (C) 2015 Phil Sutter <[email protected]>
   */
 
+#include <env.h>
  #include <init.h>
  #include <miiphy.h>
  #include <asm/global_data.h>

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#27 lore raw

PATCH v2 12/22 amlogic: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/amlogic/jethub-j100/jethub-j100.c | 1 +
 1 file changed, 1 insertion(+)
board/amlogic/jethub-j100/jethub-j100.c +1 -0
index b770a1f8c53..9e87fb9f9d7 100644
@@ -5,6 +5,7 @@
  */
 
 #include <dm.h>
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/io.h>
Signature · 1 line
2.43.0
Reviewed-by on v2 12/22
#28 lore raw

Re: [PATCH v2 12/22] amlogic: Include env.h to permit reading the environment

Quoted 16 lines · Simon Glass via groups.io

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

  board/amlogic/jethub-j100/jethub-j100.c | 1 +
  1 file changed, 1 insertion(+)
board/amlogic/jethub-j100/jethub-j100.c +0 -0
index b770a1f8c53..9e87fb9f9d7 100644

board/amlogic/jethub-j100/jethub-j100.c line 11

Quoted 7 lines
board/amlogic/jethub-j100/jethub-j100.c +1 -0
@@ -5,6 +5,7 @@
   */
 
  #include <dm.h>
+#include <env.h>
  #include <init.h>
  #include <net.h>
  #include <asm/io.h>
#29 lore raw

PATCH v2 13/22 freescale: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/freescale/mx7dsabresd/mx7dsabresd.c | 1 +
 1 file changed, 1 insertion(+)
board/freescale/mx7dsabresd/mx7dsabresd.c +1 -0
index 3db167c0dad..bef4f901ff7 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2015 Freescale Semiconductor, Inc.
  */
 
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/arch/clock.h>
Signature · 1 line
2.43.0
#30 lore raw

PATCH v2 14/22 google: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/google/chameleonv3/board.c | 2 ++
 1 file changed, 2 insertions(+)
board/google/chameleonv3/board.c +2 -0
index 4d3049689d3..d8ffdd25b38 100644
@@ -2,6 +2,8 @@
 /*
  * Copyright 2022 Google LLC
  */
+
+#include <env.h>
 #include <net.h>
 #include <errno.h>
 #include "mercury_aa1.h"
Signature · 1 line
2.43.0
#31 lore raw

PATCH v2 15/22 liebherr: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/liebherr/xea/xea.c | 1 +
 1 file changed, 1 insertion(+)
board/liebherr/xea/xea.c +1 -0
index 1d4f165fd13..9630e7f576b 100644
@@ -13,6 +13,7 @@
  *
  */
 
+#include <env.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <log.h>
Signature · 1 line
2.43.0
Reviewed-by on v2 15/22
#32 lore raw

Re: [PATCH v2 15/22] liebherr: Include env.h to permit reading the environment

Quoted 16 lines · On Wed, 30 Apr 2025 19:04:40 -0600 Simon Glass <[email protected]> wrote:

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/liebherr/xea/xea.c | 1 +
 1 file changed, 1 insertion(+)
board/liebherr/xea/xea.c +0 -0
index 1d4f165fd13..9630e7f576b 100644

board/liebherr/xea/xea.c line 19

Quoted 7 lines
board/liebherr/xea/xea.c +1 -0
@@ -13,6 +13,7 @@
  *
  */
 
+#include <env.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <log.h>

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#33 lore raw

PATCH v2 16/22 technexion: Include env.h to permit reading the environment

In reply to Simon Glass

This file reads from the environment but does not include the correct header. Update it.

---

(no changes since v1)

 board/technexion/pico-imx7d/pico-imx7d.c | 1 +
 1 file changed, 1 insertion(+)
board/technexion/pico-imx7d/pico-imx7d.c +1 -0
index d0f739c624a..cf6b7fcbd95 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2017 NXP Semiconductors
  */
 
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/arch/clock.h>
Signature · 1 line
2.43.0
#34 lore raw

PATCH v2 17/22 elf: Only use network environment-variables if net enabled

In reply to Simon Glass

If there is no network support it doesn't make sense to try to read these variables. Add a condition to handle this.

This is needed so that env_get_ip() is not called when it is no-longer a static inline, but included in net/ code.

---

(no changes since v1)

 cmd/elf.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)
cmd/elf.c +22 -19
index 6b49c613703..c94125dc4a9 100644
@@ -242,30 +242,33 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 		 * The following parameters are only needed if 'bootdev'
 		 * is an ethernet device, otherwise they are optional.
 		 */
-		tmp = env_get("ipaddr");
-		if (tmp) {
-			ptr += sprintf(build_buf + ptr, "e=%s", tmp);
-			tmp = env_get("netmask");
+		if (IS_ENABLED(CONFIG_NET) || IS_ENABLED(CONFIG_NET_LWIP)) {
+			tmp = env_get("ipaddr");
 			if (tmp) {
-				u32 mask = env_get_ip("netmask").s_addr;
-				ptr += sprintf(build_buf + ptr,
-					       ":%08x ", ntohl(mask));
-			} else {
-				ptr += sprintf(build_buf + ptr, " ");
+				ptr += sprintf(build_buf + ptr, "e=%s", tmp);
+				tmp = env_get("netmask");
+				if (tmp) {
+					u32 mask = env_get_ip("netmask").s_addr;
+
+					ptr += sprintf(build_buf + ptr,
+						       ":%08x ", ntohl(mask));
+				} else {
+					ptr += sprintf(build_buf + ptr, " ");
+				}
 			}
-		}
 
-		tmp = env_get("serverip");
-		if (tmp)
-			ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
+			tmp = env_get("serverip");
+			if (tmp)
+				ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
 
-		tmp = env_get("gatewayip");
-		if (tmp)
-			ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
+			tmp = env_get("gatewayip");
+			if (tmp)
+				ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
 
-		tmp = env_get("hostname");
-		if (tmp)
-			ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
+			tmp = env_get("hostname");
+			if (tmp)
+				ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
+		}
 
 		tmp = env_get("othbootargs");
 		if (tmp) {
Signature · 1 line
2.43.0
Acked-by on v2 17/22
#35 lore raw

Re: [PATCH v2 17/22] elf: Only use network environment-variables if net enabled

Quoted 13 lines · Simon Glass

If there is no network support it doesn't make sense to try to read these variables. Add a condition to handle this.

This is needed so that env_get_ip() is not called when it is no-longer a static inline, but included in net/ code.

---

(no changes since v1)

 cmd/elf.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

[...]

Thanks,

Signature · 1 line
Jerome
#36 lore raw

PATCH v2 18/22 net: Include byteorder in net6.h

In reply to Simon Glass

This file uses byteorder but does not include the header file. Update it.

---

(no changes since v1)

 include/net6.h | 1 +
 1 file changed, 1 insertion(+)
include/net6.h +1 -0
index 1ed989e584a..2709fe9c4dc 100644
@@ -11,6 +11,7 @@
 #define __NET6_H__
 
 #include <net.h>
+#include <asm/byteorder.h>
 #include <linux/ctype.h>
 #include <linux/errno.h>
 
Signature · 1 line
2.43.0
#37 lore raw

PATCH v2 19/22 net: Include string.h in net-legacy.h

In reply to Simon Glass

This file uses memcpy() but does not include the header file. Update it.

---

(no changes since v1)

 include/net-legacy.h | 1 +
 1 file changed, 1 insertion(+)
include/net-legacy.h +1 -0
index 1f62ebff51d..a43ab9db589 100644
@@ -17,6 +17,7 @@
 #include <log.h>
 #include <time.h>
 #include <linux/if_ether.h>
+#include <linux/string.h>
 
 struct bd_info;
 struct cmd_tbl;
Signature · 1 line
2.43.0
Reviewed-by on v2 19/22
#38 lore raw

Re: [PATCH v2 19/22] net: Include string.h in net-legacy.h

Quoted 15 lines · Simon Glass

This file uses memcpy() but does not include the header file. Update it.

---

(no changes since v1)

 include/net-legacy.h | 1 +
 1 file changed, 1 insertion(+)
include/net-legacy.h +0 -0
index 1f62ebff51d..a43ab9db589 100644

include/net-legacy.h line 23

Quoted 7 lines
include/net-legacy.h +1 -0
@@ -17,6 +17,7 @@
 #include <log.h>
 #include <time.h>
 #include <linux/if_ether.h>
+#include <linux/string.h>
 
 struct bd_info;
 struct cmd_tbl;

Thanks,

Signature · 1 line
Jerome
#39 lore raw

PATCH v2 20/22 net: Include env.h in pcap.c

In reply to Simon Glass

This file uses the environment but does not include the header file. Update it.

---

(no changes since v1)

 net/pcap.c | 1 +
 1 file changed, 1 insertion(+)
net/pcap.c +1 -0
index c959e3e4e51..d1d6f705cda 100644
@@ -3,6 +3,7 @@
  * Copyright 2019 Ramon Fried <[email protected]>
  */
 
+#include <env.h>
 #include <net.h>
 #include <net/pcap.h>
 #include <time.h>
Signature · 1 line
2.43.0
#40 lore raw

PATCH v2 21/22 net: dc2114x: Include env.h to permit reading the environment

In reply to Simon Glass

This file uses the environment but does not include the header file. Update it.

---

(no changes since v1)

 drivers/net/dc2114x.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/dc2114x.c +1 -0
index 7c0665faa8e..8fa549280aa 100644
@@ -3,6 +3,7 @@
 #include <asm/io.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <env.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
Signature · 1 line
2.43.0
#41 lore raw

PATCH v2 22/22 net: Move env_get_ip() out of the header file

In reply to Simon Glass

This function requires access to env.h but it is a lot to include just for the env_get() function. It eventually pulls in linux/byteorder which causes a conflict with exfat which has its own byteorder functions.

Move the function to a C file instead.

Add includes to some other files to keep the build working.

---

(no changes since v1)

 include/net-common.h | 6 +-----
 net/net-common.c     | 6 ++++++
 2 files changed, 7 insertions(+), 5 deletions(-)
include/net-common.h +1 -5
index f2613a41ad8..64b475b7292 100644
@@ -4,7 +4,6 @@
 #define __NET_COMMON_H__
 
 #include <asm/cache.h>
-#include <env.h>
 #include <hexdump.h>
 #include <linux/if_ether.h>
 #include <linux/sizes.h>
@@ -464,10 +463,7 @@ int update_tftp(ulong addr, char *interface, char *devstring);
  *	0 to 255
  * Return: IP address, or 0 if invalid
  */
-static inline struct in_addr env_get_ip(char *var)
-{
-	return string_to_ip(env_get(var));
-}
+struct in_addr env_get_ip(char *var);
 
 int net_init(void);
 
net/net-common.c +6 -0
index 45288fe5f80..9ff06b165df 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <env.h>
 #include <net-common.h>
 
 void copy_filename(char *dst, const char *src, int size)
@@ -25,3 +26,8 @@ int wget_request(ulong dst_addr, char *uri, struct wget_http_info *info)
 	wget_info = info ? info : &default_wget_info;
 	return wget_with_dns(dst_addr, uri);
 }
+
+struct in_addr env_get_ip(char *var)
+{
+	return string_to_ip(env_get(var));
+}
Signature · 1 line
2.43.0
#42 lore raw
In reply to Simon Glass
Quoted 2 lines · Simon Glass

Since exfat has its own byteorder functions we need to be careful about including the normal U-Boot byteorder headers in code included by exfat.

...

Quoted 39 lines

net: Use a forward declaration for cmd_tbl in net-common.h
congatec: Include env.h to permit reading the environment
dhelectronics: Include env.h to permit reading the environment
imx8ulp_evk: Include env.h to permit reading the environment
venice: Include env.h to permit reading the environment
phytec: Include env.h to permit reading the environment
ronetix: Include env.h to permit reading the environment
toradex: Include env.h to permit reading the environment
advantech: Include env.h in imx8qm_dmsse20_a1
tegra: Include env.h to permit reading the environment
synology: Include env.h to permit reading the environment
amlogic: Include env.h to permit reading the environment
freescale: Include env.h to permit reading the environment
google: Include env.h to permit reading the environment
liebherr: Include env.h to permit reading the environment
technexion: Include env.h to permit reading the environment
elf: Only use network environment-variables if net enabled
net: Include byteorder in net6.h
net: Include string.h in net-legacy.h
net: Include env.h in pcap.c
net: dc2114x: Include env.h to permit reading the environment
net: Move env_get_ip() out of the header file

  arch/arm/mach-tegra/dt-setup.c                |  1 +
  board/Synology/ds414/ds414.c                  |  1 +
  .../imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c     |  1 +
  board/amlogic/jethub-j100/jethub-j100.c       |  1 +
  board/congatec/cgtqmx8/cgtqmx8.c              |  3 +-
  board/dhelectronics/common/dh_common.c        |  1 +
  board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  1 +
  board/freescale/mx7dsabresd/mx7dsabresd.c     |  1 +
  board/gateworks/venice/venice.c               |  1 +
  board/google/chameleonv3/board.c              |  2 +
  board/liebherr/xea/xea.c                      |  1 +
  .../common/phytec_som_detection_blocks.c      |  1 +
  board/ronetix/imx8mq-cm/imx8mq_cm.c           |  1 +
  board/technexion/pico-imx7d/pico-imx7d.c      |  1 +
  board/toradex/colibri_imx7/colibri_imx7.c     |  1 +
  board/toradex/verdin-imx8mm/verdin-imx8mm.c   |  2 +-
Quoted 8 lines
  cmd/elf.c                                     | 41 ++++++++++---------
  drivers/net/dc2114x.c                         |  1 +
  include/net-common.h                          |  9 ++--
  include/net-legacy.h                          |  1 +
  include/net6.h                                |  1 +
  net/net-common.c                              |  6 +++
  net/pcap.c                                    |  1 +
  23 files changed, 53 insertions(+), 27 deletions(-)

There are no fs changes in this series , what does this series have to do with exfat ?

#43 lore raw

Hi Marek,

Quoted 54 lines · Marek Vasut
Quoted 2 lines · Simon Glass

Since exfat has its own byteorder functions we need to be careful about including the normal U-Boot byteorder headers in code included by exfat.

...

Quoted 39 lines

net: Use a forward declaration for cmd_tbl in net-common.h
congatec: Include env.h to permit reading the environment
dhelectronics: Include env.h to permit reading the environment
imx8ulp_evk: Include env.h to permit reading the environment
venice: Include env.h to permit reading the environment
phytec: Include env.h to permit reading the environment
ronetix: Include env.h to permit reading the environment
toradex: Include env.h to permit reading the environment
advantech: Include env.h in imx8qm_dmsse20_a1
tegra: Include env.h to permit reading the environment
synology: Include env.h to permit reading the environment
amlogic: Include env.h to permit reading the environment
freescale: Include env.h to permit reading the environment
google: Include env.h to permit reading the environment
liebherr: Include env.h to permit reading the environment
technexion: Include env.h to permit reading the environment
elf: Only use network environment-variables if net enabled
net: Include byteorder in net6.h
net: Include string.h in net-legacy.h
net: Include env.h in pcap.c
net: dc2114x: Include env.h to permit reading the environment
net: Move env_get_ip() out of the header file

  arch/arm/mach-tegra/dt-setup.c                |  1 +
  board/Synology/ds414/ds414.c                  |  1 +
  .../imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c     |  1 +
  board/amlogic/jethub-j100/jethub-j100.c       |  1 +
  board/congatec/cgtqmx8/cgtqmx8.c              |  3 +-
  board/dhelectronics/common/dh_common.c        |  1 +
  board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  1 +
  board/freescale/mx7dsabresd/mx7dsabresd.c     |  1 +
  board/gateworks/venice/venice.c               |  1 +
  board/google/chameleonv3/board.c              |  2 +
  board/liebherr/xea/xea.c                      |  1 +
  .../common/phytec_som_detection_blocks.c      |  1 +
  board/ronetix/imx8mq-cm/imx8mq_cm.c           |  1 +
  board/technexion/pico-imx7d/pico-imx7d.c      |  1 +
  board/toradex/colibri_imx7/colibri_imx7.c     |  1 +
  board/toradex/verdin-imx8mm/verdin-imx8mm.c   |  2 +-
Quoted 8 lines
  cmd/elf.c                                     | 41 ++++++++++---------
  drivers/net/dc2114x.c                         |  1 +
  include/net-common.h                          |  9 ++--
  include/net-legacy.h                          |  1 +
  include/net6.h                                |  1 +
  net/net-common.c                              |  6 +++
  net/pcap.c                                    |  1 +
  23 files changed, 53 insertions(+), 27 deletions(-)
Quoted 2 lines

There are no fs changes in this series , what does this series have to do with exfat ?

I found that in some situations, the exfat code includes linux/byteorder.h instead of its own local byteorder, which is implemented differently. This then causes build errors in the exfat code. One way to trigger it is by adding '#include net.h' to include/efi.h

Regards,
SImon

#44 lore raw
Quoted 57 lines · Simon Glass

Hi Marek,

Quoted 54 lines · Marek Vasut
Quoted 2 lines · Simon Glass

Since exfat has its own byteorder functions we need to be careful about including the normal U-Boot byteorder headers in code included by exfat.

...

Quoted 47 lines

net: Use a forward declaration for cmd_tbl in net-common.h
congatec: Include env.h to permit reading the environment
dhelectronics: Include env.h to permit reading the environment
imx8ulp_evk: Include env.h to permit reading the environment
venice: Include env.h to permit reading the environment
phytec: Include env.h to permit reading the environment
ronetix: Include env.h to permit reading the environment
toradex: Include env.h to permit reading the environment
advantech: Include env.h in imx8qm_dmsse20_a1
tegra: Include env.h to permit reading the environment
synology: Include env.h to permit reading the environment
amlogic: Include env.h to permit reading the environment
freescale: Include env.h to permit reading the environment
google: Include env.h to permit reading the environment
liebherr: Include env.h to permit reading the environment
technexion: Include env.h to permit reading the environment
elf: Only use network environment-variables if net enabled
net: Include byteorder in net6.h
net: Include string.h in net-legacy.h
net: Include env.h in pcap.c
net: dc2114x: Include env.h to permit reading the environment
net: Move env_get_ip() out of the header file

  arch/arm/mach-tegra/dt-setup.c                |  1 +
  board/Synology/ds414/ds414.c                  |  1 +
  .../imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c     |  1 +
  board/amlogic/jethub-j100/jethub-j100.c       |  1 +
  board/congatec/cgtqmx8/cgtqmx8.c              |  3 +-
  board/dhelectronics/common/dh_common.c        |  1 +
  board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  1 +
  board/freescale/mx7dsabresd/mx7dsabresd.c     |  1 +
  board/gateworks/venice/venice.c               |  1 +
  board/google/chameleonv3/board.c              |  2 +
  board/liebherr/xea/xea.c                      |  1 +
  .../common/phytec_som_detection_blocks.c      |  1 +
  board/ronetix/imx8mq-cm/imx8mq_cm.c           |  1 +
  board/technexion/pico-imx7d/pico-imx7d.c      |  1 +
  board/toradex/colibri_imx7/colibri_imx7.c     |  1 +
  board/toradex/verdin-imx8mm/verdin-imx8mm.c   |  2 +-
  cmd/elf.c                                     | 41 ++++++++++---------
  drivers/net/dc2114x.c                         |  1 +
  include/net-common.h                          |  9 ++--
  include/net-legacy.h                          |  1 +
  include/net6.h                                |  1 +
  net/net-common.c                              |  6 +++
  net/pcap.c                                    |  1 +
  23 files changed, 53 insertions(+), 27 deletions(-)
Quoted 8 lines
Quoted 2 lines

There are no fs changes in this series , what does this series have to do with exfat ?

I found that in some situations, the exfat code includes linux/byteorder.h instead of its own local byteorder, which is implemented differently. This then causes build errors in the exfat code. One way to trigger it is by adding '#include net.h' to include/efi.h

Setting aside if it's a good idea to have efi.h include net.h, we should unwind what the heck is going on. The build error is on CLUSTER_INVALID somehow becoming weird. Looking harder at this, the problem I see is that include/fs.h includes <rtc.h> (which in turn pulls in many things) when it only needs <rtc_defs.h> for struct rtc_time. This however exposes some other implicit includes. I'll go and take a look at hunting these all down.

Signature · 1 line
Tom
#45 lore raw

Hi Tom,

Quoted 68 lines · Tom Rini
Quoted 57 lines · Simon Glass

Hi Marek,

Quoted 54 lines · Marek Vasut
Quoted 2 lines · Simon Glass

Since exfat has its own byteorder functions we need to be careful about including the normal U-Boot byteorder headers in code included by exfat.

...

Quoted 47 lines

net: Use a forward declaration for cmd_tbl in net-common.h
congatec: Include env.h to permit reading the environment
dhelectronics: Include env.h to permit reading the environment
imx8ulp_evk: Include env.h to permit reading the environment
venice: Include env.h to permit reading the environment
phytec: Include env.h to permit reading the environment
ronetix: Include env.h to permit reading the environment
toradex: Include env.h to permit reading the environment
advantech: Include env.h in imx8qm_dmsse20_a1
tegra: Include env.h to permit reading the environment
synology: Include env.h to permit reading the environment
amlogic: Include env.h to permit reading the environment
freescale: Include env.h to permit reading the environment
google: Include env.h to permit reading the environment
liebherr: Include env.h to permit reading the environment
technexion: Include env.h to permit reading the environment
elf: Only use network environment-variables if net enabled
net: Include byteorder in net6.h
net: Include string.h in net-legacy.h
net: Include env.h in pcap.c
net: dc2114x: Include env.h to permit reading the environment
net: Move env_get_ip() out of the header file

  arch/arm/mach-tegra/dt-setup.c                |  1 +
  board/Synology/ds414/ds414.c                  |  1 +
  .../imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c     |  1 +
  board/amlogic/jethub-j100/jethub-j100.c       |  1 +
  board/congatec/cgtqmx8/cgtqmx8.c              |  3 +-
  board/dhelectronics/common/dh_common.c        |  1 +
  board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  1 +
  board/freescale/mx7dsabresd/mx7dsabresd.c     |  1 +
  board/gateworks/venice/venice.c               |  1 +
  board/google/chameleonv3/board.c              |  2 +
  board/liebherr/xea/xea.c                      |  1 +
  .../common/phytec_som_detection_blocks.c      |  1 +
  board/ronetix/imx8mq-cm/imx8mq_cm.c           |  1 +
  board/technexion/pico-imx7d/pico-imx7d.c      |  1 +
  board/toradex/colibri_imx7/colibri_imx7.c     |  1 +
  board/toradex/verdin-imx8mm/verdin-imx8mm.c   |  2 +-
  cmd/elf.c                                     | 41 ++++++++++---------
  drivers/net/dc2114x.c                         |  1 +
  include/net-common.h                          |  9 ++--
  include/net-legacy.h                          |  1 +
  include/net6.h                                |  1 +
  net/net-common.c                              |  6 +++
  net/pcap.c                                    |  1 +
  23 files changed, 53 insertions(+), 27 deletions(-)
Quoted 8 lines
Quoted 2 lines

There are no fs changes in this series , what does this series have to do with exfat ?

I found that in some situations, the exfat code includes linux/byteorder.h instead of its own local byteorder, which is implemented differently. This then causes build errors in the exfat code. One way to trigger it is by adding '#include net.h' to include/efi.h

Quoted 7 lines

Setting aside if it's a good idea to have efi.h include net.h, we should unwind what the heck is going on. The build error is on CLUSTER_INVALID somehow becoming weird. Looking harder at this, the problem I see is that include/fs.h includes <rtc.h> (which in turn pulls in many things) when it only needs <rtc_defs.h> for struct rtc_time. This however exposes some other implicit includes. I'll go and take a look at hunting these all down.

OK. I wonder if we could drop the special byteorder macros in exfat?

Regards,
SImon

#46 lore raw
Quoted 79 lines · Simon Glass

Hi Tom,

Quoted 68 lines · Tom Rini
Quoted 57 lines · Simon Glass

Hi Marek,

Quoted 54 lines · Marek Vasut
Quoted 2 lines · Simon Glass

Since exfat has its own byteorder functions we need to be careful about including the normal U-Boot byteorder headers in code included by exfat.

...

Quoted 47 lines

net: Use a forward declaration for cmd_tbl in net-common.h
congatec: Include env.h to permit reading the environment
dhelectronics: Include env.h to permit reading the environment
imx8ulp_evk: Include env.h to permit reading the environment
venice: Include env.h to permit reading the environment
phytec: Include env.h to permit reading the environment
ronetix: Include env.h to permit reading the environment
toradex: Include env.h to permit reading the environment
advantech: Include env.h in imx8qm_dmsse20_a1
tegra: Include env.h to permit reading the environment
synology: Include env.h to permit reading the environment
amlogic: Include env.h to permit reading the environment
freescale: Include env.h to permit reading the environment
google: Include env.h to permit reading the environment
liebherr: Include env.h to permit reading the environment
technexion: Include env.h to permit reading the environment
elf: Only use network environment-variables if net enabled
net: Include byteorder in net6.h
net: Include string.h in net-legacy.h
net: Include env.h in pcap.c
net: dc2114x: Include env.h to permit reading the environment
net: Move env_get_ip() out of the header file

  arch/arm/mach-tegra/dt-setup.c                |  1 +
  board/Synology/ds414/ds414.c                  |  1 +
  .../imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c     |  1 +
  board/amlogic/jethub-j100/jethub-j100.c       |  1 +
  board/congatec/cgtqmx8/cgtqmx8.c              |  3 +-
  board/dhelectronics/common/dh_common.c        |  1 +
  board/freescale/imx8ulp_evk/imx8ulp_evk.c     |  1 +
  board/freescale/mx7dsabresd/mx7dsabresd.c     |  1 +
  board/gateworks/venice/venice.c               |  1 +
  board/google/chameleonv3/board.c              |  2 +
  board/liebherr/xea/xea.c                      |  1 +
  .../common/phytec_som_detection_blocks.c      |  1 +
  board/ronetix/imx8mq-cm/imx8mq_cm.c           |  1 +
  board/technexion/pico-imx7d/pico-imx7d.c      |  1 +
  board/toradex/colibri_imx7/colibri_imx7.c     |  1 +
  board/toradex/verdin-imx8mm/verdin-imx8mm.c   |  2 +-
  cmd/elf.c                                     | 41 ++++++++++---------
  drivers/net/dc2114x.c                         |  1 +
  include/net-common.h                          |  9 ++--
  include/net-legacy.h                          |  1 +
  include/net6.h                                |  1 +
  net/net-common.c                              |  6 +++
  net/pcap.c                                    |  1 +
  23 files changed, 53 insertions(+), 27 deletions(-)
Quoted 8 lines
Quoted 2 lines

There are no fs changes in this series , what does this series have to do with exfat ?

I found that in some situations, the exfat code includes linux/byteorder.h instead of its own local byteorder, which is implemented differently. This then causes build errors in the exfat code. One way to trigger it is by adding '#include net.h' to include/efi.h

Quoted 7 lines

Setting aside if it's a good idea to have efi.h include net.h, we should unwind what the heck is going on. The build error is on CLUSTER_INVALID somehow becoming weird. Looking harder at this, the problem I see is that include/fs.h includes <rtc.h> (which in turn pulls in many things) when it only needs <rtc_defs.h> for struct rtc_time. This however exposes some other implicit includes. I'll go and take a look at hunting these all down.

Quoted 1 line

OK. I wonder if we could drop the special byteorder macros in exfat?

Potentially. I'll leave it to Marek to comment on how much pain and future pain that might cause.

Signature · 1 line
Tom