public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] kfreebsd build failure - fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory
@ 2011-02-07 21:09 Loïc Minier
  2011-02-07 22:06 ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Loïc Minier @ 2011-02-07 21:09 UTC (permalink / raw)
  To: u-boot

        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,
-- 
Lo?c Minier

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] kfreebsd build failure - fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory
  2011-02-07 21:09 [U-Boot] kfreebsd build failure - fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory Loïc Minier
@ 2011-02-07 22:06 ` Wolfgang Denk
  2011-02-07 22:23   ` Loïc Minier
  2011-02-07 23:23   ` [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h Loïc Minier
  0 siblings, 2 replies; 6+ messages in thread
From: Wolfgang Denk @ 2011-02-07 22:06 UTC (permalink / raw)
  To: u-boot

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

-- 
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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] kfreebsd build failure - fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory
  2011-02-07 22:06 ` Wolfgang Denk
@ 2011-02-07 22:23   ` Loïc Minier
  2011-02-07 23:23   ` [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h Loïc Minier
  1 sibling, 0 replies; 6+ messages in thread
From: Loïc Minier @ 2011-02-07 22:23 UTC (permalink / raw)
  To: u-boot

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)

-- 
Lo?c Minier

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h
  2011-02-07 22:06 ` Wolfgang Denk
  2011-02-07 22:23   ` Loïc Minier
@ 2011-02-07 23:23   ` Loïc Minier
  2011-04-12 19:27     ` Wolfgang Denk
  1 sibling, 1 reply; 6+ messages in thread
From: Loïc Minier @ 2011-02-07 23:23 UTC (permalink / raw)
  To: u-boot

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)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h
  2011-02-07 23:23   ` [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h Loïc Minier
@ 2011-04-12 19:27     ` Wolfgang Denk
  2011-04-12 19:46       ` Loïc Minier
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2011-04-12 19:27 UTC (permalink / raw)
  To: u-boot

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

-- 
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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h
  2011-04-12 19:27     ` Wolfgang Denk
@ 2011-04-12 19:46       ` Loïc Minier
  0 siblings, 0 replies; 6+ messages in thread
From: Loïc Minier @ 2011-04-12 19:46 UTC (permalink / raw)
  To: u-boot

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.

-- 
Lo?c Minier

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-12 19:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07 21:09 [U-Boot] kfreebsd build failure - fw_env.c:43:27: error: mtd/mtd-user.h: No such file or directory Loïc Minier
2011-02-07 22:06 ` Wolfgang Denk
2011-02-07 22:23   ` Loïc Minier
2011-02-07 23:23   ` [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h Loïc Minier
2011-04-12 19:27     ` Wolfgang Denk
2011-04-12 19:46       ` Loïc Minier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox