Skip to content

Commit 5ca591e

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 5cc87f4 commit 5ca591e

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

scripts/build_qemu.sh

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

0 commit comments

Comments
 (0)