* [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h
@ 2013-05-22 1:50 peter.crosthwaite
2013-05-22 7:47 ` Edgar E. Iglesias
0 siblings, 1 reply; 4+ messages in thread
From: peter.crosthwaite @ 2013-05-22 1:50 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, pbonzini, edgar.iglesias
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Currently QEMU provides a local clone of the file libfdt_env.h in
/include. This file is supposed to come with the libfdt package and is
only needed for broken installs of libfdt. Unfortunately, libfdt 1.3
stable is tagged with this bug so we cant realistically remove the
clone. So instead, use a configure time probe - check to see if the
host is already providing this file, and if so, don't use QEMUs
local clone of libfdt.h.
Moved include/libfdt_env.h to include/libfdt/libfdt_env.h so it can be
treated as a special case.
For newer (development) versions of libfdt this probe will succeed and
include/libfdt/libfdt_env.h will simply be ignored.
For older versions -Iinclude/libfdt will be added to CFLAGS.
Manifests as a bug when building QEMU with modern libfdt. The new
version of libfdt does not compile when QEMUs libfdt_env.h takes
precedence over the hosts.
Reported-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
To replicate bug (install latest dtc from src to host and make):
git submodule update --init dtc
cd dtc
git checkout master
make
sudo make install PREFIX=/usr/local
cd ..
./configure --target-list="arm-softmmu" --enable-fdt
make
configure | 14 ++++++++++++++
include/libfdt/libfdt_env.h | 36 ++++++++++++++++++++++++++++++++++++
include/libfdt_env.h | 36 ------------------------------------
3 files changed, 50 insertions(+), 36 deletions(-)
create mode 100644 include/libfdt/libfdt_env.h
delete mode 100644 include/libfdt_env.h
diff --git a/configure b/configure
index 5ae7e4a..f59c49b 100755
--- a/configure
+++ b/configure
@@ -2550,6 +2550,20 @@ EOF
fi
fi
+##########################################
+# libfdt_env.h probe
+
+if test "$fdt" == "yes" ; then
+ cat > $TMPC << EOF
+#include <libfdt_env.h>
+int main(void) { return 0; }
+EOF
+ if ! compile_prog "" "$fdt_libs" ; then
+ #system libfdt_env is bad - use QEMUs inbuilt snapshot
+ fdt_cflags="-I\$(SRC_PATH)/include/libfdt $fdt_cflags"
+ fi
+fi
+
libs_softmmu="$libs_softmmu $fdt_libs"
##########################################
diff --git a/include/libfdt/libfdt_env.h b/include/libfdt/libfdt_env.h
new file mode 100644
index 0000000..3667d4c
--- /dev/null
+++ b/include/libfdt/libfdt_env.h
@@ -0,0 +1,36 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright IBM Corp. 2008
+ * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+ *
+ */
+
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include "qemu/bswap.h"
+
+#ifdef HOST_WORDS_BIGENDIAN
+#define fdt32_to_cpu(x) (x)
+#define cpu_to_fdt32(x) (x)
+#define fdt64_to_cpu(x) (x)
+#define cpu_to_fdt64(x) (x)
+#else
+#define fdt32_to_cpu(x) bswap32(x)
+#define cpu_to_fdt32(x) bswap32(x)
+#define fdt64_to_cpu(x) bswap64(x)
+#define cpu_to_fdt64(x) bswap64(x)
+#endif
+
+#endif /* _LIBFDT_ENV_H */
diff --git a/include/libfdt_env.h b/include/libfdt_env.h
deleted file mode 100644
index 3667d4c..0000000
--- a/include/libfdt_env.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright IBM Corp. 2008
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- *
- */
-
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H
-
-#include "qemu/bswap.h"
-
-#ifdef HOST_WORDS_BIGENDIAN
-#define fdt32_to_cpu(x) (x)
-#define cpu_to_fdt32(x) (x)
-#define fdt64_to_cpu(x) (x)
-#define cpu_to_fdt64(x) (x)
-#else
-#define fdt32_to_cpu(x) bswap32(x)
-#define cpu_to_fdt32(x) bswap32(x)
-#define fdt64_to_cpu(x) bswap64(x)
-#define cpu_to_fdt64(x) bswap64(x)
-#endif
-
-#endif /* _LIBFDT_ENV_H */
--
1.8.3.rc1.44.gb387c77.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h
2013-05-22 1:50 [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h peter.crosthwaite
@ 2013-05-22 7:47 ` Edgar E. Iglesias
2013-05-22 8:26 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Edgar E. Iglesias @ 2013-05-22 7:47 UTC (permalink / raw)
To: peter.crosthwaite; +Cc: pbonzini, qemu-devel, peter.maydell
On Wed, May 22, 2013 at 11:50:22AM +1000, peter.crosthwaite@xilinx.com wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Currently QEMU provides a local clone of the file libfdt_env.h in
> /include. This file is supposed to come with the libfdt package and is
> only needed for broken installs of libfdt. Unfortunately, libfdt 1.3
> stable is tagged with this bug so we cant realistically remove the
> clone. So instead, use a configure time probe - check to see if the
> host is already providing this file, and if so, don't use QEMUs
> local clone of libfdt.h.
>
> Moved include/libfdt_env.h to include/libfdt/libfdt_env.h so it can be
> treated as a special case.
>
> For newer (development) versions of libfdt this probe will succeed and
> include/libfdt/libfdt_env.h will simply be ignored.
>
> For older versions -Iinclude/libfdt will be added to CFLAGS.
>
> Manifests as a bug when building QEMU with modern libfdt. The new
> version of libfdt does not compile when QEMUs libfdt_env.h takes
> precedence over the hosts.
>
> Reported-by: Nathan Rossi <nathan.rossi@xilinx.com>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Hi,
Should we consider removing our builtin version and stick to either
using the hosts or when that fails suggest the submoduled dtc pkg?
Anyway, this patch improves the current situation so OK with me:
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Cheers,
Edgar
> ---
> To replicate bug (install latest dtc from src to host and make):
> git submodule update --init dtc
> cd dtc
> git checkout master
> make
> sudo make install PREFIX=/usr/local
> cd ..
> ./configure --target-list="arm-softmmu" --enable-fdt
> make
>
> configure | 14 ++++++++++++++
> include/libfdt/libfdt_env.h | 36 ++++++++++++++++++++++++++++++++++++
> include/libfdt_env.h | 36 ------------------------------------
> 3 files changed, 50 insertions(+), 36 deletions(-)
> create mode 100644 include/libfdt/libfdt_env.h
> delete mode 100644 include/libfdt_env.h
>
> diff --git a/configure b/configure
> index 5ae7e4a..f59c49b 100755
> --- a/configure
> +++ b/configure
> @@ -2550,6 +2550,20 @@ EOF
> fi
> fi
>
> +##########################################
> +# libfdt_env.h probe
> +
> +if test "$fdt" == "yes" ; then
> + cat > $TMPC << EOF
> +#include <libfdt_env.h>
> +int main(void) { return 0; }
> +EOF
> + if ! compile_prog "" "$fdt_libs" ; then
> + #system libfdt_env is bad - use QEMUs inbuilt snapshot
> + fdt_cflags="-I\$(SRC_PATH)/include/libfdt $fdt_cflags"
> + fi
> +fi
> +
> libs_softmmu="$libs_softmmu $fdt_libs"
>
> ##########################################
> diff --git a/include/libfdt/libfdt_env.h b/include/libfdt/libfdt_env.h
> new file mode 100644
> index 0000000..3667d4c
> --- /dev/null
> +++ b/include/libfdt/libfdt_env.h
> @@ -0,0 +1,36 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see <http://www.gnu.org/licenses/>.
> + *
> + * Copyright IBM Corp. 2008
> + * Authors: Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + */
> +
> +#ifndef _LIBFDT_ENV_H
> +#define _LIBFDT_ENV_H
> +
> +#include "qemu/bswap.h"
> +
> +#ifdef HOST_WORDS_BIGENDIAN
> +#define fdt32_to_cpu(x) (x)
> +#define cpu_to_fdt32(x) (x)
> +#define fdt64_to_cpu(x) (x)
> +#define cpu_to_fdt64(x) (x)
> +#else
> +#define fdt32_to_cpu(x) bswap32(x)
> +#define cpu_to_fdt32(x) bswap32(x)
> +#define fdt64_to_cpu(x) bswap64(x)
> +#define cpu_to_fdt64(x) bswap64(x)
> +#endif
> +
> +#endif /* _LIBFDT_ENV_H */
> diff --git a/include/libfdt_env.h b/include/libfdt_env.h
> deleted file mode 100644
> index 3667d4c..0000000
> --- a/include/libfdt_env.h
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -/*
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License, version 2, as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, see <http://www.gnu.org/licenses/>.
> - *
> - * Copyright IBM Corp. 2008
> - * Authors: Hollis Blanchard <hollisb@us.ibm.com>
> - *
> - */
> -
> -#ifndef _LIBFDT_ENV_H
> -#define _LIBFDT_ENV_H
> -
> -#include "qemu/bswap.h"
> -
> -#ifdef HOST_WORDS_BIGENDIAN
> -#define fdt32_to_cpu(x) (x)
> -#define cpu_to_fdt32(x) (x)
> -#define fdt64_to_cpu(x) (x)
> -#define cpu_to_fdt64(x) (x)
> -#else
> -#define fdt32_to_cpu(x) bswap32(x)
> -#define cpu_to_fdt32(x) bswap32(x)
> -#define fdt64_to_cpu(x) bswap64(x)
> -#define cpu_to_fdt64(x) bswap64(x)
> -#endif
> -
> -#endif /* _LIBFDT_ENV_H */
> --
> 1.8.3.rc1.44.gb387c77.dirty
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h
2013-05-22 7:47 ` Edgar E. Iglesias
@ 2013-05-22 8:26 ` Peter Maydell
2013-05-27 2:55 ` Peter Crosthwaite
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2013-05-22 8:26 UTC (permalink / raw)
To: Edgar E. Iglesias; +Cc: pbonzini, peter.crosthwaite, qemu-devel
On 22 May 2013 08:47, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> On Wed, May 22, 2013 at 11:50:22AM +1000, peter.crosthwaite@xilinx.com wrote:
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> Currently QEMU provides a local clone of the file libfdt_env.h in
>> /include. This file is supposed to come with the libfdt package and is
>> only needed for broken installs of libfdt. Unfortunately, libfdt 1.3
>> stable is tagged with this bug so we cant realistically remove the
>> clone. So instead, use a configure time probe - check to see if the
>> host is already providing this file, and if so, don't use QEMUs
>> local clone of libfdt.h.
>>
>> Moved include/libfdt_env.h to include/libfdt/libfdt_env.h so it can be
>> treated as a special case.
>>
>> For newer (development) versions of libfdt this probe will succeed and
>> include/libfdt/libfdt_env.h will simply be ignored.
> Should we consider removing our builtin version and stick to either
> using the hosts or when that fails suggest the submoduled dtc pkg?
I agree that that sounds like a better idea: just add the #include
to our existing fdt probe, and then we'll simply ignore system libfdt
if it's not new enough. The relevant changes got committed to libfdt
git in 2008, after all....
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h
2013-05-22 8:26 ` Peter Maydell
@ 2013-05-27 2:55 ` Peter Crosthwaite
0 siblings, 0 replies; 4+ messages in thread
From: Peter Crosthwaite @ 2013-05-27 2:55 UTC (permalink / raw)
To: Peter Maydell; +Cc: Edgar E. Iglesias, qemu-devel, pbonzini
Hi Peter,
On Wed, May 22, 2013 at 6:26 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 22 May 2013 08:47, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
>> On Wed, May 22, 2013 at 11:50:22AM +1000, peter.crosthwaite@xilinx.com wrote:
>>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> Currently QEMU provides a local clone of the file libfdt_env.h in
>>> /include. This file is supposed to come with the libfdt package and is
>>> only needed for broken installs of libfdt. Unfortunately, libfdt 1.3
>>> stable is tagged with this bug so we cant realistically remove the
>>> clone. So instead, use a configure time probe - check to see if the
>>> host is already providing this file, and if so, don't use QEMUs
>>> local clone of libfdt.h.
>>>
>>> Moved include/libfdt_env.h to include/libfdt/libfdt_env.h so it can be
>>> treated as a special case.
>>>
>>> For newer (development) versions of libfdt this probe will succeed and
>>> include/libfdt/libfdt_env.h will simply be ignored.
>
>> Should we consider removing our builtin version and stick to either
>> using the hosts or when that fails suggest the submoduled dtc pkg?
>
> I agree that that sounds like a better idea: just add the #include
> to our existing fdt probe, and then we'll simply ignore system libfdt
> if it's not new enough. The relevant changes got committed to libfdt
> git in 2008, after all....
>
I'm happy with this respin assuming Peters dtc-is-compulsory series
goes through before. Otherwise people with dtc 1.3.0 installed will
get cop a silent failure when qemu borks on their previously-working
system 1.3.0 and falls backs to just building with no dtc at all.
I'll remake in the meantime.
Regards,
Peter
> thanks
> -- PMM
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-27 2:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 1:50 [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h peter.crosthwaite
2013-05-22 7:47 ` Edgar E. Iglesias
2013-05-22 8:26 ` Peter Maydell
2013-05-27 2:55 ` Peter Crosthwaite
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).