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

QEMU ARM64 guide

2015年06月15日

simulate a ARM64 environment, and run kernel on it

Steps:

  1. Build Dependancies

    sudo apt-get build-dep qemu
    
  2. Building qemu

    git clone git://git.qemu.org/qemu.git qemu.git
    cd qemu.git
    ./configure –target-list=aarch64-softmmu
    make
    
  3. Building your own rootfs

    git clone git://git.buildroot.net/buildroot buildroot.git
    cd buildroot.git
    make menuconfig
    
  4. Building a kernel

    git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux.git
    cd linux.git
    ARCH=arm64 make menuconfig
    ARCH=arm64 make -j 8
    
  5. Following Configurations are enabled in .config

    CONFIG_CROSS_COMPILE=”aarch64-linux-gnu-” # needs to match your cross-compiler prefix
    CONFIG_INITRAMFS_SOURCE=”/home/kennedy/dev/buildroot/output/images/rootfs.cpio” # points at your buildroot image
    CONFIG_NET_9P=y # needed for virtfs mount
    CONFIG_NET_9P_VIRTIO=y
    

For cross compilation i’m using gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz tool chain.

visit my blog install linaro compiler


run the kernel from .img

qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic -smp 1 -m 2048 -kernel aarch64-linux-3.15rc2-buildroot.img  --append "console=ttyAMA0"

run kernel Image

qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic -smp 1 -m 2048 -kernel /home/kennedy/dev/kernel/linux-3.19.8/arch/arm64/boot/Image  --append "console=ttyAMA0"

debugging kernel

qemu-system-aarch64 -s -S -machine virt -cpu cortex-a57 -machine type=virt -nographic -smp 1 -m 2048 -kernel /home/kennedy/dev/kernel/linux-3.19.8/arch/arm64/boot/Image  --append "console=ttyAMA0"
$cd linux-3.19.3
$aarch64-linux-gnu-gdb
$file vmlinux
$target remote localhost:1234
$b start_kernel
$c
$n 

qemu-img

show the file info(format, size, etc.)

kennedy@kennedy-virtual-machine  ~/arm64  qemu-img info ubuntu-14.04-server-cloudimg-arm64-disk1.img
image: ubuntu-14.04-server-cloudimg-arm64-disk1.img
file format: qcow2
virtual size: 2.2G (2361393152 bytes)
disk size: 311M
cluster_size: 65536
Format specific information:
    compat: 0.10
    refcount bits: 16

qemu-nbd

mount img file on filesystem

sudo modprobe nbd max_part=63
sudo qemu-nbd -c /dev/nbd0 ubuntu-14.04-server-cloudimg-arm64-disk1.img
mkdir mnt
sudo mount /dev/nbd0p1 mnt

search and copy files

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

umount

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

reference

http://www.bennee.com/~alex/blog/2014/05/09/running-linux-in-qemus-aarch64-system-emulation-mode/

http://blog.csdn.net/jefbai/article/details/44901447