qemu-6.1 版本编译

qemu-6.1 版本编译

  1. 编译环境:主机ubuntu 20.04 版本, python版本>=3.6
    ubuntu 20.04 源自带的qemu安装后,不支持gtk, 所以需要自己编译

  2. 源码下载:https://github.com/qemu/qemu/tree/stable-6.1 或https://download.qemu.org

  3. 编译步骤:
    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包就安装什么

  1. make -j10
  2. make install
  3. 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值