Idwer Vollering has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- M src/commonlib/bsd/lz4_wrapper.c 1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/1
diff --git a/src/commonlib/bsd/lz4_wrapper.c b/src/commonlib/bsd/lz4_wrapper.c index 2367afc..d07fc98 100644 --- a/src/commonlib/bsd/lz4_wrapper.c +++ b/src/commonlib/bsd/lz4_wrapper.c @@ -2,7 +2,11 @@
#include <commonlib/bsd/compression.h> #include <commonlib/bsd/helpers.h> +#if defined(__FreeBSD__) +#include <sys/endian.h> +#else #include <endian.h> +#endif #include <stdint.h> #include <string.h>
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1: Code-Review+2
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1: Code-Review-1
Sorry for breaking your build and we should definitely get it fixed, but I'm not really sure this is a great solution. As we add more files to commonlib I wouldn't really want every single one of them be littered with #ifdef __FreeBSD__ guards.
Would it be too hacky if we just add a -I/usr/include/sys into the cbfstool TOOLCPPFLAGS (maybe guarded by a check for FreeBSD)? I don't think it should do much harm.
Alternatively, I'd propose to centralize all these includes in a <commonlib/bsd/sysincludes.h> header so we only need all the #ifdef stuff in a single file.
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Patch Set 1: Code-Review-1
Sorry for breaking your build and we should definitely get it fixed, but I'm not really sure this is a great solution. As we add more files to commonlib I wouldn't really want every single one of them be littered with #ifdef __FreeBSD__ guards.
Would it be too hacky if we just add a -I/usr/include/sys into the cbfstool TOOLCPPFLAGS (maybe guarded by a check for FreeBSD)? I don't think it should do much harm.
Alternatively, I'd propose to centralize all these includes in a <commonlib/bsd/sysincludes.h> header so we only need all the #ifdef stuff in a single file.
I'm open for suggestions. So far, adding 'TOOLCPPFLAGS += -include /usr/include/sys/endian.h' and/or 'TOOLCPPFLAGS += -I/usr/include/sys' while leaving lz4_wrapper.c (where it had the ifdef guard to use sys/endian.h instead) untouched seems to not be working.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
I'm open for suggestions. So far, adding 'TOOLCPPFLAGS += -include /usr/include/sys/endian.h' and/or 'TOOLCPPFLAGS += -I/usr/include/sys' while leaving lz4_wrapper.c (where it had the ifdef guard to use sys/endian.h instead) untouched seems to not be working.
Well, the first one wouldn't work because you still have an #include it can't resolve. I'd expect the second one to work, though. What's the error message? (Do you have /usr/include/sys/endian.h on your system or is it somewhere else?)
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Patch Set 1:
I'm open for suggestions. So far, adding 'TOOLCPPFLAGS += -include /usr/include/sys/endian.h' and/or 'TOOLCPPFLAGS += -I/usr/include/sys' while leaving lz4_wrapper.c (where it had the ifdef guard to use sys/endian.h instead) untouched seems to not be working.
Well, the first one wouldn't work because you still have an #include it can't resolve.
I would expect directly including this .h to work.
I'd expect the second one to work, though. What's the error message? (Do you have /usr/include/sys/endian.h on your system or is it somewhere else?)
$ find /usr/include -name endian.h -exec grep le32toh {} + /usr/include/sys/endian.h:#define le32toh(x) ((uint32_t)(x)) /usr/include/sys/endian.h:#define le32toh(x) bswap32((x))
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Patch Set 1:
I'm open for suggestions. So far, adding 'TOOLCPPFLAGS += -include /usr/include/sys/endian.h' and/or 'TOOLCPPFLAGS += -I/usr/include/sys' while leaving lz4_wrapper.c (where it had the ifdef guard to use sys/endian.h instead) untouched seems to not be working.
Well, the first one wouldn't work because you still have an #include it can't resolve.
I would expect directly including this .h to work.
I'd expect the second one to work, though. What's the error message? (Do you have /usr/include/sys/endian.h on your system or is it somewhere else?)
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Please post your error messages for both cases so we can try to figure out why it doesn't work.
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Patch Set 1:
Please post your error messages for both cases so we can try to figure out why it doesn't work.
HOSTCC cbfstool/lz4_wrapper.o /usr/home/idwer/github.com/coreboot/coreboot/src/commonlib/bsd/lz4_wrapper.c:5:10: fatal error: 'endian.h' file not found #include <endian.h> ^~~~~~~~~~
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Patch Set 1:
Patch Set 1:
Please post your error messages for both cases so we can try to figure out why it doesn't work.
HOSTCC cbfstool/lz4_wrapper.o
/usr/home/idwer/github.com/coreboot/coreboot/src/commonlib/bsd/lz4_wrapper.c:5:10: fatal error: 'endian.h' file not found #include <endian.h> ^~~~~~~~~~
Would it be a cursed idea to wrap endian header inclusions in something like `os_endian.h` ?
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 1:
Patch Set 1:
Patch Set 1:
Patch Set 1:
Please post your error messages for both cases so we can try to figure out why it doesn't work.
HOSTCC cbfstool/lz4_wrapper.o
/usr/home/idwer/github.com/coreboot/coreboot/src/commonlib/bsd/lz4_wrapper.c:5:10: fatal error: 'endian.h' file not found #include <endian.h> ^~~~~~~~~~
Would it be a cursed idea to wrap endian header inclusions in something like `os_endian.h` ?
os_endian.h could confuse dyslexics. Let's go with sysincludes.h
Hello Julius Werner, build bot (Jenkins), Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38648
to look at the new patch set (#2).
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- A src/commonlib/bsd/include/commonlib/bsd/sysincludes.h M src/commonlib/bsd/lz4_wrapper.c 2 files changed, 6 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/2
Hello Julius Werner, build bot (Jenkins), Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38648
to look at the new patch set (#3).
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- A src/commonlib/bsd/include/commonlib/bsd/sysincludes.h M src/commonlib/bsd/lz4_wrapper.c 2 files changed, 8 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/3
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 3:
(1 comment)
HOSTCC cbfstool/lz4_wrapper.o
/usr/home/idwer/github.com/coreboot/coreboot/src/commonlib/bsd/lz4_wrapper.c:5:10: fatal error: 'endian.h' file not found #include <endian.h> ^~~~~~~~~~
It does that even with the -I/usr/include/sys, when you have a /usr/include/sys/endian.h? Strange...
Well, I guess there's nothing wrong with doing the sysincludes thing to fix it.
https://review.coreboot.org/c/coreboot/+/38648/2/src/commonlib/bsd/include/c... File src/commonlib/bsd/include/commonlib/bsd/sysincludes.h:
https://review.coreboot.org/c/coreboot/+/38648/2/src/commonlib/bsd/include/c... PS2, Line 5: #endif If we're doing this I'd suggest we do it for all system includes in commonlib/bsd (e.g. <assert.h>, <endian.h>, <stdbool.h>, <stddef.h>, <stdint.h> and <string.h>), and include it from all those files in place of the individual headers.
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38648/3/src/commonlib/bsd/lz4_wrapp... File src/commonlib/bsd/lz4_wrapper.c:
https://review.coreboot.org/c/coreboot/+/38648/3/src/commonlib/bsd/lz4_wrapp... PS3, Line 5: sysincludes why not endian.h? Otherwise we'd have to put in the kitchen sink to cover all "sys includes" (as per Julius' proposal)
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 3:
That would work. Current vboot is a mess, I think, because there are lots of linuxisms.
Hello build bot (Jenkins), Patrick Georgi, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38648
to look at the new patch set (#4).
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- M src/commonlib/bsd/lz4_wrapper.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/4
Hello build bot (Jenkins), Patrick Georgi, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38648
to look at the new patch set (#5).
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- A src/commonlib/bsd/include/commonlib/bsd/endian.h M src/commonlib/bsd/lz4_wrapper.c 2 files changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/5
Hello build bot (Jenkins), Patrick Georgi, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38648
to look at the new patch set (#7).
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- A src/commonlib/bsd/include/commonlib/bsd/endian.h M src/commonlib/bsd/lz4_wrapper.c 2 files changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/7
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 7: Code-Review+2
Hmm... I preferred the sysincludes one, because otherwise the next time we'll have this problem we'll need to add another header, and then another, and the environment-specific hacks will be all over the place. I think it would be cleaner to keep them all in one file. But either works.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 7: Code-Review+2
Hello build bot (Jenkins), Patrick Georgi, Angel Pons, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38648
to look at the new patch set (#9).
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com --- A src/commonlib/bsd/include/commonlib/bsd/sysincludes.h M src/commonlib/bsd/lz4_wrapper.c 2 files changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/38648/9
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 9: Code-Review+2
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 10: Code-Review+2
Idwer Vollering has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 10:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38648/2/src/commonlib/bsd/include/c... File src/commonlib/bsd/include/commonlib/bsd/sysincludes.h:
https://review.coreboot.org/c/coreboot/+/38648/2/src/commonlib/bsd/include/c... PS2, Line 5: #endif
If we're doing this I'd suggest we do it for all system includes in commonlib/bsd (e.g. <assert. […]
Done
https://review.coreboot.org/c/coreboot/+/38648/3/src/commonlib/bsd/lz4_wrapp... File src/commonlib/bsd/lz4_wrapper.c:
https://review.coreboot.org/c/coreboot/+/38648/3/src/commonlib/bsd/lz4_wrapp... PS3, Line 5: sysincludes
why not endian. […]
Ack
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
util/cbfstool: extend includes in commonlib
Certain non-Linux OSes require an include file in different places.
Build tested on Linux, FreeBSD.
Change-Id: Icd81c2a96c608589ce2ec8f4b883fd4e584776b1 Signed-off-by: Idwer Vollering vidwer@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38648 Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Julius Werner jwerner@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- A src/commonlib/bsd/include/commonlib/bsd/sysincludes.h M src/commonlib/bsd/lz4_wrapper.c 2 files changed, 7 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Angel Pons: Looks good to me, approved
diff --git a/src/commonlib/bsd/include/commonlib/bsd/sysincludes.h b/src/commonlib/bsd/include/commonlib/bsd/sysincludes.h new file mode 100644 index 0000000..3a87cda --- /dev/null +++ b/src/commonlib/bsd/include/commonlib/bsd/sysincludes.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only */ +#if defined(__FreeBSD__) +#include <sys/endian.h> +#else +#include <endian.h> +#endif diff --git a/src/commonlib/bsd/lz4_wrapper.c b/src/commonlib/bsd/lz4_wrapper.c index 3822e8c..73185a5 100644 --- a/src/commonlib/bsd/lz4_wrapper.c +++ b/src/commonlib/bsd/lz4_wrapper.c @@ -2,7 +2,7 @@
#include <commonlib/bsd/compression.h> #include <commonlib/bsd/helpers.h> -#include <endian.h> +#include <commonlib/bsd/sysincludes.h> #include <stdint.h> #include <string.h>
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38648 )
Change subject: util/cbfstool: extend includes in commonlib ......................................................................
Patch Set 11:
Automatic boot test returned (PASS/FAIL/TOTAL): 8/1/9 "QEMU x86 q35/ich9" (x86_32) using payload TianoCore : SUCCESS : https://lava.9esec.io/r/19211 "QEMU x86 q35/ich9" (x86_32) using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/19210 "QEMU x86 i440fx/piix4" (x86_64) using payload SeaBIOS : FAIL : https://lava.9esec.io/r/19209 "QEMU x86 i440fx/piix4" (x86_32) using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/19208 "QEMU AArch64" using payload LinuxBoot_u-root_kexec : SUCCESS : https://lava.9esec.io/r/19207 "HP Z220 SFF Workstation" (x86_32) using payload LinuxBoot_BusyBox_kexec : SUCCESS : https://lava.9esec.io/r/19215 "HP Z220 SFF Workstation" (x86_32) using payload LinuxBoot_BusyBox_kexec : SUCCESS : https://lava.9esec.io/r/19214 "HP Compaq 8200 Elite SFF PC" (x86_32) using payload TianoCore : SUCCESS : https://lava.9esec.io/r/19213 "HP Compaq 8200 Elite SFF PC" (x86_32) using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/19212
Please note: This test is under development and might not be accurate at all!