QEMU+ARM+Linux(1)

1.下载Linux kernel
官方地址太慢,用这个http://ftp.sjtu.edu.cn/sites/ftp.kernel.org/pub/linux/kernel/
下载的版本是4.18.11

2.参考qemu+uboot+kernel+nfs文件系统
将下载的文件解压,进入解压后的目录。

 export ARCH=arm
 export CROSS_COMPILE=arm-linux-gnueabi-
 make vexpress_defconfig
 make zImage -j8
 make modules -j8
 #make LOADADDR=0x60003000 uImage -j8
 make dtbs

make zImage -j8时出现告警:
<stdin>:1332:2: warning: #warning syscall io_pgetevents not implemented [-Wcpp]
看了这个系统调用的资料Linux Programmer’s Manual IO_GETEVENTS(2):发现这么两点:
(1)在ERROR中有一项:

ENOSYS io_getevents() is not implemented on this architecture.

(2)在COMFORMING TO中:

io_getevents() is Linux-specific and should not be used in programs that are intended to be portable.

难道在ARM上这个系统调用应该就不实现吗?应该不是吧。
换了4.8.1版本的内核,再按照上述命令编译,既无告警也无错误,那么就用4.8.1的好了,至于上述告警的原因以后再看。

3.在QEMU中启动Linux kernel

qemu-system-arm -M vexpress-a9 -m 512M -kernel arch/arm/boot/zImage -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "console=ttyAMA0"

报错:

qemu-system-arm: cannot set up guest memory 'vexpress.highmem': Cannot allocate memory

搜索了一下是因为分配的内存太大了,于是吧512M改为256M,仿真成功。
最后会出现 end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0),因为还没有文件系统。
Ctrl+a后按x结束仿真。

猜你喜欢

转载自blog.csdn.net/u013213111/article/details/88918108