Merge branch 'tizen_3.0_qemu_2.4' into tizen_3.0_develop
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 9 Sep 2015 06:04:25 +0000 (15:04 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 9 Sep 2015 07:59:45 +0000 (16:59 +0900)
Change-Id: Id041f1c920109207df64105feabf237dba5cbe37
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
1  2 
.gitignore
configure
package/build.common
tizen/emulator_configure.sh
tizen/src/ecs/ecs_msg_injector.c
tizen/src/emul_state.c
tizen/src/emulator.c
util/oslib-win32.c
util/qemu-error.c
vl.c

diff --cc .gitignore
Simple merge
diff --cc configure
+++ b/configure
@@@ -337,19 -339,12 +337,19 @@@ vte="
  tpm="yes"
  libssh2=""
  vhdx=""
 -quorum=""
  numa=""
 +tcmalloc="no"
 +
 +yagl="no"
 +yagl_stats="no"
 +glx=""
 +vigs="no"
 +libtizenusb="no"
 +
  # for TIZEN-maru
+ maru="no"
  winver="0x501"
  java_ui="no"
- maru="no"
  shm="no"
  libav=""
  libpng="no"
@@@ -1373,93 -1440,60 +1373,93 @@@ Advanced options (experts only)
                             Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
    --with-trace-file=NAME   Full PATH,NAME of file to store traces
                             Default:trace-<pid>
 -  --disable-spice          disable spice
 -  --enable-spice           enable spice
 -  --enable-rbd             enable building the rados block device (rbd)
 -  --disable-libiscsi       disable iscsi support
 -  --enable-libiscsi        enable iscsi support
 -  --disable-libnfs         disable nfs support
 -  --enable-libnfs          enable nfs support
 -  --disable-smartcard-nss  disable smartcard nss support
 -  --enable-smartcard-nss   enable smartcard nss support
 -  --disable-libusb         disable libusb (for usb passthrough)
 -  --enable-libusb          enable libusb (for usb passthrough)
 -  --disable-usb-redir      disable usb network redirection support
 -  --enable-usb-redir       enable usb network redirection support
 -  --enable-lzo             enable the support of lzo compression library
 -  --enable-snappy          enable the support of snappy compression library
 -  --disable-guest-agent    disable building of the QEMU Guest Agent
 -  --enable-guest-agent     enable building of the QEMU Guest Agent
 -  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
 -  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
 -  --disable-seccomp        disable seccomp support
 -  --enable-seccomp         enable seccomp support
 +  --disable-slirp          disable SLIRP userspace network connectivity
 +  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
 +  --oss-lib                path to OSS library
 +  --cpu=CPU                Build for host CPU [$cpu]
    --with-coroutine=BACKEND coroutine backend. Supported options:
                             gthread, ucontext, sigaltstack, windows
 -  --disable-coroutine-pool disable coroutine freelist (worse performance)
 -  --enable-coroutine-pool  enable coroutine freelist (better performance)
 -  --enable-glusterfs       enable GlusterFS backend
 -  --disable-glusterfs      disable GlusterFS backend
 -  --enable-archipelago     enable Archipelago backend
 -  --disable-archipelago    disable Archipelago backend
    --enable-gcov            enable test coverage analysis with gcov
    --gcov=GCOV              use specified gcov [$gcov_tool]
 -  --disable-tpm            disable TPM support
 -  --enable-tpm             enable TPM support
 -  --disable-libssh2        disable ssh block device support
 -  --enable-libssh2         enable ssh block device support
 -  --disable-vhdx           disable support for the Microsoft VHDX image format
 -  --enable-vhdx            enable support for the Microsoft VHDX image format
 -  --disable-quorum         disable quorum block filter support
 -  --enable-quorum          enable quorum block filter support
 -  --disable-numa           disable libnuma support
 -  --enable-numa            enable libnuma support
 -
 -  --disable-hax            disable HAX acceleration support
 -  --enable-hax             enable HAX acceleration support
 -  --enable-yagl            enable YaGL device
 -  --disable-yagl           disable YaGL device
 -  --enable-yagl-stats      enable YaGL stats
 -  --disable-yagl-stats     disable YaGL stats
 -  --enable-vigs            enable VIGS device
 -  --disable-vigs           disable VIGS device
 +  --disable-blobs          disable installing provided firmware blobs
 +  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
 +  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
 +
 +Optional features, enabled with --enable-FEATURE and
 +disabled with --disable-FEATURE, default is enabled if available:
 +
 +  system          all system emulation targets
 +  user            supported user emulation targets
 +  linux-user      all linux usermode emulation targets
 +  bsd-user        all BSD usermode emulation targets
 +  guest-base      GUEST_BASE support for usermode emulation targets
 +  docs            build documentation
 +  guest-agent     build the QEMU Guest Agent
 +  guest-agent-msi build guest agent Windows MSI installation package
 +  pie             Position Independent Executables
 +  modules         modules support
 +  debug-tcg       TCG debugging (default is disabled)
 +  debug-info      debugging information
 +  sparse          sparse checker
 +
 +  gnutls          GNUTLS cryptography support
 +  sdl             SDL UI
 +  --with-sdlabi     select preferred SDL ABI 1.2 or 2.0
 +  gtk             gtk UI
 +  --with-gtkabi     select preferred GTK ABI 2.0 or 3.0
 +  vte             vte support for the gtk UI
 +  curses          curses UI
 +  vnc             VNC UI support
 +  vnc-tls         TLS encryption for VNC server
 +  vnc-sasl        SASL encryption for VNC server
 +  vnc-jpeg        JPEG lossy compression for VNC server
 +  vnc-png         PNG compression for VNC server
 +  cocoa           Cocoa UI (Mac OS X only)
 +  virtfs          VirtFS
 +  xen             xen backend driver support
 +  xen-pci-passthrough
 +  brlapi          BrlAPI (Braile)
 +  curl            curl connectivity
 +  fdt             fdt device tree
 +  bluez           bluez stack connectivity
 +  kvm             KVM acceleration support
 +  rdma            RDMA-based migration support
 +  uuid            uuid support
 +  vde             support for vde network
 +  netmap          support for netmap network
 +  linux-aio       Linux AIO support
 +  cap-ng          libcap-ng support
 +  attr            attr and xattr support
 +  vhost-net       vhost-net acceleration support
 +  spice           spice
 +  rbd             rados block device (rbd)
 +  libiscsi        iscsi support
 +  libnfs          nfs support
 +  smartcard-nss   smartcard nss support
 +  libusb          libusb (for usb passthrough)
 +  usb-redir       usb network redirection support
 +  lzo             support of lzo compression library
 +  snappy          support of snappy compression library
 +  bzip2           support of bzip2 compression library
 +                  (for reading bzip2-compressed dmg images)
 +  seccomp         seccomp support
 +  coroutine-pool  coroutine freelist (better performance)
 +  glusterfs       GlusterFS backend
 +  archipelago     Archipelago backend
 +  tpm             TPM support
 +  libssh2         ssh block device support
 +  vhdx            support for the Microsoft VHDX image format
 +  numa            libnuma support
 +  tcmalloc        tcmalloc support
 +  qt              Qt5 UI
 +  hax             HAX acceleration support
 +  yagl            YaGL device
 +  yagl-stats      YaGL stats
 +  vigs            VIGS device
  
  TIZEN-maru options:
-   --winver=WINVER          set WINVER
    --enable-maru            enable maru board
+   --winver=WINVER          set WINVER
    --enable-java-ui         enable java UI
    --enable-shm             enable shared memory for framebuffer
    --enable-libav           enable libav library
  # for TIZEN-maru
  if test "$maru" = "yes" ; then
    echo "CONFIG_MARU=y" >> $config_host_mak
- fi
  # java ui is deprecated
- if test "$java_ui" = "yes" ; then
-   if test "$shm" = "yes" || test "$sdl" = "yes" ; then
-     echo "CONFIG_JAVA_UI=y" >> $config_host_mak
-   else
-     error_exit "Java UI is only available with SDL or SHM"
-   fi
- fi
- if test "$shm" = "yes" ; then
    if test "$java_ui" = "yes" ; then
-     echo "CONFIG_USE_SHM=y" >> $config_host_mak
-   else
-     error_exit "SHM is only available whith Java UI"
+     if test "$shm" = "yes" || test "$sdl" = "yes" ; then
+       echo "CONFIG_JAVA_UI=y" >> $config_host_mak
+     else
+       error_exit "Java UI is only available with SDL or SHM"
+     fi
+   fi
+   if test "$shm" = "yes" ; then
+     if test "$java_ui" = "yes" ; then
+       echo "CONFIG_USE_SHM=y" >> $config_host_mak
+     else
+       error_exit "SHM is only available with Java UI"
+     fi
+   fi
+   if test "$libav" = "yes" ; then
+     echo "CONFIG_LIBAV=y" >> $config_host_mak
+     echo "LIBAV_CFLAGS=$libav_cflags" >> $config_host_mak
+     echo "LIBAV_LIBS=$libav_libs" >> $config_host_mak
+   fi
+   if test "$libpng" = "yes" ; then
+     echo "CONFIG_PNG=y" >> $config_host_mak
+     echo "LIBPNG_CFLAGS=$libpng_cflags" >> $config_host_mak
+   fi
+   if test "$dxva2" = "yes" ; then
+     echo "CONFIG_DXVA2=y" >> $config_host_mak
+   fi
+   if test "$vaapi" = "yes" ; then
+     echo "CONFIG_VAAPI=y" >> $config_host_mak
+     echo "LIBVA_CFLAGS=$libva_cflags $libva_x11_cflags" >> $config_host_mak
+   fi
+   if test "$libtizenusb" = "yes" ; then
+     echo "CONFIG_TIZENUSB=y" >> $config_host_mak
+   fi
+   if [ ! -z "$extension_path" ] ; then
+     echo "CONFIG_EXTENSION_PATH=$extension_path" >> $config_host_mak
    fi
- fi
- if test "$libav" = "yes" ; then
-   echo "CONFIG_LIBAV=y" >> $config_host_mak
-   echo "LIBAV_CFLAGS=$libav_cflags" >> $config_host_mak
-   echo "LIBAV_LIBS=$libav_libs" >> $config_host_mak
- fi
- if test "$libpng" = "yes" ; then
-   echo "CONFIG_PNG=y" >> $config_host_mak
-   echo "LIBPNG_CFLAGS=$libpng_cflags" >> $config_host_mak
- fi
- if test "$dxva2" = "yes" ; then
-   echo "CONFIG_DXVA2=y" >> $config_host_mak
- fi
- if test "$vaapi" = "yes" ; then
-   echo "CONFIG_VAAPI=y" >> $config_host_mak
-   echo "LIBVA_CFLAGS=$libva_cflags $libva_x11_cflags" >> $config_host_mak
- fi
- if test "$libtizenusb" = "yes" ; then
-   echo "CONFIG_TIZENUSB=y" >> $config_host_mak
- fi
- if [ ! -z "$extension_path" ] ; then
-   echo "CONFIG_EXTENSION_PATH=$extension_path" >> $config_host_mak
  fi
  
 -
  # build tree in object directory in case the source is not in the current directory
  DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
  DIRS="$DIRS fsdev"
index 0000000,e8c2d77..9ccee67
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,51 +1,50 @@@
 -      PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ./emulator_configure.sh x86
+ # build_common
+ build_common()
+ {
+       prepare
+       cd ${SRCDIR}/tizen
+       PKG_CONFIG_PATH=${ROOTDIR}/lib/pkgconfig:${ROOTDIR}/remote/lib/pkgconfig:${ROOTDIR}/libav/lib/pkgconfig
+       PATH=${PATH}:${ROOTDIR}/bin
 -      # FIXME: PKG_CONFIG_PATH is only for qt5_msg_box
 -      PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH} make all_dibs -j8
++      PKG_CONFIG_PATH=${PKG_CONFIG_PATH} ./emulator_configure.sh x86_64
+       make clean
 -      X86_BIN_DIR=$SRCDIR/package/2.4-emulator-qemu-x86.package.${TARGET_OS}/data/platforms/tizen-2.4/common
 -      COMMON_BIN_DIR=$SRCDIR/package/2.4-emulator-qemu-common.package.${TARGET_OS}/data/platforms/tizen-2.4/common
 -      MOBILE_2_4_SKIN_RESOURCE_DIR=$SRCDIR/package/mobile-2.4-emulator-qemu-skins.package.${TARGET_OS}/data/platforms/tizen-2.4/mobile/emulator-resources/skins
 -      WEARABLE_2_4_SKIN_RESOURCE_DIR=$SRCDIR/package/wearable-2.4-emulator-qemu-skins.package.${TARGET_OS}/data/platforms/tizen-2.4/wearable/emulator-resources/skins
 -      TV_2_4_SKIN_RESOURCE_DIR=$SRCDIR/package/tv-2.4-emulator-qemu-skins.package.${TARGET_OS}/data/platforms/tizen-2.4/tv/emulator-resources/skins
++      PATH=${PATH} make all_dibs -j8
+       make install_dibs
+       if [ $? -eq 0 ]
+       then
+               echo "x86 build success"
+       else
+               echo "x86 build failure"
+               exit 1
+       fi
+ }
+ # install_common
+ install_common()
+ {
 -      mkdir -p $MOBILE_2_4_SKIN_RESOURCE_DIR
 -      mkdir -p $WEARABLE_2_4_SKIN_RESOURCE_DIR
 -      mkdir -p $TV_2_4_SKIN_RESOURCE_DIR
++      X86_BIN_DIR=$SRCDIR/package/3.0-emulator-qemu-x86.package.${TARGET_OS}/data/platforms/tizen-3.0/common
++      COMMON_BIN_DIR=$SRCDIR/package/3.0-emulator-qemu-common.package.${TARGET_OS}/data/platforms/tizen-3.0/common
++      MOBILE_3_0_SKIN_RESOURCE_DIR=$SRCDIR/package/mobile-3.0-emulator-qemu-skins.package.${TARGET_OS}/data/platforms/tizen-3.0/mobile/emulator-resources/skins
++      WEARABLE_3_0_SKIN_RESOURCE_DIR=$SRCDIR/package/wearable-3.0-emulator-qemu-skins.package.${TARGET_OS}/data/platforms/tizen-3.0/wearable/emulator-resources/skins
++      TV_3_0_SKIN_RESOURCE_DIR=$SRCDIR/package/tv-3.0-emulator-qemu-skins.package.${TARGET_OS}/data/platforms/tizen-3.0/tv/emulator-resources/skins
+       cd $SRCDIR/tizen
+       mkdir -p $X86_BIN_DIR
+       mkdir -p $COMMON_BIN_DIR
 -      mv skins/mobile/* $MOBILE_2_4_SKIN_RESOURCE_DIR
 -      mv skins/wearable/* $WEARABLE_2_4_SKIN_RESOURCE_DIR
 -      mv skins/tv/* $TV_2_4_SKIN_RESOURCE_DIR
++      mkdir -p $MOBILE_3_0_SKIN_RESOURCE_DIR
++      mkdir -p $WEARABLE_3_0_SKIN_RESOURCE_DIR
++      mkdir -p $TV_3_0_SKIN_RESOURCE_DIR
+       mv x86 $X86_BIN_DIR/emulator
+       mv common $COMMON_BIN_DIR/emulator
+       #profile skins
++      mv skins/mobile/* $MOBILE_3_0_SKIN_RESOURCE_DIR
++      mv skins/wearable/* $WEARABLE_3_0_SKIN_RESOURCE_DIR
++      mv skins/tv/* $TV_3_0_SKIN_RESOURCE_DIR
+ }
@@@ -100,57 -98,81 +98,89 @@@ els
  export PKG_CONFIG_PATH=${TIZEN_SDK_DEV_PATH}/distrib/lib/pkgconfig:${PKG_CONFIG_PATH}
  fi
  
 - --disable-quorum
+ # append common options
+ CONFIGURE_APPEND="
+  --target-list=$EMUL_TARGET_LIST
+  --enable-maru
+  --enable-yagl
+  --enable-curl
+  --enable-vigs
+  --enable-qt
+  --enable-libav
+  --enable-libpng
++ --disable-bzip2
++ --disable-lzo
++ --disable-snappy
+  --disable-gtk
+  --disable-vnc
+  --disable-spice
+  --disable-curses
+  --disable-xen
+  $CONFIGURE_APPEND"
+ # append platform specific options
  case $targetos in
  Linux*)
- cd ..
- echo ""
- echo "##### QEMU configuring for emulator"
- echo "##### QEMU configure append:" $CONFIGURE_APPEND
- exec ./configure \
-  --enable-werror \
-  --extra-ldflags=-Wl,--export-dynamic \
-  --audio-drv-list=alsa \
-  --enable-virtfs \
-  $CONFIGURE_APPEND \
+ CONFIGURE_APPEND="
+  --enable-werror
+  --extra-ldflags=-Wl,--export-dynamic
+  --audio-drv-list=alsa
+  --enable-sdl
+  --enable-virtfs
++ --enable-kvm
+  $CONFIGURE_APPEND
+ "
  ;;
  CROSS_MINGW*)
- cd ..
- echo ""
- echo "##### QEMU configuring for emulator"
- echo "##### QEMU configure append:" $CONFIGURE_APPEND
- exec ./configure \
-  --enable-werror \
-  --cross-prefix=$CROSS_PREFIX \
-  --extra-ldflags=-Wl,--large-address-aware \
-  --extra-ldflags=-Wl,--export-all-symbols \
-  --extra-ldflags=-static-libgcc \
-  --extra-ldflags=-static-libstdc++ \
-  --audio-drv-list=dsound \
-  --enable-hax \
-  $CONFIGURE_APPEND \
+ CONFIGURE_APPEND="
+  --cross-prefix=$CROSS_PREFIX
+  --enable-werror
+  --extra-ldflags=-Wl,--large-address-aware
+  --extra-ldflags=-Wl,--export-all-symbols
 - --audio-drv-list=winwave
 - --enable-hax
++ --audio-drv-list=dsound
+  --enable-sdl
+  --enable-virtfs
++ --enable-hax
+  $CONFIGURE_APPEND
+ "
  ;;
  MINGW*)
- cd ..
- echo ""
- echo "##### QEMU configuring for emulator"
- echo "##### QEMU configure append:" $CONFIGURE_APPEND
- exec ./configure \
-  --enable-werror \
-  --cc=gcc \
-  --cxx=g++ \
-  --extra-cflags=-Wno-error=format \
-  --extra-cflags=-Wno-error=format-extra-args \
-  --extra-cflags=-Wno-error=redundant-decls \
-  --extra-ldflags=-Wl,--large-address-aware \
-  --extra-ldflags=-Wl,--export-all-symbols \
-  --extra-ldflags=-static-libgcc \
-  --extra-ldflags=-static-libstdc++ \
-  --audio-drv-list=dsound \
-  --enable-hax \
-  $CONFIGURE_APPEND \
+ CONFIGURE_APPEND="
+  --cc=gcc
+  --cxx=g++
+  --enable-werror
+  --extra-ldflags=-Wl,--large-address-aware
+  --extra-ldflags=-Wl,--export-all-symbols
 - --audio-drv-list=winwave
++ --audio-drv-list=dsound
+  --enable-sdl
+  --enable-virtfs
+  --enable-hax
+  $CONFIGURE_APPEND
+ "
  ;;
  Darwin*)
 - --extra-cflags=-mmacosx-version-min=10.4
+ CONFIGURE_APPEND="
+  --cc=clang
+  --cxx=clang
+  --enable-werror
 - --enable-cocoa
++ --extra-cflags=-mmacosx-version-min=10.7
++ --extra-cflags=-Wno-error=deprecated-declarations
+  --extra-ldflags=-lstdc++
+  --audio-drv-list=coreaudio
++ --enable-virtfs
++ --disable-sdl
++ --disable-cocoa
+  --enable-virtfs
+  --enable-hax
+  $CONFIGURE_APPEND
+ "
  # FIXME: "-export_dynamic" causes error on old version clang
+ # --extra-ldflags="-Xlinker -export_dynamic" \
++# TODO: we need general GUI for MacOS
++# we should use cocoa or sdl
+ ;;
+ esac
  cd ..
  echo ""
  echo "##### QEMU configuring for emulator"
Simple merge
Simple merge
@@@ -34,6 -34,6 +34,7 @@@
  
  #include "qemu/config-file.h"
  #include "qemu/sockets.h"
++#include "qemu/error-report.h"
  
  #include "build_info.h"
  #include "emulator.h"
Simple merge
Simple merge
diff --cc vl.c
--- 1/vl.c
--- 2/vl.c
+++ b/vl.c
@@@ -144,8 -140,13 +144,11 @@@ int qemu_main(int argc, char **argv, ch
  # ifdef CONFIG_JAVA_UI
  #include "tizen/src/display/maru_display.h"
  # endif
+ inline static bool is_maru_machine(MachineClass *mc) {
+    return g_str_has_prefix(mc->name, "maru");
+ }
  #endif
  
 -#define DEFAULT_RAM_SIZE 128
 -
  #define MAX_VIRTIO_CONSOLES 1
  #define MAX_SCLP_CONSOLES 1
  
@@@ -4224,25 -4014,30 +4230,28 @@@ int main(int argc, char **argv, char **
      }
  
  #if defined(CONFIG_MARU)
-     preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL);
-     if (preallocated_ram_ptr) {
-         preallocated_ram_size = ram_size;
-     }
+     if (is_maru_machine(machine_class)) {
+         preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size, NULL);
+         if (preallocated_ram_ptr) {
+             preallocated_ram_size = ram_size;
+         }
  
-     kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append");
-     // Returned variable points different address from input variable.
-     kernel_cmdline = prepare_maru(kernel_cmdline);
-     qemu_opt_set(qemu_get_machine_opts(), "append", kernel_cmdline, &error_abort);
+         kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append");
+         // Returned variable points different address from input variable.
+         kernel_cmdline = prepare_maru(kernel_cmdline);
 -        qemu_opt_set(qemu_get_machine_opts(), "append", kernel_cmdline);
++        qemu_opt_set(qemu_get_machine_opts(), "append",
++                kernel_cmdline, &error_abort);
+     }
  #endif
  
 -    /* Open the logfile at this point, if necessary. We can't open the logfile
 -     * when encountering either of the logging options (-d or -D) because the
 -     * other one may be encountered later on the command line, changing the
 -     * location or level of logging.
 +    /* Open the logfile at this point and set the log mask if necessary.
       */
 +    if (log_file) {
 +        qemu_set_log_filename(log_file);
 +    }
 +
      if (log_mask) {
          int mask;
 -        if (log_file) {
 -            qemu_set_log_filename(log_file);
 -        }
 -
          mask = qemu_str_to_log_mask(log_mask);
          if (!mask) {
              qemu_print_log_usage(stdout);
          }
      }
  
 +#if defined(CONFIG_VNC)
 +    if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
 +        display_remote++;
 +    }
 +#endif
      if (display_type == DT_DEFAULT && !display_remote) {
- #if defined(CONFIG_MARU)
-         // If no display_type is specified,
-         // we use DT_MARU_QT_OFFSCREEN
- #if defined(CONFIG_QT)
-         display_type = DT_MARU_QT_OFFSCREEN;
- #elif defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI)
-         display_type = DT_MARU_SDL;
- #elif defined(CONFIG_USE_SHM) && defined(CONFIG_JAVA_UI)
-         display_type = DT_MARU_SHM;
- #endif
- #elif defined(CONFIG_GTK)
+ #if defined(CONFIG_GTK)
          display_type = DT_GTK;
  #elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
          display_type = DT_SDL;
      }
  
      /* init generic devices */
 -    if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0)
 +    if (qemu_opts_foreach(qemu_find_opts("device"),
 +                          device_init_func, NULL, NULL)) {
          exit(1);
 +    }
  
  #if defined(CONFIG_MARU)
-     prepare_maru_after_device_init();
+     if (is_maru_machine(machine_class)) {
+         prepare_maru_after_device_init();
+     }
  #endif
  #ifdef CONFIG_VIGS
      // To support legacy VIGS options