Skip to content

Commit

Permalink
Backport some upstream qemu fixes, from Brad (maintainer) -
Browse files Browse the repository at this point in the history
- Fix install(1) usage to be compatible with OpenBSD's install(1).
- Allow overriding the location of Samba's smbd,

From Brad

- Remove PROVIDE_HIDDEN and ONLY_IF_{RO,RW} from linker scripts to make
  them work with older binutils versions. Fixes *-bsd-user build on
  OpenBSD 4.9 which ships binutils 2.15.

From Gerd Hoffmann <kraxel at redhat dot com>
  • Loading branch information
sthen committed Sep 21, 2011
1 parent 3674be5 commit b7886bf
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 42 deletions.
6 changes: 3 additions & 3 deletions emulators/qemu/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# $OpenBSD: Makefile,v 1.75 2011/08/28 11:21:05 sthen Exp $
# $OpenBSD: Makefile,v 1.76 2011/09/21 09:02:30 sthen Exp $

# no success building on other archs yet
ONLY_FOR_ARCHS = amd64 arm i386 mips64 mips64el powerpc sparc sparc64

COMMENT = multi system emulator

DISTNAME = qemu-0.15.0
REVISION = 0
REVISION = 1
CATEGORIES = emulators
MASTER_SITES = http://wiki.qemu.org/download/ \
${MASTER_SITE_SAVANNAH:=qemu/}
Expand Down Expand Up @@ -41,6 +41,7 @@ CONFIGURE_STYLE = simple
CONFIGURE_ARGS = --prefix=${PREFIX} \
--sysconfdir=${SYSCONFDIR} \
--mandir=${PREFIX}/man \
--smbd=${LOCALBASE}/libexec/smbd \
--cc="${CC}" \
--host-cc="${CC}" \
--extra-cflags="${EXTRA_CFLAGS}" \
Expand Down Expand Up @@ -89,7 +90,6 @@ CONFIGURE_ARGS += --enable-debug
REGRESS_TARGET = test

pre-configure:
@${SUBST_CMD} ${WRKSRC}/net.h ${WRKSRC}/qemu-options.hx
@perl -pi -e 's|/dev/dsp|/dev/audio|g' ${WRKSRC}/audio/ossaudio.c

post-install:
Expand Down
88 changes: 65 additions & 23 deletions emulators/qemu/patches/patch-configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$OpenBSD: patch-configure,v 1.18 2011/08/16 21:24:42 sthen Exp $
--- configure.orig Thu Aug 4 17:24:34 2011
+++ configure Sun Aug 7 21:47:00 2011
$OpenBSD: patch-configure,v 1.19 2011/09/21 09:02:30 sthen Exp $
--- configure.orig Mon Aug 8 14:28:42 2011
+++ configure Tue Sep 6 22:49:25 2011
@@ -229,13 +229,11 @@ sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"

# default flags for all hosts
Expand Down Expand Up @@ -37,7 +37,40 @@ $OpenBSD: patch-configure,v 1.18 2011/08/16 21:24:42 sthen Exp $
cpu="hppa"
;;
mips*)
@@ -1513,11 +1517,17 @@ int main(void) {
@@ -409,6 +413,7 @@ SunOS)
make="${MAKE-gmake}"
install="${INSTALL-ginstall}"
ld="gld"
+ smbd="${SMBD-/usr/sfw/sbin/smbd}"
needs_libsunmath="no"
solarisrev=`uname -r | cut -f2 -d.`
# have to select again, because `uname -m` returns i86pc
@@ -477,6 +482,7 @@ fi
: ${make=${MAKE-make}}
: ${install=${INSTALL-install}}
: ${python=${PYTHON-python}}
+: ${smbd=${SMBD-/usr/sbin/smbd}}

if test "$mingw32" = "yes" ; then
EXESUF=".exe"
@@ -520,6 +526,8 @@ for opt do
;;
--python=*) python="$optarg"
;;
+ --smbd=*) smbd="$optarg"
+ ;;
--extra-cflags=*)
;;
--extra-ldflags=*)
@@ -932,6 +940,7 @@ echo " --extra-ldflags=LDFLAGS append extra linker f
echo " --make=MAKE use specified make [$make]"
echo " --install=INSTALL use specified install [$install]"
echo " --python=PYTHON use specified python [$python]"
+echo " --smbd=SMBD use specified smbd [$smbd]"
echo " --static enable static build [$static]"
echo " --mandir=PATH install man pages in PATH"
echo " --datadir=PATH install firmware in PATH"
@@ -1513,11 +1522,17 @@ int main(void) {
return 0;
}
EOF
Expand All @@ -55,7 +88,7 @@ $OpenBSD: patch-configure,v 1.18 2011/08/16 21:24:42 sthen Exp $
else
if test "$vnc_png" = "yes" ; then
feature_not_found "vnc-png"
@@ -1844,7 +1854,7 @@ fi
@@ -1844,7 +1859,7 @@ fi

##########################################
# pthread probe
Expand All @@ -64,7 +97,7 @@ $OpenBSD: patch-configure,v 1.18 2011/08/16 21:24:42 sthen Exp $

pthread=no
cat > $TMPC << EOF
@@ -2546,8 +2556,9 @@ fi
@@ -2546,8 +2561,9 @@ fi
# End of CC checks
# After here, no more $cc or $ld runs

Expand All @@ -76,25 +109,34 @@ $OpenBSD: patch-configure,v 1.18 2011/08/16 21:24:42 sthen Exp $
fi

# Consult white-list to determine whether to enable werror
@@ -3048,7 +3059,7 @@ echo "TOOLS=$tools" >> $config_host_mak
@@ -2638,6 +2654,9 @@ echo "LDFLAGS $LDFLAGS"
echo "make $make"
echo "install $install"
echo "python $python"
+if test "$slirp" = "yes" ; then
+ echo "smbd $smbd"
+fi
echo "host CPU $cpu"
echo "host big endian $bigendian"
echo "target list $target_list"
@@ -2796,6 +2815,7 @@ if test $profiler = "yes" ; then
fi
if test "$slirp" = "yes" ; then
echo "CONFIG_SLIRP=y" >> $config_host_mak
+ echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
fi
if test "$vde" = "yes" ; then
@@ -3048,9 +3068,9 @@ echo "TOOLS=$tools" >> $config_host_mak
echo "ROMS=$roms" >> $config_host_mak
echo "MAKE=$make" >> $config_host_mak
echo "INSTALL=$install" >> $config_host_mak
-echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
+echo "INSTALL_DIR=$install -d -m0755" >> $config_host_mak
echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
-echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
-echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
+echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
+echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
+echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
echo "PYTHON=$python" >> $config_host_mak
@@ -3520,7 +3531,11 @@ if test "$gprof" = "yes" ; then
fi
fi

-linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
+if test "$targetos" != "OpenBSD"; then
+ linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
+else
+ linker_script=""
+fi
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
case "$ARCH" in
sparc)
echo "CC=$cc" >> $config_host_mak
echo "CC_I386=$cc_i386" >> $config_host_mak
24 changes: 24 additions & 0 deletions emulators/qemu/patches/patch-i386_ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$OpenBSD: patch-i386_ld,v 1.1 2011/09/21 09:02:30 sthen Exp $
--- i386.ld.orig Sat Aug 27 18:03:15 2011
+++ i386.ld Sat Aug 27 18:03:33 2011
@@ -42,16 +42,16 @@ SECTIONS
.rel.plt :
{
*(.rel.plt)
- PROVIDE_HIDDEN (__rel_iplt_start = .);
+ PROVIDE (__rel_iplt_start = .);
*(.rel.iplt)
- PROVIDE_HIDDEN (__rel_iplt_end = .);
+ PROVIDE (__rel_iplt_end = .);
}
.rela.plt :
{
*(.rela.plt)
- PROVIDE_HIDDEN (__rela_iplt_start = .);
+ PROVIDE (__rela_iplt_start = .);
*(.rela.iplt)
- PROVIDE_HIDDEN (__rela_iplt_end = .);
+ PROVIDE (__rela_iplt_end = .);
}
.init : { *(.init) } =0x47ff041f
.text :
21 changes: 12 additions & 9 deletions emulators/qemu/patches/patch-net_h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
$OpenBSD: patch-net_h,v 1.3 2011/08/16 21:24:42 sthen Exp $
--- net.h.orig Sat Jul 23 13:05:22 2011
+++ net.h Mon Jul 25 19:29:57 2011
@@ -177,7 +177,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QO
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
$OpenBSD: patch-net_h,v 1.4 2011/09/21 09:02:30 sthen Exp $
--- net.h.orig Mon Aug 8 14:28:42 2011
+++ net.h Tue Sep 6 22:49:37 2011
@@ -174,11 +174,6 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QO

#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
-#ifdef __sun__
-#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
-#else
-#define SMBD_COMMAND "/usr/sbin/smbd"
+#define SMBD_COMMAND "${LOCALBASE}/libexec/smbd"
#endif
-#endif

void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);

12 changes: 12 additions & 0 deletions emulators/qemu/patches/patch-net_slirp_c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$OpenBSD: patch-net_slirp_c,v 1.1 2011/09/21 09:02:30 sthen Exp $
--- net/slirp.c.orig Tue Sep 6 22:49:47 2011
+++ net/slirp.c Tue Sep 6 22:50:01 2011
@@ -529,7 +529,7 @@ static int slirp_smb(SlirpState* s, const char *export
fclose(f);

snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
- SMBD_COMMAND, smb_conf);
+ CONFIG_SMBD_COMMAND, smb_conf);

if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) {
slirp_smb_cleanup(s);
18 changes: 11 additions & 7 deletions emulators/qemu/patches/patch-qemu-options_hx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
$OpenBSD: patch-qemu-options_hx,v 1.3 2011/08/16 21:24:42 sthen Exp $
--- qemu-options.hx.orig Sat Jul 23 13:05:22 2011
+++ qemu-options.hx Mon Jul 25 19:29:57 2011
@@ -1257,7 +1257,7 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windo
$OpenBSD: patch-qemu-options_hx,v 1.4 2011/09/21 09:02:30 sthen Exp $
--- qemu-options.hx.orig Mon Aug 8 14:28:42 2011
+++ qemu-options.hx Tue Sep 6 22:51:02 2011
@@ -1256,9 +1256,9 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windo

Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.

Note that a SAMBA server must be installed on the host OS in
-Note that a SAMBA server must be installed on the host OS in
-@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd versions from
+@file{${LOCALBASE}/libexec/smbd}. QEMU was tested successfully with smbd versions from
Red Hat 9, Fedora Core 3 and OpenSUSE 11.x.
-Red Hat 9, Fedora Core 3 and OpenSUSE 11.x.
+Note that a SAMBA server must be installed on the host OS.
+QEMU was tested successfully with smbd versions from Red Hat 9,
+Fedora Core 3 and OpenSUSE 11.x.

@item hostfwd=[tcp|udp]:[@var{hostaddr}]:@var{hostport}-[@var{guestaddr}]:@var{guestport}
Redirect incoming TCP or UDP connections to the host port @var{hostport} to
44 changes: 44 additions & 0 deletions emulators/qemu/patches/patch-x86_64_ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
$OpenBSD: patch-x86_64_ld,v 1.1 2011/09/21 09:02:30 sthen Exp $
--- x86_64.ld.orig Sat Aug 27 18:03:20 2011
+++ x86_64.ld Sat Aug 27 18:03:40 2011
@@ -38,16 +38,16 @@ SECTIONS
.rel.plt :
{
*(.rel.plt)
- PROVIDE_HIDDEN (__rel_iplt_start = .);
+ PROVIDE (__rel_iplt_start = .);
*(.rel.iplt)
- PROVIDE_HIDDEN (__rel_iplt_end = .);
+ PROVIDE (__rel_iplt_end = .);
}
.rela.plt :
{
*(.rela.plt)
- PROVIDE_HIDDEN (__rela_iplt_start = .);
+ PROVIDE (__rela_iplt_start = .);
*(.rela.iplt)
- PROVIDE_HIDDEN (__rela_iplt_end = .);
+ PROVIDE (__rela_iplt_end = .);
}
.init :
{
@@ -70,8 +70,6 @@ SECTIONS
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
@@ -97,8 +95,8 @@ SECTIONS
.data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) }
+ .eh_frame : { KEEP (*(.eh_frame)) }
+ .gcc_except_table : { *(.gcc_except_table) }
.dynamic : { *(.dynamic) }
.ctors :
{

0 comments on commit b7886bf

Please sign in to comment.