https://kayhaw.github.io/2019/09/30/QemuLiteInstallation.html
clone源码仓库:git clone git@github.com:intel/qemu-lite.git
子模块初始化:git submodule update --init dtc pixman
apt install python -y apt-get -y install zlib* apt-get install libglib2.0-dev apt-cache search pixman apt-get -y install libpixman-1-dev apt-get install libfdt-dev -y mkdir build cd build ../configure make
/root/kata/qemu-lite/qga/commands-posix.c:660:13: error: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-Werror] *devminor = minor(st.st_rdev); ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors /root/kata/qemu-lite/rules.mak:57: recipe for target 'qga/commands-posix.o' failed make: *** [qga/commands-posix.o] Error 1 root@ubuntu:~/kata/qemu-lite/build#
qga/commands-posix.c
include<sys/sysmacros.h>
CC util/hbitmap.o /root/kata/qemu-lite/util/memfd.c:43:12: error: static declaration of ‘memfd_create’ follows non-static declaration static int memfd_create(const char *name, unsigned int flags) ^~~~~~~~~~~~ In file included from /usr/include/aarch64-linux-gnu/bits/mman-linux.h:115:0, from /usr/include/aarch64-linux-gnu/bits/mman.h:44, from /usr/include/aarch64-linux-gnu/sys/mman.h:41, from /root/kata/qemu-lite/include/qemu/osdep.h:184, from /root/kata/qemu-lite/util/memfd.c:28: /usr/include/aarch64-linux-gnu/bits/mman-shared.h:46:5: note: previous declaration of ‘memfd_create’ was here int memfd_create (const char *__name, unsigned int __flags) __THROW; ^~~~~~~~~~~~ CC util/fifo8.o /root/kata/qemu-lite/rules.mak:57: recipe for target 'util/memfd.o' failed make: *** [util/memfd.o] Error 1 make: *** Waiting for unfinished jobs....
block/blkdebug.c: In function ‘blkdebug_refresh_filename’: block/blkdebug.c:711:31: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4086 [-Werror=format-truncation=] "blkdebug:%s:%s", s->config_file ?: "", ^~ In file included from /usr/include/stdio.h:862:0, from /home/heke/qemu-lite/include/qemu/osdep.h:68, from block/blkdebug.c:25: /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 11 or more bytes (assuming 4106) into a destination of size 4096 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors /home/heke/qemu-lite/rules.mak:59: recipe for target 'block/blkdebug.o' failed make: *** [block/blkdebug.o] Error 1 解决方案:config之后自动生成config-host.mak文件,在文件QEMU_CFLAGS=的最后加上-Werror=format-truncation=0
LINK mips-softmmu/qemu-system-mips Makefile:186: recipe for target 'subdir-mips64-softmmu' failed make: *** [subdir-mips64-softmmu] Error 2 LINK arm-softmmu/qemu-system-arm LINK ppc-softmmu/qemu-system-ppc root@ubuntu:~/kata/qemu-lite/build#
/root/kata/qemu-lite/rules.mak:57: recipe for target 'hw/intc/arm_gic_kvm.o' failed make[1]: *** [hw/intc/arm_gic_kvm.o] Error 1 make[1]: *** Waiting for unfinished jobs.... Makefile:186: recipe for target 'subdir-aarch64-softmmu' failed make: *** [subdir-aarch64-softmmu] Error 2
../configure --disable-libssh2 --disable-tcmalloc --disable-glusterfs --disable-seccomp --disable-{bzip2,snappy,lzo} --disable-usb-redir --disable-libusb --disable-libnfs --disable-tcg-interpreter --disable-debug-tcg --disable-libiscsi --disable-rbd --disable-spice --disable-attr --disable-cap-ng --disable-linux-aio --disable-uuid --disable-brlapi --disable-vnc-{jpeg,png,sasl} --disable-rdma --disable-bluez --disable-curl --disable-curses --disable-sdl --disable-gtk --disable-tpm --disable-vte --disable-vnc --disable-xen --disable-opengl --disable-slirp --target-list=aarch64-softmmu ../configure --disable-libssh2 --disable-tcmalloc --disable-glusterfs --disable-seccomp --disable-{bzip2,snappy,lzo} --disable-usb-redir --disable-libusb --disable-libnfs --disable-tcg-interpreter --disable-debug-tcg --disable-libiscsi --disable-rbd --disable-spice --disable-attr --disable-cap-ng --disable-linux-aio --disable-uuid --disable-brlapi --disable-vnc-{jpeg,png,sasl} --disable-rdma --disable-bluez --disable-curl --disable-curses --disable-sdl --disable-gtk --disable-tpm --disable-vte --disable-vnc --disable-xen --disable-opengl --disable-slirp --target-list=aarch64-softmmu
NOTE: The object files are built at the place where configure is launched root@ubuntu:~/kata/qemu-lite/build# ../configure --help | grep pci xen-pci-passthrough root@ubuntu:~/kata/qemu-lite/build#
install -d -m 0755 "/usr/local/bin" install -c -m 0755 qemu-system-aarch64 "/usr/local/bin" strip "/usr/local/bin/qemu-system-aarch64" root@ubuntu:~/kata/qemu-lite/build# ls /usr/local/bin/ containerd-shim-kata-v2 ivshmem-server kata-runtime qemu-img qemu-nbd ivshmem-client kata-collect-data.sh qemu-ga qemu-io qemu-system-aarch64 root@ubuntu:~/kata/qemu-lite/build#