首页 > Linux操作系统 > Linux操作系统 > 从源代码编译静态qemu
转:http://logan.tw/posts/2018/02/18/build-qemu-user-static-from-source-code/
qemu-user-static is an important tool for cross-architecture developers. It allows developers to create a chroot environment and run the cross-compiled programs. For example, a developer may run an AArch64 executable without the overhead of system-level emulation.
I usually install the qemu-user-static binaries from Ubuntu apt repository. However, I encountered some bugs that have been fixed in the QEMU upstream but the fixes haven't been back ported to the Ubuntu deb package. Thus, I decided to build qemu-user-static from source code.
Install the QEMU build dependencies with:
$ sudo apt-get build-dep qemu
Download QEMU source code with:
$ git clone git://git.qemu.org/qemu.git
$ cd qemu
$ git submodule update --init --recursive
Configure QEMU with --static, --disable-system, and --enable-linux-user:
$ ./configure \ --prefix=$(cd ..; pwd)/qemu-user-static \ --static \ --disable-system \ --enable-linux-user
Note
Specifying --disable-system disables softmmu targets. It is a known issue that softmmu targets rely on some shared libraries. Those softmmu targets will cause link error if --static is specified.
Build and install QEMU with:
$ make -j8
$ make install
Add -static suffix to executables so that qemu-debootstrap can pick up these executables:
$ cd ../qemu-user-static/bin
$ for i in *; do cp $i $i-static; done
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30104372/viewspace-3139427/ ,如需转载,请注明出处,否则将追究法律责任。