Install Ubuntu 15.10 ARM64 inside of Qemu

6 篇文章 0 订阅

In previous post, I described how to run ARM64 Linux inside Qemu. But that is stock Linux. In this post, I will describe how to install Ubuntu 15.10 for ARM64 platform inside Qemu.

There are two types of Ubuntu can be installed in Qemu. The first is to use Ubuntu Cloud image. But it needs setup ssh key to connect to it. And it is an installed image. I can play it without any customization or installation. I don’t like it. I don’t want a image which can be deployed on Amazon cloud. The second one is what I will describe here. It is to install Ubuntu from scratch! Just like we did on real system.

  1. Download kernel and initrd from Ubuntu web site. Please note that these two files are only used for boot and installation. After we installed Ubuntu on Hard Disk, we don’t need them anymore.
  2. Create a qcow2 image as Hard Disk. I set the size as 10G. It should be enough for light use.

    qemu-img create -f qcow2 ubuntu.qcow2 10G

  3. Boot qemu by using above kernel、initrd. The qcow2 is as the HD. It takes for a while. I recommend to read some articles like this one.

    qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 512 -kernel linux -initrd initrd.gz --append "earlyprintk console=ttyAMA0 root=/dev/sda1" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -redir tcp:2222::22 -drive if=none,file=ubuntu.qcow2,id=hd0 -device virtio-blk-device,drive=hd0

  4. During above installation, flash boot will be failed. But it doesn’t matter.
  5. After that, we get qcow2 image which Ubuntu installed on that. Then we need to retrieve Ubuntu’s vmlinuz and initrd.img from it.

    sudo modprobe nbd max_part=16 sudo qemu-nbd -c /dev/nbd0 ubuntu.qcow2 mkdir -p /mnt sudo mount /dev/nbd0p1 /mnt mkdir -p boot sudo cp -rf /mnt/* boot/ sudo umount /mnt sudo qemu-nbd -d /dev/nbd0 sudo killall qemu-nbd`

  6. Now we have all we need to boot up ARM64 based Ubuntu inside Qemu! Let run it.

    qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 8 -m 512 -kernel vmlinuz -initrd initrd.img --append "earlyprintk console=ttyAMA0 root=/dev/vda2 init=/sbin/init" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -redir tcp:2222::22 -drive if=none,file=ubuntu.qcow2,id=hd0 -device virtio-blk-device,drive=hd0

原文: https://zhiyisun.github.io/2016/02/04/Install-Ubuntu-1510-ARM64-Inside-of-Qemu.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值