Re: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h

2013-05-26 Thread Peter Crosthwaite
Hi Peter,

On Wed, May 22, 2013 at 6:26 PM, Peter Maydell peter.mayd...@linaro.org wrote:
 On 22 May 2013 08:47, Edgar E. Iglesias edgar.igles...@gmail.com wrote:
 On Wed, May 22, 2013 at 11:50:22AM +1000, peter.crosthwa...@xilinx.com wrote:
 From: Peter Crosthwaite peter.crosthwa...@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




Re: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h

2013-05-22 Thread Edgar E. Iglesias
On Wed, May 22, 2013 at 11:50:22AM +1000, peter.crosthwa...@xilinx.com wrote:
 From: Peter Crosthwaite peter.crosthwa...@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.ro...@xilinx.com
 Signed-off-by: Peter Crosthwaite peter.crosthwa...@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.igles...@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 000..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 holl...@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..000
 --- 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 holl...@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 

Re: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h

2013-05-22 Thread Peter Maydell
On 22 May 2013 08:47, Edgar E. Iglesias edgar.igles...@gmail.com wrote:
 On Wed, May 22, 2013 at 11:50:22AM +1000, peter.crosthwa...@xilinx.com wrote:
 From: Peter Crosthwaite peter.crosthwa...@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



[Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h

2013-05-21 Thread peter . crosthwaite
From: Peter Crosthwaite peter.crosthwa...@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.ro...@xilinx.com
Signed-off-by: Peter Crosthwaite peter.crosthwa...@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 000..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 holl...@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..000
--- 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 holl...@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