嵌入式 arm linux 虚拟机

嵌入式 arm linux 虚拟机

0x01 环境搭建

​ 使用虚拟机在windos下安装ubuntu操作系统,在虚拟机ubuntu系统内安装开发工具链,并且虚拟机ubuntu系统内使用qume虚拟IMX6ULL开发板。

参考

http://wiki.100ask.org/Qemu

开发板使用NFS连接主机文件系统

ubuntu:

安装NFS

1
sudo apt-get install nfs-kernel-server

修改/etc/exports

1
2
[文件目录]  *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
/home/vacabun/nfs_rootfs *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)

重启NFS服务

1
sudo /etc/init.d/nfs-kernel-server restart

开发板:

挂载主机nfs目录

1
2
mount -t nfs -o nolock,vers=3 192.168.21.129:[文件目录] /mnt
mount -t nfs -o nolock,vers=3 192.168.21.129:/home/vacabun/nfs_rootfs /mnt

0x02 第一个程序

在主机上编译arm指令程序

新建文件hello.c

1
2
3
4
5
6
#include <stdio.h>

int main()
{
printf("Hello world!\r\n");
}

编译

IMX6ULL工具链前缀是 arm-linux-gnueabihf-

1
arm-linux-gnueabihf-gcc -o hello hello.c

开发板执行程序

1
2
[root@qemu_imx6ul:/mnt/code/arm_linux/hello]# ./hello
Hello world!