Gsnova on Heroku build Systemd Debian system initialization manage multi id_rsa ubuntu 64bits cannot run 32bits app REHL power auditing Debug Assembly for ARMv8 on QEMU ARM体系结构--寄存器 Run Debian iso on QEMU ARMv8 QEMU ARM64 guide cross compiler install buildroot install QEMU install python入门--数据结构 python入门--内置数据类型 python入门--类 异常 python入门--条件表达式 方法 python入门--数字 字符串 数组 RTC驱动分析 块设备驱动 TCP UDP socket 触摸屏驱动 USB驱动 LED按键中断 LCD 驱动 驱动信号 根文件系统 实验 内核实验 字符设备驱动程序 绪论 uboot 实验 LCD 实验 系统时钟和UART 中断控制器 Nand Flash控制器 MMU 实验 储存管理器实验 GPIO实验 点亮LED 编译加载驱动 制作烧写内核 dnw替代方法 MINI2440 TQ2440安装配套Linux 使用NFS 制作烧写跟文件系统 grub引导Windows 烧写裸版程序-linux Ubuntu 网络没有 eth0 Linux自动挂载 烧写裸板程序 电路基础 Mac词典 Vim插件 Assembly 综合研究 Assembly 指令总结 Assembly 直接定址表 Assembly 使用BIOS进行键盘输入和磁盘读写 Assembly 外中断 Assembly 端口 Assembly int指令 Assembly 内中断 Assembly 标志寄存器 Assembly 转移指令的原理 Assembly Call和ret指令 Assembly 数据处理两个基本问题 Assembly 灵活定位内存地址 Assembly 包含多个段的程序 Assembly [bx] loop Assembly 第一个程序 Assembly 寄存器 (内存访问) Assembly 寄存器 AWS VPN with EC2 hidden file in picture(linux) Assembly 基础 idea shortcuts 常用快捷键 idea plugin folder install ruby and jekyll

Run Debian iso on QEMU ARMv8

2015年06月16日

Run Debian iso on QEMU ARMv8

Pre-installation

download the debian iso

I used iso name is : debian-8.1.0-arm64-CD-1.iso

create img file and QEFI flash

$ dd if=/dev/zero of=flash0.img bs=1M count=64
$ LINARO_EDK2_URL=http://releases.linaro.org/15.01/components/kernel/uefi-linaro/
$ wget $LINARO_EDK2_URL/release/qemu64-intelbds/QEMU_EFI.fd
$ dd if=QEMU_EFI.fd of=flash0.img conv=notrunc
$ dd if=/dev/zero of=flash1.img bs=1M count=64
$ dd if=/dev/zero of=hda.img bs=1M count=8192

lanuch.sh:

#!/bin/sh

CDROM_IMG=debian-8.1.0-arm64-CD-1.iso
HDA_IMG=hda.img

make_cdrom_arg()
{
  echo "-drive file=$1,id=cdrom,if=none,media=cdrom" \
    "-device virtio-scsi-device -device scsi-cd,drive=cdrom"
}

make_hda_arg()
{
  echo "-drive if=none,file=$1,id=hd0" \
    "-device virtio-blk-device,drive=hd0"
}

HDA_ARGS=`make_hda_arg $HDA_IMG`
if [ $# -eq 1 ]; then
  case $1 in
    install)
      CDROM_ARGS=`make_cdrom_arg $CDROM_IMG`
      ;;
    *)
      CDROM_ARGS=""
      ;;
  esac
fi

qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic \
  -pflash flash0.img \
  $CDROM_ARGS $HDA_ARGS -netdev user,id=eth0 \
  -device virtio-net-device,netdev=eth0 

execute ./lanuch.sh install

Then will show you install screen

after install

sudo modprobe nbd max_part=63
sudo qemu-nbd -c /dev/nbd0 hda.img
mkdir mnt
sudo mount /dev/nbd0p2 mnt #Your rootfs partition, you can have a try nbd0p1~pN


sudo cp mnt/boot/vmlinuz-3.13.0-53-generic .
sudo cp mnt/boot/initrd.img-3.13.0-53-generic .


sudo umount mnt
sudo qemu-nbd -d /dev/nbd0
rmdir mnt

trouble shotting

nbd.c:nbd_init():L723: Failed to set NBD socket

ps -ef | grep "qemu"

kill qemu-nbd process and retry


qemu: fatal: Trying to execute code outside RAM or ROM at 0xffffffc000080000

there is something wrong with the kernel, do not use vmlinux, use vmlinuz and check the kernel version

run debian on QEMU

qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 2048 \
    -pflash flash0.img \
  -drive if=none,file=hda.img,id=hd0 \
  -device virtio-blk-device,drive=hd0 \
    -kernel vmlinuz-3.16.0-4-arm64 \
    -initrd initrd.img-3.16.0-4-arm64 \
    -netdev user,id=unet -device virtio-net-device,netdev=unet \
    --append "console=ttyAMA0 root=/dev/vda2"

how to share files between QEMU and host

There is a ponderous way to share files between QEMU and host:

create a img for share files.

dd if=/dev/zero of=share.img bs=1M count=1024
mkfs.ext4 share.img
mkdir mnt
mount -o loop share.img mnt

add the img file on the command to boot the QEMU

qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 2048 \
    -pflash flash0.img \
    -drive file=debian-8.1.0-arm64-CD-1.iso,id=cdrom,if=none,media=cdrom \
    -device virtio-scsi-device -device scsi-cd,drive=cdrom \
  -drive if=none,file=share.img,id=hd1 \
  -device virtio-blk-device,drive=hd1 \
  -drive if=none,file=hda.img,id=hd0 \
  -device virtio-blk-device,drive=hd0 \
    -kernel vmlinuz-3.16.0-4-arm64 \
    -initrd initrd.img-3.16.0-4-arm64 \
    -netdev user,id=unet -device virtio-net-device,netdev=unet \
    --append "console=ttyAMA0 root=/dev/vda2"

reference

http://blog.eciton.net/uefi/qemu-aarch64-jessie.html