qemu-6.1 版本编译
-
编译环境:主机ubuntu 20.04 版本, python版本>=3.6
ubuntu 20.04 源自带的qemu安装后,不支持gtk, 所以需要自己编译 -
源码下载:https://github.com/qemu/qemu/tree/stable-6.1 或https://download.qemu.org
-
编译步骤:
3.1 安装meson包
pip3 install meson(在线安装)
https://pypi.org/project/meson/#files , 离线下载meson.xxxx.whl, pip3 install xxxx.whl
3.2 安装deb包
sudo apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev推荐的额外安装包,这些包与编译时加的参数有关,比如开启gtk,就需要libgtk-3-dev(不强制,可以根据编译需要安装)
sudo apt-get install git-email
sudo apt-get install libaio-dev libbluetooth-dev libbrlapi-dev libbz2-dev
sudo apt-get install libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev
sudo apt-get install libibverbs-dev libjpeg8-dev libncurses5-dev libnuma-dev
sudo apt-get install librbd-dev librdmacm-dev
sudo apt-get install libsasl2-dev libsdl1.2-dev libseccomp-dev libsnappy-dev libssh2-1-dev
sudo apt-get install libvde-dev libvdeplug-dev libvte-2.90-dev libxen-dev liblzo2-dev
sudo apt-get install valgrind xfslibs-dev
sudo apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libgtk-3-dev
libsdl2-dev libspice-protocol-dev libspice-server-dev libusb-dev libusbredirparser-dev libusb-1.0-0-dev libnuma-dev libcap-ng-dev libattr1-dev libaio-dev
sudo apt install libgles2-mesa-dev libxcb-composite0-dev libxcursor-dev libcairo2-dev libgbm-dev libpam0g-dev
sudo apt install xutils-dev libgl1-mesa-dev
sudo apt install libepoxy-dev
sudo apt install libepoxy-dev libepoxy0 gdm3 libgdm-dev libgdm1
sudo apt-get install libusb-dev
3.3 安装ninja包
sudo apt install ninja-build 或 sudo python3 -m pip install ninja
3.4 解压qemu-stable-6.1
3.5 cd qemu-stable-6.1
3.6 mkdir build && cd build
3.7 编译
具体需要添加的编译参数可以在编译前执行 …/configure help查看
../configure --enable-guest-agent --enable-kvm --disable-xen --enable-libusb --enable-debug-info --enable-debug --enable-sdl --enable-gtk --enable-vnc --enable-vhost-net --enable-spice --enable-spice-protocol --enable-vdi --enable-qed --enable-opengl --enable-gtk --enable-numa --target-list="x86_64-softmmu" --prefix=/usr/local
../configure --enable-guest-agent --enable-kvm --disable-xen --enable-libusb --enable-debug-info --enable-debug --enable-sdl --enable-gtk --enable-vnc --enable-vhost-net --enable-spice --enable-spice-protocol --enable-vdi --enable-qed --enable-opengl --enable-gtk --enable-numa --target-list="aarch64-softmmu" --prefix=/usr/local
3.8 编译会遇到的问题
Program keycodemapdb/tools/keymap-gen found: NO
../ui/meson.build:106:0: ERROR: Program 'keycodemapdb/tools/keymap-gen' not found
A full log can be found at /home/babepig/qemu/build/meson-logs/meson-log.txt
ERROR: meson setup failed
WARNING: Project targeting '>=0.55.0' but tried to use feature introduced in '0.57.0': test() timeout <= 0.
../tests/fp/meson.build:27:0: ERROR: Include dir berkeley-softfloat-3/source/include does not exist.
A full log can be found at /home/babepig/qemu/build/meson-logs/meson-log.txt
ERROR: meson setup failed
WARNING: Project targeting '>=0.55.0' but tried to use feature introduced in '0.57.0': test() timeout <= 0.
../tests/fp/meson.build:186:0: ERROR: File berkeley-testfloat-3/source/uint128_inline.c does not exist.
A full log can be found at /home/babepig/qemu/build/meson-logs/meson-log.txt
ERROR: meson setup failed
经排错,发现qemu/ui/keycodemapdb ,qemu/tests/fp/berkeley-softfloat-3,qemu/tests/fp/berkeley-testfloat-3这三个文件夹是空的
从git 上下载相应的包替换,https://github.com/orgs/qemu/repositories
3.9 如果configure 加参数后如果编译有错,缺什么deb包就安装什么
- make -j10
- make install
- which qemu-system-x86_64
/usr/local/bin/qemu-system-x86_64
参考:https://blog.csdn.net/weixin_45709295/article/details/120007503
https://www.cnblogs.com/dream397/p/13846845.html