Skip to content

Commit 57dfddd

Browse files
committed
[WIP] scripts: Add script to build QEMU
This commit adds a script to build QEMU outside Poky for non-Linux hosts. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent b326def commit 57dfddd

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

scripts/build_qemu.sh

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#/usr/bin/env bash
2+
3+
usage()
4+
{
5+
echo "Usage: $(basename $0) host source prefix"
6+
}
7+
8+
# Validate and parse arguments
9+
if [ "$1" == "" ]; then
10+
usage
11+
echo
12+
echo "host must be specified."
13+
exit 1
14+
elif [ "$2" == "" ]; then
15+
usage
16+
echo
17+
echo "source must be specified."
18+
exit 1
19+
elif [ "$3" == "" ]; then
20+
usage
21+
echo
22+
echo "prefix must be specified."
23+
exit 1
24+
fi
25+
26+
BUILD_HOST="$1"
27+
BUILD_SOURCE="$2"
28+
BUILD_PREFIX="$3"
29+
30+
# Set build parameters
31+
QEMU_TARGETS=" \
32+
aarch64-softmmu \
33+
arm-softmmu \
34+
i386-softmmu \
35+
or1k-softmmu \
36+
mips-softmmu \
37+
mipsel-softmmu \
38+
riscv32-softmmu \
39+
riscv64-softmmu \
40+
rx-softmmu \
41+
sparc-softmmu \
42+
x86_64-softmmu \
43+
xtensa-softmmu \
44+
"
45+
46+
QEMU_FLAGS=" \
47+
--disable-docs \
48+
--disable-sdl \
49+
--disable-gtk \
50+
--disable-debug-info \
51+
--disable-cap-ng \
52+
--disable-libnfs \
53+
--disable-libusb \
54+
--disable-libiscsi \
55+
--disable-usb-redir \
56+
--disable-linux-aio \
57+
--disable-guest-agent \
58+
--disable-libssh \
59+
--disable-vnc \
60+
--disable-kvm \
61+
--disable-seccomp \
62+
--disable-tpm \
63+
--disable-numa \
64+
--disable-glusterfs \
65+
--disable-virtfs \
66+
--disable-xen \
67+
--disable-curl \
68+
--disable-attr \
69+
--disable-curses \
70+
--disable-iconv \
71+
--disable-parallels \
72+
--disable-replication \
73+
--disable-live-block-migration \
74+
--disable-dmg
75+
"
76+
77+
if [ "${BUILD_HOST}" == "windows-x86_64" ]; then
78+
QEMU_FLAGS+="--cross-prefix=x86_64-w64-mingw32-"
79+
fi
80+
81+
# Configure QEMU
82+
${BUILD_SOURCE}/configure \
83+
${QEMU_FLAGS} \
84+
--target-lists="${QEMU_TARGETS}" \
85+
--prefix="${BUILD_PREFIX}"
86+
87+
# Build QEMU
88+
make -j
89+
90+
# Install QEMU
91+
make install
92+
93+
# Copy required dynamic-link libraries for Windows
94+
if [ "${BUILD_HOST}" == "windows-x86_64" ]; then
95+
QEMU_WIN_LIBS=" \
96+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/iconv.dll \
97+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libffi-6.dll \
98+
/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/libgcc_s_seh-1.dll \
99+
/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/libssp-0.dll \
100+
/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/libstdc++-6.dll \
101+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgio-2.0-0.dll \
102+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libglib-2.0-0.dll \
103+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgmodule-2.0-0.dll \
104+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgobject-2.0-0.dll \
105+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libintl-8.dll \
106+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpcre-1.dll \
107+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpixman-1-0.dll \
108+
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/zlib1.dll \
109+
/usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll \
110+
"
111+
112+
for l in ${QEMU_WIN_LIBS}; do
113+
cp -f ${l} ${BUILD_PREFIX}
114+
done
115+
fi

0 commit comments

Comments
 (0)