Skip to contentSkip to conversation

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

U-Boot New Loïc Minier 3 participants 6 messages Feb 7, 2011 – Apr 12, 2011

lore
Share & tools
lore
#0 lore raw

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&ver=2010.12-2&stamp=1295512921&file=log&as=raw

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,

Signature · 1 line
Lo?c Minier
#1 lore raw

Dear =?iso-8859-1?Q?Lo=EFc?= Minier,

Quoted 3 lines · In message <[email protected]> you wrote:

"make tools-all" fails under Debian kfreebsd-amd64 and -i386 due to the lack of MTD headers:

...

Quoted 1 line

I didn't find any MTD header in the kfreebsd package.

Eventually FreeBSD uses a different mechanism to access flash devices.

Quoted 1 line

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.

Quoted 6 lines

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

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
1st Old Man:  Gee, its windy today.
2nd Old Man:  No it's not... it's Thursday.
3rd Old Man:  Yeh, me too.  Let's go for a beer.
#2 lore raw
Quoted 5 lines · Wolfgang Denk
Quoted 2 lines

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)

Signature · 1 line
Lo?c Minier
#3 lore raw

PATCH 1/1 Only build fw_printenv if we have mtd/mtd-user.h

In reply to Wolfgang Denk

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(-)
tools/env/Makefile +11 -0
index 2f7a59c..294bb95 100644
@@ -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)
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 1/1 Only build fw_printenv if we have mtd/mtd-user.h

Dear =?UTF-8?q?Lo=C3=AFc=20Minier?=,

Quoted 4 lines · In message <[email protected]> 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...]

Quoted 4 lines

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

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Writing a book is like washing an elephant: there's no good place  to
begin  or  end,  and  it's  hard to keep track of what you've already
covered.
#5 lore raw

PATCH 1/1 Only build fw_printenv if we have mtd/mtd-user.h

Quoted 2 lines · Wolfgang Denk

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)

Quoted 4 lines
Quoted 3 lines

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.

Signature · 1 line
Lo?c Minier