[U-Boot] kfreebsd build failure - fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory

Hey
"make tools-all" fails under Debian kfreebsd-amd64 and -i386 due to the lack of MTD headers: make[2]: Entering directory `/build/buildd-u-boot_2010.12-2-kfreebsd-i386-yWW1BA/u-boot-2010.12/tools/env' gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter /build/buildd-u-boot_2010.12-2-kfreebsd-i386-yWW1BA/u-boot-2010.12/include -idirafter /build/buildd-u-boot_2010.12-2-kfreebsd-i386-yWW1BA/u-boot-2010.12/include2 -idirafter /build/buildd-u-boot_2010.12-2-kfreebsd-i386-yWW1BA/u-boot-2010.12/include -DUSE_HOSTCC -o fw_printenv crc32.c fw_env.c fw_env_main.c fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory [...] https://buildd.debian.org/fetch.cgi?pkg=u-boot&arch=kfreebsd-i386&ve...
I didn't find any MTD header in the kfreebsd package.
Would someone know whether this is supposed to build under freebsd?
If not, does it make sense to ifdef out the MTD uses in fw_env.c? (I think it's also possible to interact with real files containing the environment.)
If not, I guess this should be removed from tools-all is mtd/mtd-user.h isn't found; is there any recommendation in doing this?
Cheers,

Dear =?iso-8859-1?Q?Lo=EFc?= Minier,
In message 20110207210900.GA5848@bee.dooz.org you wrote:
"make tools-all" fails under Debian kfreebsd-amd64 and -i386 due to the lack of MTD headers:
...
I didn't find any MTD header in the kfreebsd package.
Eventually FreeBSD uses a different mechanism to access flash devices.
Would someone know whether this is supposed to build under freebsd?
Probably not. The whole design is Linux based - this also applies to the "mtdparts" concept used to define and edit flash devices and partitions in U-Boot, which then passes a suitable "mtdargs" boot argument to the Linux kernel. I doubt that FreeBSD uses a compatible implementation.
If not, does it make sense to ifdef out the MTD uses in fw_env.c? (I think it's also possible to interact with real files containing the environment.)
If not, I guess this should be removed from tools-all is mtd/mtd-user.h isn't found; is there any recommendation in doing this?
Even if you are building in a *BSD environment, you could still be building for a Linux target system. After all, the fw_env.* tools are target tools, which should not depend on the host environment.
Best regards,
Wolfgang Denk

On Mon, Feb 07, 2011, Wolfgang Denk wrote:
If not, I guess this should be removed from tools-all is mtd/mtd-user.h isn't found; is there any recommendation in doing this?
Even if you are building in a *BSD environment, you could still be building for a Linux target system. After all, the fw_env.* tools are target tools, which should not depend on the host environment.
Yes; I mean if this target header is not found (if you're cross-building, you should have the headers for your target)
(BTW, some tools are kind of both host and target tools, like mkimage which might be used during the build but are also interesting to build for the target architecture. Ideally when cross-compiling these should be built twice, but I realize it's a pain to implement)

mtd/mtd-user.h is missing on FreeBSD hosts; add a macro to test whether a specific host header is present and use it to decide to build fw_printenv if mtd/mtd-user.h is present. ---
How about this approach?
If it's ok, then I could extend it to handle the MTD_VERSION=old case as well, perhaps replacing this MTD_VERSION with a test for linux/mtd/mtd.h.
I would have preferred putting this in /Makefile to disable the make -C tools/env altogether, but config.mk isn't included by default so HOSTCC isn't available for the test.
tools/env/Makefile | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/tools/env/Makefile b/tools/env/Makefile index 2f7a59c..294bb95 100644 --- a/tools/env/Makefile +++ b/tools/env/Makefile @@ -36,7 +36,18 @@ ifeq ($(MTD_VERSION),old) HOSTCPPFLAGS += -DMTD_OLD endif
+# macro to check whether a host header is present; outputs 1 if present, 0 if +# not +check_include = $(shell echo | $(HOSTCC) $(HOSTCFLAGS_NOPED) -E -include $(1) -o /dev/null - 2>/dev/null && echo 1 || echo 0) + +# whether to build tools/env or not +has_mtd_user := $(call check_include, mtd/mtd-user.h) + +ifeq ($(has_mtd_user),1) all: $(obj)fw_printenv +else +all: +endif
# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED $(obj)fw_printenv: $(HOSTSRCS) $(HEADERS)

Dear =?UTF-8?q?Lo=C3=AFc=20Minier?=,
In message 1297120981-29885-1-git-send-email-loic.minier@linaro.org you wrote:
mtd/mtd-user.h is missing on FreeBSD hosts; add a macro to test whether a specific host header is present and use it to decide to build fw_printenv if mtd/mtd-user.h is present.
Sorry for the delay.
I understand thi is just a RFC, not a patch (yet) intended for inclusion? [In that case it would miss your SoB line...]
How about this approach?
If it's ok, then I could extend it to handle the MTD_VERSION=old case as well, perhaps replacing this MTD_VERSION with a test for linux/mtd/mtd.h.
I'm fine with that. Thanks!
Best regards,
Wolfgang Denk

On Tue, Apr 12, 2011, Wolfgang Denk wrote:
I understand thi is just a RFC, not a patch (yet) intended for inclusion? [In that case it would miss your SoB line...]
Correct! was just a RFC (albeit I did include it in the Debian packaging for now, until we have an upstreamable way of doing it)
How about this approach? If it's ok, then I could extend it to handle the MTD_VERSION=old case as well, perhaps replacing this MTD_VERSION with a test for linux/mtd/mtd.h.
I'm fine with that. Thanks!
Ok, will resubmit; thanks for the comment :-)
I'll likely replace MTD_OLD with similar logic and hence avoid passing it down; it will just be autodetected.
participants (3)
-
Loïc Minier
-
Loïc Minier
-
Wolfgang Denk