qemu模拟A9/A15运行Linux4.2.3
根據(jù)http://www.linuxidc.com/Linux/2012-07/65478p2.htm修改
主機(jī)運(yùn)行操作系統(tǒng),deepin2015
http://www.deepin.org/
sudo apt-get install qemu-system-arm
2.安裝arm編譯工具
sudo apt-get install gcc-arm-linux-gnueabi
3.下載Linux內(nèi)核
https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.2.3.tar.xz
修改Makefile,
ARCH = arm
CROSS_COMPILE = arm-linux-gnueabi-
運(yùn)行命令
make vexpress_defconfig //該文件在目錄arch/arm/configs下
make
創(chuàng)建目錄 qemu_a9
mkdir ~/qemu_a9
復(fù)制zImage和設(shè)備樹到 qemu_a9 目錄
cp arch/arm/boot/zImage ~/qemu_a9
cp arch/arm/boot/dts/vexpress-v2p-ca9.dtb ~/qemu_a9
4.下載busybox
http://www.busybox.net/downloads/busybox-1.23.2.tar.bz2
同樣修改Makefile,
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-gnueabi-
安裝依賴包
sudo apt-get install libncurses5-dev
運(yùn)行命令
make defconfig
make menuconfig
選中Busybox Settings ?--->Build Options ?--->Build BusyBox as a static binary (no shared libs)
運(yùn)行命令
make busybox
make install
默認(rèn)會把文件系統(tǒng)放到_install目錄下
5.制作根文件系統(tǒng):
cd ~/qemu_a9
dd if=/dev/zero of=a9rootfs.ext3 bs=1M count=32
sudo mkfs.ext3 a9rootfs.ext3
mkdir a9rootdir
sudo mount -t ext3 a9rootfs.ext3 a9rootdir/ -o loop
sudo cp busybox-1.23.2/_install/* ~/qemu_a9/a9rootdir/ -r
cd ~/qemu_a9/a9rootdir
sudo mkdir dev etc lib proc sys tmp mnt
sudo vim etc/fstab
輸入下面內(nèi)容
proc ? ?/proc ? proc ? ?defaults ? ? ? ?0 ? ? ? 0
sysfs ? /sys ? ?sysfs ? defaults ? ? ? ?0 ? ? ? 0
tmpfs ? /tmp ? ?tmpfs ? defaults ? ? ? ?0 ? ? ? 0
tmpfs ? /dev ? ?tmpfs ? defaults ? ? ? ?0 ? ? ? 0
創(chuàng)建init.d目錄
sudo mkdir etc/init.d
sudo vim etc/init.d/rcS
輸入如下內(nèi)容
#!/bin/sh
mount -a
mdev -s
添加可執(zhí)行權(quán)限
sudo chmod +x etc/init.d/rcS
卸載
cd ~/qemu_a9
sudo umount ~/qemu_a9/a9rootdir/
5.運(yùn)行編譯的內(nèi)核
qemu-system-arm -nographic -sd a9rootfs.ext3?-M vexpress-a9 -m 512M -kernel zImage -dtb vexpress-v2p-ca9.dtb ?-smp 4 -append "init=/linuxrc root=/dev/mmcblk0 rw rootwait earlyprintk console=ttyAMA0" 2>/dev/null
帶lcd的
qemu-system-arm -sd a9rootfs.ext3 -M vexpress-a9 -m 512M -kernel zImage -dtb vexpress-v2p-ca9.dtb? -append "init=/linuxrc root=/dev/mmcblk0 rw rootwait" -net nic -net user -smp 4
當(dāng)然也可以模擬A15
qemu-system-arm -sd a9rootfs.ext3 -M vexpress-a15 -m 512M -kernel zImage -dtb vexpress-v2p-ca15-tc1.dtb -append "init=/linuxrc root=/dev/mmcblk0 rw rootwait console=ttyAMA0" -nographic -smp 2
qemu-system-arm -sd a9rootfs.ext3 -M vexpress-a15 -m 512M -kernel zImage -dtb vexpress-v2p-ca15-tc1.dtb? -append "init=/linuxrc root=/dev/mmcblk0 rw rootwait" -net nic -net user -smp 2
總結(jié)
以上是生活随笔為你收集整理的qemu模拟A9/A15运行Linux4.2.3的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux 内核启动流程
- 下一篇: 《射雕英雄传》中已逝的17位演员,以为他