Skip to content

Commit 17dbbbc

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 8613f09 commit 17dbbbc

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

scripts/build_qemu.sh

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
mips-softmmu \
38+
mipsel-softmmu \
39+
or1k-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-attr \
50+
--disable-cap-ng \
51+
--disable-curl \
52+
--disable-curses \
53+
--disable-debug-info \
54+
--disable-dmg
55+
--disable-docs \
56+
--disable-glusterfs \
57+
--disable-gtk \
58+
--disable-guest-agent \
59+
--disable-iconv \
60+
--disable-kvm \
61+
--disable-libiscsi \
62+
--disable-libnfs \
63+
--disable-libssh \
64+
--disable-libusb \
65+
--disable-linux-aio \
66+
--disable-numa \
67+
--disable-parallels \
68+
--disable-replication \
69+
--disable-sdl \
70+
--disable-seccomp \
71+
--disable-selinux \
72+
--disable-tpm \
73+
--disable-usb-redir \
74+
--disable-virtfs \
75+
--disable-vnc \
76+
--disable-xen \
77+
"
78+
79+
if [ "${BUILD_HOST}" == "windows-x86_64" ]; then
80+
QEMU_FLAGS+="--cross-prefix=x86_64-w64-mingw32-"
81+
fi
82+
83+
# Configure QEMU
84+
${BUILD_SOURCE}/configure \
85+
${QEMU_FLAGS} \
86+
--target-list="${QEMU_TARGETS}" \
87+
--prefix="${BUILD_PREFIX}"
88+
89+
# Build QEMU
90+
make -j
91+
92+
# Install QEMU
93+
make install
94+
95+
# Copy required dynamic-link libraries for Windows
96+
if [ "${BUILD_HOST}" == "windows-x86_64" ]; then
97+
QEMU_WIN_LIBS=" \
98+
/opt/mingw-w64-win32/x86_64-w64-mingw32/bin/libglib-2.0-0.dll \
99+
/opt/mingw-w64-win32/x86_64-w64-mingw32/lib/libstdc++-6.dll \
100+
/opt/mingw-w64-win32/x86_64-w64-mingw32/lib/libssp-0.dll \
101+
/opt/mingw-w64-win32/x86_64-w64-mingw32/lib/libwinpthread-1.dll \
102+
"
103+
104+
for l in ${QEMU_WIN_LIBS}; do
105+
cp -f ${l} ${BUILD_PREFIX}
106+
done
107+
fi

0 commit comments

Comments
 (0)