Skip to contentSkip to conversation

fdt: Ensure that libfdt_env.h comes from U-Boot

PATCH New Simon Glass 4 participants 6 messages Mar 11, 2013 – Jun 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: Ensure that libfdt_env.h comes from U-Boot

When building host utilities, we include libfdt.h from the host, not from U-Boot. This in turn brings in libfdt_env.h from the host, which can mess up the types and cause a build failure, depending on the host environment. To fix this, force inclusion of U-Boot's libfdt_env.h so that the types are correct.

Another way to fix this is to use -nostdinc and -idirafter to ensure that system includes are included after U-Boot ones. Unfortunately this means that U-Boot's errno.h gets included instead of the system one. This in turn requires a hack to errno.h to redirect things, so all in all the solution in this patch is probably cleaner.

---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/Makefile +2 -1
index c5952fc..889c897 100644
@@ -164,7 +164,8 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y))
 # Use native tools and options
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
-HOSTCPPFLAGS =	-idirafter $(SRCTREE)/include \
+HOSTCPPFLAGS =	-include $(SRCTREE)/include/libfdt_env.h \
+		-idirafter $(SRCTREE)/include \
 		-idirafter $(OBJTREE)/include2 \
 		-idirafter $(OBJTREE)/include \
 	        -I $(SRCTREE)/lib/libfdt \
Signature · 1 line
1.8.1.3
#1 lore raw

PATCH 1/1 fdt: Ensure that libfdt_env.h comes from U-Boot

Hi Tom / Jerry,

Quoted 32 lines · Simon Glass

When building host utilities, we include libfdt.h from the host, not from U-Boot. This in turn brings in libfdt_env.h from the host, which can mess up the types and cause a build failure, depending on the host environment. To fix this, force inclusion of U-Boot's libfdt_env.h so that the types are correct.

Another way to fix this is to use -nostdinc and -idirafter to ensure that system includes are included after U-Boot ones. Unfortunately this means that U-Boot's errno.h gets included instead of the system one. This in turn requires a hack to errno.h to redirect things, so all in all the solution in this patch is probably cleaner.

---
 tools/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/Makefile +2 -2
index c5952fc..889c897 100644
@@ -164,7 +164,8 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y))
 # Use native tools and options
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
-HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
+HOSTCPPFLAGS = -include $(SRCTREE)/include/libfdt_env.h \
+               -idirafter $(SRCTREE)/include \
                -idirafter $(OBJTREE)/include2 \
                -idirafter $(OBJTREE)/include \
                -I $(SRCTREE)/lib/libfdt \
--
Quoted 2 lines

1.8.1.3

This is a very late patch, and I'm not 100% sure this is the best way to fix it. But with the upstream dtc package we get these errors without it:

Configuring for smdk5250 board...
In file included from fdt_host.h:24:0,

                 from mkimage.h:35,
                 from aisimage.c:27:

../include/libfdt.h: In function ?fdt_setprop_inplace_u32?:
../include/libfdt.h:885:2: error: unknown type name ?fdt32_t? ../include/libfdt.h: In function ?fdt_setprop_inplace_u64?:
../include/libfdt.h:920:2: error: unknown type name ?fdt64_t? ../include/libfdt.h: In function ?fdt_property_u32?:
../include/libfdt.h:996:2: error: unknown type name ?fdt32_t? ../include/libfdt.h: In function ?fdt_property_u64?:
../include/libfdt.h:1001:2: error: unknown type name ?fdt64_t? ../include/libfdt.h: In function ?fdt_setprop_u32?:
../include/libfdt.h:1157:2: error: unknown type name ?fdt32_t? ../include/libfdt.h: In function ?fdt_setprop_u64?:
../include/libfdt.h:1192:2: error: unknown type name ?fdt64_t? ../include/libfdt.h: In function ?fdt_appendprop_u32?:
../include/libfdt.h:1299:2: error: unknown type name ?fdt32_t? ../include/libfdt.h: In function ?fdt_appendprop_u64?:
../include/libfdt.h:1334:2: error: unknown type name ?fdt64_t?

Can this be considered for the release please?

Regards,
Simon

#2 lore raw

PATCH 1/1 fdt: Ensure that libfdt_env.h comes from U-Boot

Hi Simon,

Quoted 1 line · Simon Glass

Hi Tom / Jerry,

[snip]

Quoted 5 lines
Quoted 5 lines

Another way to fix this is to use -nostdinc and -idirafter to ensure that system includes are included after U-Boot ones. Unfortunately this means that U-Boot's errno.h gets included instead of the system one. This in turn requires a hack to errno.h to redirect things, so all in all the solution in this patch is probably cleaner.

[snip]

Quoted 1 line

Can this be considered for the release please?

This appears to be a reasonable request to fix an outstanding bug. I don't have time today or tomorrow, but I'll pull in your patch and move it forward, Tom willing.

Quoted 2 lines

Regards,
Simon

Thanks,
gvb

#3 lore raw

PATCH 1/1 fdt: Ensure that libfdt_env.h comes from U-Boot

In reply to Simon Glass
Quoted 6 lines · Simon Glass

When building host utilities, we include libfdt.h from the host, not from U-Boot. This in turn brings in libfdt_env.h from the host, which can mess up the types and cause a build failure, depending on the host environment. To fix this, force inclusion of U-Boot's libfdt_env.h so that the types are correct.

Quoted 7 lines

Another way to fix this is to use -nostdinc and -idirafter to ensure that system includes are included after U-Boot ones. Unfortunately this means that U-Boot's errno.h gets included instead of the system one. This in turn requires a hack to errno.h to redirect things, so all in all the solution in this patch is probably cleaner.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130417/afe4033a/attachment.pgp>
#4 lore raw

PATCH 1/1 fdt: Ensure that libfdt_env.h comes from U-Boot

Hi Simon,

Quoted 14 lines · Tom Rini
Quoted 12 lines · Simon Glass

When building host utilities, we include libfdt.h from the host, not from U-Boot. This in turn brings in libfdt_env.h from the host, which can mess up the types and cause a build failure, depending on the host environment. To fix this, force inclusion of U-Boot's libfdt_env.h so that the types are correct.

Another way to fix this is to use -nostdinc and -idirafter to ensure that system includes are included after U-Boot ones. Unfortunately this means that U-Boot's errno.h gets included instead of the system one. This in turn requires a hack to errno.h to redirect things, so all in all the solution in this patch is probably cleaner.

Quoted 6 lines
Quoted 1 line

Applied to u-boot/master, thanks!

--
Tom

For me this patch causes a regression that looks like this:

Configuring for sandbox board...
aisimage.c: In function ?aisimage_generate?:
aisimage.c:314: warning: implicit declaration of function ?getline? imximage.c: In function ?parse_cfg_file?:
imximage.c:424: warning: implicit declaration of function ?getline? kwbimage.c: In function ?kwdimage_set_ext_header?:
kwbimage.c:236: warning: implicit declaration of function ?getline? pblimage.c: In function ?pbl_parser?:
pblimage.c:119: warning: implicit declaration of function ?getline? ublimage.c: In function ?parse_cfg_file?:
ublimage.c:179: warning: implicit declaration of function ?getline?

Did you not see this? I see it on ARM, PPC, and sandbox.

-Joe

#5 lore raw

PATCH 1/1 fdt: Ensure that libfdt_env.h comes from U-Boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 38 lines · Joe Hershberger

Hi Simon,

Quoted 16 lines · Tom Rini
Quoted 14 lines · Simon Glass

When building host utilities, we include libfdt.h from the host, not from U-Boot. This in turn brings in libfdt_env.h from the host, which can mess up the types and cause a build failure, depending on the host environment. To fix this, force inclusion of U-Boot's libfdt_env.h so that the types are correct.

Another way to fix this is to use -nostdinc and -idirafter to ensure that system includes are included after U-Boot ones. Unfortunately this means that U-Boot's errno.h gets included instead of the system one. This in turn requires a hack to errno.h to redirect things, so all in all the solution in this patch is probably cleaner.

Quoted 5 lines
Quoted 1 line

Applied to u-boot/master, thanks!

-- Tom

For me this patch causes a regression that looks like this:

Configuring for sandbox board... aisimage.c: In function ?aisimage_generate?: aisimage.c:314: warning: implicit declaration of function ?getline? imximage.c: In function ?parse_cfg_file?:
imximage.c:424: warning: implicit declaration of function ?getline? kwbimage.c: In function ?kwdimage_set_ext_header?:
kwbimage.c:236: warning: implicit declaration of function ?getline? pblimage.c: In function ?pbl_parser?: pblimage.c:119:
warning: implicit declaration of function ?getline? ublimage.c: In function ?parse_cfg_file?: ublimage.c:179: warning: implicit declaration of function ?getline?

Quoted 1 line

Did you not see this? I see it on ARM, PPC, and sandbox.

Nope. What toolchains?

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRuzGcAAoJENk4IS6UOR1W2KEP/Roaf4ewQxnpag59QdHHy7GJ FaMHOA36GbjLt8ay4KaEfFazxpmJiVPWApEt5RkbKICa8sYot6X+nmcOhLMau46t /mSx5ig6NMQeCvVmFvppRmBdJvew1dfxGiIAXd8GEAQQgDQsJ18KS0qOOyr9UlUI o+z6unVXybQQgsijiQaph2uhIkV2Fo5wUY2JrNzbHDepjHgKkfS+6CeIRxJE7+yr sCyn5hAAWDBIUR3Xlqw2pfrWPCNJNORSQhWtfMNVQbf1PFUYEv4U008QldsaR1qF AcXZv7tzXahJYYqQTKuEGIdO9Ed9Ij3eJ+oPg5guZ5+6PYoX8ZLAyOKEtp/hdFs6 bHXdj5URUzv1bW81p4Hsuk+O+h1izIgqeUqfzTQfnZucgCPl87HVsevdA2N22deC 2PuM8vvEdl0UgJmwd9fFyrUYXzE+xzOLf3XRXVwOWtKrQUl8WE6FMmkGfAWLQNNx LbXwmyQKXOPM1YAM+P7mxEk4L7gpeRF/r+uARBJ36Oi1RtY4zM16FYT25cOoppuL aFCssOuxL02WiX4q9EWZ8sGtJ9H6c5Dz/oFMwWmse9i+QNMnLGpoS4m6imnDJw26 yju4fIztjajAJN+dFV5J9CJHp2ddon3sa+6Sdn7aEBrCUgjU0Zi9ne+Ge+UghoRG 3fHhQNqmvtq0OgrCmLPY
=+4Fc
-----END PGP SIGNATURE-----