diff mbox

support compiling and installing DTBs

Message ID 1316199474-30199-1-git-send-email-stuart.yoder@freescale.com
State New
Headers show

Commit Message

Stuart Yoder Sept. 16, 2011, 6:57 p.m. UTC
From: Stuart Yoder <stuart.yoder@freescale.com>

also adds configure options to enable/disable installing DTBs
and override location of dtc

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
 Makefile  |   17 +++++++++++++++--
 configure |   24 ++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

Comments

Alexander Graf Sept. 16, 2011, 7:15 p.m. UTC | #1
Am 16.09.2011 um 20:57 schrieb Stuart Yoder <stuart.yoder@freescale.com>:

> From: Stuart Yoder <stuart.yoder@freescale.com>
> 
> also adds configure options to enable/disable installing DTBs
> and override location of dtc
> 
> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>

This generates a build dependency on dtc, right?


Alex
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 7e9382f..1fe0a0a 100644
--- a/Makefile
+++ b/Makefile
@@ -245,7 +245,6 @@  ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \
 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
 pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
 bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \
-mpc8544ds.dtb \
 multiboot.bin linuxboot.bin \
 s390-zipl.rom \
 spapr-rtas.bin slof.bin
@@ -253,6 +252,20 @@  else
 BLOBS=
 endif
 
+ifdef INSTALL_DTBS
+DTBS=$(SRC_PATH)/pc-bios/mpc8544ds.dtb
+
+%.dtb: %.dts
+	$(call quiet-command,$(DTC) -I dts -O dtb -b 0 -o $@ $<, "  DTC   $@")
+
+install-dtbs: $(DTBS)
+	$(INSTALL_DIR) "$(DESTDIR)$(datadir)"
+	set -e; for x in $(DTBS); do \
+		$(INSTALL_DATA) $$x "$(DESTDIR)$(datadir)"; \
+	done
+
+endif
+
 install-doc: $(DOCS)
 	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
 	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
@@ -267,7 +280,7 @@  install-sysconfig:
 	$(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)/qemu"
 	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(sysconfdir)/qemu"
 
-install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
+install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig $(if $(INSTALL_DTBS),install-dtbs)
 	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
 ifneq ($(TOOLS),)
 	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
diff --git a/configure b/configure
index 0875f95..7d9447f 100755
--- a/configure
+++ b/configure
@@ -182,6 +182,7 @@  usb_redir=""
 opengl=""
 zlib="yes"
 guest_agent="yes"
+dtc=dtc
 
 # parse CC options first
 for opt do
@@ -728,6 +729,12 @@  for opt do
   ;;
   --disable-blobs) blobs="no"
   ;;
+  --enable-dtbs) install_dtbs="yes"
+  ;;
+  --disable-dtbs) install_dtbs="no"
+  ;;
+  --with-dtc=*) dtc=$optarg
+  ;;
   --with-pkgversion=*) pkgversion=" ($optarg)"
   ;;
   --disable-docs) docs="no"
@@ -771,6 +778,13 @@  for opt do
   esac
 done
 
+# set default for $install_dtbs, may be overriden by command line
+if has $dtc; then
+    install_dtbs="yes"
+else
+    install_dtbs="no"
+fi
+
 #
 # If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
@@ -1028,6 +1042,9 @@  echo "  --enable-linux-aio       enable Linux AIO support"
 echo "  --disable-attr           disables attr and xattr support"
 echo "  --enable-attr            enable attr and xattr support"
 echo "  --disable-blobs          disable installing provided firmware blobs"
+echo "  --enable-dtbs            build/install provided device trees (requires dtc)"
+echo "  --disable-dtbs           don't build/install provided device trees"
+echo "  --with-dtc               full path to device tree compiler (overrides default)"
 echo "  --enable-docs            enable documentation build"
 echo "  --disable-docs           disable documentation build"
 echo "  --disable-vhost-net      disable vhost-net acceleration support"
@@ -2713,6 +2730,7 @@  echo "vde support       $vde"
 echo "Linux AIO support $linux_aio"
 echo "ATTR/XATTR support $attr"
 echo "Install blobs     $blobs"
+echo "Install dtbs      $install_dtbs"
 echo "KVM support       $kvm"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
@@ -2982,6 +3000,9 @@  fi
 if test "$blobs" = "yes" ; then
   echo "INSTALL_BLOBS=yes" >> $config_host_mak
 fi
+if test "$install_dtbs" = "yes" ; then
+  echo "INSTALL_DTBS=yes" >> $config_host_mak
+fi
 if test "$iovec" = "yes" ; then
   echo "CONFIG_IOVEC=y" >> $config_host_mak
 fi
@@ -3122,6 +3143,9 @@  echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
+if test "$install_dtbs" = "yes" ; then
+  echo "DTC=$dtc" >> $config_host_mak
+fi
 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
 
 # generate list of library paths for linker script