红联Linux门户
Linux帮助

Qemu运行linux 4.9

发布时间:2017-01-13 10:53:44来源:linux网站作者:yearafteryear
1、git clone最新的Qemu代码到本地:
ubuntu@ubuntu-X556UB:~/Qemu$ git clone git://git.qemu-project.org/qemu.git
正克隆到 'qemu'...
remote: Counting objects: 302770, done.
remote: Compressing objects: 100% (56838/56838), done.
remote: Total 302770 (delta 245135), reused 302770 (delta 245135)
接收对象中: 100% (302770/302770), 98.29 MiB | 74.00 KiB/s, 完成.
处理 delta 中: 100% (245135/245135), 完成.
检查连接... 完成。
正在检出文件: 100% (5068/5068), 完成.
 
2、配置Qemu
ubuntu@ubuntu-X556UB:~/Qemu/qemu$ ./configure --target-list=arm-softmmu --audio-drv-list=
ERROR: DTC (libfdt) version >= 1.4.0 not present. Your options:
(1) Preferred: Install the DTC (libfdt) devel package
(2) Fetch the DTC submodule, using:
git submodule update --init dtc
ubuntu@ubuntu-X556UB:~/Qemu/qemu$ git submodule update --init dtc
子模组 'dtc' (git://git.qemu-project.org/dtc.git) 未对路径 'dtc' 注册
正克隆到 'dtc'...
remote: Counting objects: 3521, done.
remote: Compressing objects: 100% (2076/2076), done.
remote: Total 3521 (delta 2600), reused 1937 (delta 1409)
接收对象中: 100% (3521/3521), 800.99 KiB | 495.00 KiB/s, 完成.
处理 delta 中: 100% (2600/2600), 完成.
检查连接... 完成。
子模组路径 'dtc':检出 '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
64位ARM配置
ubuntu@ubuntu-X556UB:~/Qemu/qemu$./configure --target-list=aarch64-softmmu --audio-drv-list=   
ubuntu@ubuntu-X556UB:~/Qemu/qemu$ ./configure --target-list=arm-softmmu --audio-drv-list=
Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin
library directory /usr/local/lib
module directory  /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory  /usr/local/etc
local state directory   /usr/local/var
Manual directory  /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /home/ubuntu/Qemu/qemu
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g
QEMU_CFLAGS       -I/usr/include/pixman-1 -I$(SRC_PATH)/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-Linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong  -I/usr/include/libpng12
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g
make              make
install           install
Python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       arm-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       no
GTK support       yes (2.24.30)
GTK GL support    no
VTE support       no
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no
nettle kdf        no
libtasn1          no
curses support    no
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     
Block whitelist (rw)
Block whitelist (ro)
VirtFS support    yes
VNC support       yes
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
xen support       no
brlapi support    no
bluez  support    no
Documentation     yes
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
COLO support      yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes
Trace backends    log
spice support     no
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no
build guest agent yes
QGA VSS support   no
QGA w32 disk info no
QGA MSI support   no
seccomp support   no
coroutine backend ucontext
coroutine pool    yes
debug stack usage no
GlusterFS support no
Archipelago support no
gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
lzo support       no
snappy support    no
bzip2 support     no
NUMA host support no
tcmalloc support  no
jemalloc support  no
avx2 optimization yes
replication support yes
 
3、make
ubuntu@ubuntu-X556UB:~/qemu$ make
 
4、make install
ubuntu@ubuntu-X556UB:~/qemu$ sudo make install
 
5、查看支持的芯片:
ubuntu@ubuntu-X556UB:~/qemu$ qemu-system-arm -M ?
Supported machines are:
akita                Sharp SL-C1000 (Akita) PDA (PXA270)
ast2500-evb          Aspeed AST2500 EVB (ARM1176)
borzoi               Sharp SL-C3100 (Borzoi) PDA (PXA270)
canon-a1100          Canon PowerShot A1100 IS
cheetah              Palm Tungsten|E aka. Cheetah PDA (OMAP310)
collie               Sharp SL-5500 (Collie) PDA (SA-1110)
connex               Gumstix Connex (PXA255)
cubieboard           cubietech cubieboard
highbank             Calxeda Highbank (ECX-1000)
imx25-pdk            ARM i.MX25 PDK board (ARM926)
integratorcp         ARM Integrator/CP (ARM926EJ-S)
kzm                  ARM KZM Emulation Baseboard (ARM1136)
lm3s6965evb          Stellaris LM3S6965EVB
lm3s811evb           Stellaris LM3S811EVB
mainstone            Mainstone II (PXA27x)
midway               Calxeda Midway (ECX-2000)
musicpal             Marvell 88w8618 / MusicPal (ARM926EJ-S)
n800                 Nokia N800 tablet aka. RX-34 (OMAP2420)
n810                 Nokia N810 tablet aka. RX-44 (OMAP2420)
netduino2            Netduino 2 Machine
none                 empty machine
nuri                 Samsung NURI board (Exynos4210)
palmetto-bmc         OpenPOWER Palmetto BMC (ARM926EJ-S)
raspi2               Raspberry Pi 2
realview-eb          ARM RealView Emulation Baseboard (ARM926EJ-S)
realview-eb-mpcore   ARM RealView Emulation Baseboard (ARM11MPCore)
realview-pb-a8       ARM RealView Platform Baseboard for Cortex-A8
realview-pbx-a9      ARM RealView Platform Baseboard Explore for Cortex-A9
romulus-bmc          OpenPOWER Romulus BMC (ARM1176)
sabrelite            Freescale i.MX6 Quad SABRE Lite Board (Cortex A9)
smdkc210             Samsung SMDKC210 board (Exynos4210)
spitz                Sharp SL-C3000 (Spitz) PDA (PXA270)
sx1                  Siemens SX1 (OMAP310) V2
sx1-v1               Siemens SX1 (OMAP310) V1
terrier              Sharp SL-C3200 (Terrier) PDA (PXA270)
tosa                 Sharp SL-6000 (Tosa) PDA (PXA255)
verdex               Gumstix Verdex (PXA270)
versatileab          ARM Versatile/AB (ARM926EJ-S)
versatilepb          ARM Versatile/PB (ARM926EJ-S)
vexpress-a15         ARM Versatile Express for Cortex-A15
vexpress-a9          ARM Versatile Express for Cortex-A9
virt-2.6             QEMU 2.6 ARM Virtual Machine
virt-2.7             QEMU 2.7 ARM Virtual Machine
virt-2.8             QEMU 2.8 ARM Virtual Machine
virt                 QEMU 2.9 ARM Virtual Machine (alias of virt-2.9)
virt-2.9             QEMU 2.9 ARM Virtual Machine
xilinx-zynq-a9       Xilinx Zynq Platform Baseboard for Cortex-A9
z2                   Zipit Z2 (PXA27x)
 
6、下载内核4.9版本内核linux-4.9.tar.gz并解压到linux-4.9文件夹
https://www.kernel.org/pub/linux/kernel/v4.x/
 
7、 配置内核并编译
ubuntu@ubuntu-X556UB:~/Qemu/linux-4.9$ make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm vexpress_defconfig
HOSTCC  scripts/basic/fixdep
HOSTCC  scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC  scripts/kconfig/zconf.tab.o
HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
ubuntu@ubuntu-X556UB:~/Qemu/linux-4.9$ make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm
 
8、下载busybox并编译安装
git clone https://github.com/mirror/busybox.git
make defconfig
make CROSS_COMPILE=arm-linux-gnueabi-
make CROSS_COMPILE=arm-linux-gnueabi- install
 
9、制作文件系统
sudo mkdir rootfs
sudo cp /home/ubuntu/Qemu/busybox/_install/* -r rootfs/
sudo mkdir rootfs/lib/
sudo cp -P /usr/arm-linux-gnueabi/lib/* rootfs/lib/
sudo mkdir rootfs/dev
sudo mknod rootfs/dev/tty1 c 4 1
sudo mknod rootfs/dev/tty2 c 4 2
sudo mknod rootfs/dev/tty3 c 4 3
sudo mknod rootfs/dev/tty4 c 4 4
dd if=/dev/zero of=a9rootfs.ext3 bs=1M count=32
mkfs.ext3 a9rootfs.ext3
 
10、启动系统
qemu-system-arm -M vexpress-a9 -m 512M -kernel /home/ubuntu/Qemu/linux-4.9/arch/arm/boot/zImage -dtb /home/ubuntu/Qemu/linux-4.9/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "root=/dev/mmcblk0  console=ttyAMA0" -sd /home/ubuntu/Qemu/a9rootfs.ext3
 
本文永久更新地址:http://www.linuxdiyf.com/linux/27771.html