From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCcpe-0007d0-BM for qemu-devel@nongnu.org; Tue, 16 Dec 2008 11:31:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCcpd-0007bf-Cc for qemu-devel@nongnu.org; Tue, 16 Dec 2008 11:31:37 -0500 Received: from [199.232.76.173] (port=49117 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCcpd-0007bO-41 for qemu-devel@nongnu.org; Tue, 16 Dec 2008 11:31:37 -0500 Received: from mx20.gnu.org ([199.232.41.8]:23755) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCcpc-0006ix-QE for qemu-devel@nongnu.org; Tue, 16 Dec 2008 11:31:36 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LCcpb-0003rR-JN for qemu-devel@nongnu.org; Tue, 16 Dec 2008 11:31:35 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [6064] Implement device tree support needed for Bamboo emulation Date: Tue, 16 Dec 2008 16:31:31 +0000 References: <200812161230.24052.paul@codesourcery.com> <1229440187.31337.15.camel@localhost.localdomain> In-Reply-To: <1229440187.31337.15.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_kf9RJMRJL5SMgz+" Message-Id: <200812161631.32268.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Hollis Blanchard --Boundary-00=_kf9RJMRJL5SMgz+ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline > > Then why is it optional? > > As you mention below, libfdt isn't generally available yet, and since > it's possible to make a real firmware work in this environment (in which > case -kernel isn't needed), the code can still be useful. > > If you'd prefer to make libfdt mandatory, I'm fine with that. Well, from your description it sounds like your ppc bits are fairly useless without it. History has shown that if it's possible for people to build something incorrectly, they usually will. Even more so if the required libraries are even vaguely standard. > > AFAIK libfdt isn't present in any of the major distros. I thought the > > conclusion was that we should import libfdt into qemu. > > That was our conclusion, but Anthony never agreed. > > FWIW, I have requested that Fedora and Debian package libfdt, and they > agreed in principle, but it's still missing in Fedora 10 for example. > > Is the existence of distribution packages a requirement for use, or > should we say "install it by hand into /usr/local"? If it is a > requirement, which versions of which distributions? I'm extremely reluctant to require an external library that everyone has to go fetch and build themselves. IIRC The libfdt docs say it's expected that people will include it in their projects. I can say from experience that it drops in pretty easily. It's a 4-line qemu patch, plus make libfdt_env.h use the qemu byteswap routines. > I doubt anyone has tried to build libfdt on Windows... I have (well, technically a cross build from linux, but same difference). Signed-off-by: Paul Brook Index: Makefile =================================================================== --- Makefile (revision 6069) +++ Makefile (working copy) @@ -5,7 +5,7 @@ include config-host.mak .PHONY: all clean cscope distclean dvi html info install install-doc \ recurse-all speed tar tarbin test -VPATH=$(SRC_PATH):$(SRC_PATH)/hw +VPATH=$(SRC_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/libfdt CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) @@ -68,7 +68,11 @@ endif # system emulation, i.e. a single QEMU executable should support all # CPUs and machines. +include $(SRC_PATH)/libfdt/Makefile.libfdt +$(LIBFDT_OBJS): CPPFLAGS += -I$(SRC_PATH)/libfdt + OBJS=$(BLOCK_OBJS) +OBJS+=$(LIBFDT_OBJS) OBJS+=readline.o console.o OBJS+=irq.o --Boundary-00=_kf9RJMRJL5SMgz+ Content-Type: text/x-diff; charset="iso-8859-1"; name="patch.libfdt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.libfdt" Minor changes are required to get libfdt to build as part of qemu. The patch below records modifications relative to upstream dtc-v1.2.0. Index: libfdt_env.h =================================================================== --- libfdt_env.h (revision 230023) +++ libfdt_env.h (working copy) @@ -4,10 +4,9 @@ #include #include #include -#include -#include +#include "bswap.h" -#if __BYTE_ORDER == __BIG_ENDIAN +#ifdef WORDS_BIGENDIAN #define fdt32_to_cpu(x) (x) #define cpu_to_fdt32(x) (x) #define fdt64_to_cpu(x) (x) --Boundary-00=_kf9RJMRJL5SMgz+--