From: Wolfgang Denk Date: Mon, 20 Oct 2008 09:23:41 +0200 Subject: [U-Boot] FDT include file problems In-Reply-To: <20081020031023.GA18173@cideas.com> References: <20081019220159.CB9F8835697A@gemini.denx.de> <20081020031023.GA18173@cideas.com> Message-ID: <20081020072341.BC464835697A@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Jerry Van Baren, In message <20081020031023.GA18173@cideas.com> you wrote: > > > ... > > In file included from /home/wd/git/u-boot/include/libfdt_env.h:33, > > from fdt.c:51: > > /usr/include/asm/byteorder.h:6:2: warning: #warning using private kernel header; include instead! ... > Does this work better? Not really: > From 0d33fb368acac6f88c0940ff2d1c77856900abcd Mon Sep 17 00:00:00 2001 > From: Gerald Van Baren > Date: Sun, 19 Oct 2008 22:50:07 -0400 > Subject: [PATCH] libfdt: Use endian.h instead of asm/byteorder.h > > Using asm/byteorder.h directly is strongly discouraged since it is a > private kernel header. Hm... but you still use it? > Signed-off-by: Gerald Van Baren > --- > include/libfdt_env.h | 15 +++++++++++---- > 1 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/include/libfdt_env.h b/include/libfdt_env.h > index 671c3a8..728a248 100644 > --- a/include/libfdt_env.h > +++ b/include/libfdt_env.h > @@ -33,10 +33,17 @@ > #include ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This has not changed? > extern struct fdt_header *working_fdt; /* Pointer to the working fdt */ > > -#define fdt32_to_cpu(x) __be32_to_cpu(x) > -#define cpu_to_fdt32(x) __cpu_to_be32(x) > -#define fdt64_to_cpu(x) __be64_to_cpu(x) > -#define cpu_to_fdt64(x) __cpu_to_be64(x) > +#if __BYTE_ORDER == __LITTLE_ENDIAN > +#define fdt32_to_cpu(x) __swab32(x) > +#define cpu_to_fdt32(x) __swab32(x) > +#define fdt64_to_cpu(x) __swab64(x) > +#define cpu_to_fdt64(x) __swab64(x) > +#else > +#define fdt32_to_cpu(x) (x) > +#define cpu_to_fdt32(x) (x) > +#define fdt64_to_cpu(x) (x) > +#define cpu_to_fdt64(x) (x) > +#endif If I change the code to include only for the U-Boot code but use , I get warnings: ../include/libfdt.h:162: warning: implicit declaration of function '__swab32' and finally a "undefined reference to `__swab32'" error. Seems __swab32 and __swab64 are defined only in linux/byteorder/swab.h 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 "One day," said a dull voice from down below, "I'm going to be back in form again and you're going to be very sorry you said that. For a very long time. I might even go so far as to make even more Time just for you to be sorry in." - Terry Pratchett, _Small Gods_