ubuntu X86环境构建ARM虚拟机

本文介绍了如何在Ubuntu x86环境下构建ARM虚拟机,包括获取QEMU源码并编译、编译内核、使用Busybox、OpenEmbedded和Ubuntu根文件系统、设置virtio-net设备、virtFS以及通过NFS挂载根文件系统。还提到了Fedora和OpenSuse根文件系统的使用方法,并提供了相关资源链接。
摘要由CSDN通过智能技术生成

Prerequisite: the aarch64 cross-compile chain which can download from Linaro.

 

1. Get the qemu source code

git clone git://git.qemu-project.org/qemu.git

2. Compile the qemu source code

    cd qemu/

    ./configure --target-list=aarch64-softmmu

    make 

 Then will get the binary 'qemu-system-aarch64' in the 'qemu/aarch64-softmmu/'

3. Compile the kernel

    git clone http://rnd-github.xxxx.com/kernel/xxx.git

    cd xxx/

    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig

    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image

    Then will get the kernel image 'Image' in the 'hulk/arch/arm64/boot/'.

4. Use the busybox

    1) Download the source code 

http://busybox.net/downloads/busybox-1.22.1.tar.bz2

    2)Decompression

    

tar jxvf busybox-1.22.1.tar.bz2

    3)Buid code

    cd busybox-1.22.1/

    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig

    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig

    make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- install

  Build BusyBox as a static binary (found in 'Busybox Settings --> Build Options')

    cd _install/

    mkdir proc sys dev etc etc/init.d

    cd ..

    create a new _install/etc/init.d/rcS with the following content

        #!/bin/sh

        mount -t proc none /proc

        mount -t sysfs none /sys

        /sbin/mdev -s

  

chmod +x _install/etc/init.d/rcS
cd _install

find . | cpio -o --format=newc > ../rootfs.img

cd ..

gzip -c rootfs.img > rootfs.img.gz

    2) Run QEMU with the busybox

    cd qemu/

    ./aarch64-softmmu/qemu-system-aarch64 \

        -machine virt -cpu cortex-a57 \

        -kernel <kernel-dir>/arch/arm
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值