Openwrt使用Qemu仿真开发。
来源:互联网 发布:ubuntu设置屏幕分辨率 编辑:程序博客网 时间:2024/06/08 10:06
在QEMU MIPS仿真器上实现本机编译(Native Compiling on a QEMU Emulator)
QEMU是一款开源的虚拟机和仿真器软件。它提供了MIPS系统的仿真器(目前不支持图形卡仿真,只能运行于字符终端方式),使我们可以在x86平台上安装运行Debian Linux for MIPS,从而在其中进行本机编译。本文将详细介绍在Ubuntu 9.10上安装部署的过程。While::beging:
qemu-system-mips -M malta -m 128 -kernel vmlinux-2.6.32-5-4kc-malta -hda hda.img -append "root=/dev/sda1 console=ttyS0" -nographic -no-reboot
首先安装QEMU软件包:
$ sudo apt-get install qemu qemu-common qemu-kvm qemu-kvm-extras
(二)下载Debina网络安装映像文件
$ wget http://ftp.de.debian.org/debian/dists/lenny/main/installer-mipsel/current/images/malta/netboot/vmlinux-2.6.26-2-4kc-malta
$ wget http://ftp.de.debian.org/debian/dists/lenny/main/installer-mipsel/current/images/malta/netboot/initrd.gz
现在网址改作http://ftp.de.debian.org/debian/dists/stable/main/installer-mips/current/images/malta/netboot/initrd.gz$ wget http://ftp.de.debian.org/debian/dists/lenny/main/installer-mipsel/current/images/malta/netboot/initrd.gz
其中vmlinux-2.6.26-2-4kc-malta是内核,initrd.gz是用于网络安装的引导RAM Disk。
注:Malta是MIPS Technologies公司设计的一款开发板,QEMU提供了针对Malta板的仿真。
(三)创建硬盘映像文件
为安装Debian Linux操作系统准备一个10GB的虚拟磁盘。QEMU支持多种磁盘映像格式,其中qcow2是功能最多最好用的一种格式。
$ qemu-img create -f qcow2 hda.img 10G
新建的磁盘映像只占用很少的空间,随着使用才逐渐扩张直至达到设定的10G。(四)安装Debian Linux for MIPS
***安装过程需要一直连接互联网,安装可能会花费数小时***
qemu-system-mips -M malta -m 128 -kernel vmlinux-2.6.32-5-4kc-malta -initrd initrd.gz -hda hda.img -append "root=/dev/ram console=ttyS0" -nographic -no-reboot
$ qemu-system-mipsel -M malta-m 128 -kernel vmlinux-2.6.26-2-4kc-malta -initrd initrd.gz -hda hda.img -append "root=/dev/ram console=ttyS0" -nographic -no-reboot
2. 启动后会自动进入安装程序,首先是选择语言和国家。语言选择English,国家选Other -> Asia -> China
3. 配置网络:输入主机名、域名,选择Debian镜像服务器以及配置代理服务器
4. 磁盘分区
5. 开始下载并安装基本系统
6. 设置用户/口令:设置root口令以及新建一个普通用户
...截图略过...
7. 选择安装软件:只选择标准系统(Standard system)
忽略"No boot loader installed"警告并继续
8. 安装完成
(五)启动系统
$ qemu-system-mipsel -M malta-m 128 -kernel vmlinux-2.6.26-2-4kc-malta-hda hda.img -append "root=/dev/hda1 console=ttyS0" -nographic -no-reboot
用上面的命令启动安装好的Debian系统,此时QEMU将使用默认的网络配置,只能从客户机访问外部网络。如果希望客户机对外提供网络服务,如telnet,ssh,ftp等,则需要配置tap网络接口,详细步骤可参考文章:QEMU/Networking
(六)部署本机编译环境
本机编译工具链仍使用我自制的根文件系统:mipsel-native-toolchain-gcc442-uc0928-rootfs.tar.bz2 (如果不能下载请尝试此链接)
下面操作在客户机上进行:
1. 解压工具链
# mkdir /toolchain-root
# cd /toolchain-root
# tar jxf /path/to/mipsel-native-toolchain-gcc442-uc0928-rootfs.tar.bz2
# cd /toolchain-root
# tar jxf /path/to/mipsel-native-toolchain-gcc442-uc0928-rootfs.tar.bz2
2. 客户机启动时自动为/toolchain-root绑定/proc,/sys,/dev,/tmp等伪文件系统。把下面的内容加入/etc/rc.local末尾处exit 0前面
# bind psudo filesystems for /toolchain-root
mount --bind /proc /toolchain-root/proc
mount --bind /sys /toolchain-root/sys
mount --bind /dev /toolchain-root/dev
mount -t tmpfs tmpfs /toolchain-root/tmp
mount --bind /proc /toolchain-root/proc
mount --bind /sys /toolchain-root/sys
mount --bind /dev /toolchain-root/dev
mount -t tmpfs tmpfs /toolchain-root/tmp
3. 进入本机编译环境
# chroot /toolchain-root /bin/sh
BusyBox v1.15.3 (2010-04-08 22:24:27 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
#
BusyBox v1.15.3 (2010-04-08 22:24:27 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
#
我安装的Debian Linux + 本机编译工具的磁盘映像文件可以在这里下载,供大家参考。root口令就是root。
- Openwrt使用Qemu仿真开发。
- Openwrt使用Qemu仿真
- QEMU 仿真嵌入式开发
- 使用 QEMU 进行系统仿真
- 使用 QEMU 进行系统仿真
- 使用 QEMU 进行系统仿真
- 使用 QEMU 进行系统仿真
- 使用 QEMU 进行系统仿真
- 使用 QEMU 进行系统仿真
- 使用 QEMU 进行系统仿真
- 使用QEMU仿真ARM Linux系统
- 使用qemu 建立mini2440的模拟仿真环境
- 使用qemu 建立mini2440的模拟仿真环境
- 在linux上使用QEMU 进行系统仿真
- 使用qemu 建立mini2440的模拟仿真环境
- qemu for mini2440 OpenWrt
- qemu skyeye 仿真
- QEMU 仿真 rtems pc386
- Android中事务Thread 和Toast使用时注意
- 利用nginx实时生成缩略图
- C#汉字转换拼音技术详解(高性能)
- POJ 1038 Bugs Integrated, Inc.3进制压缩
- mysql调优三步曲(慢查询、explain profile)
- Openwrt使用Qemu仿真开发。
- What is the difference between distributed and parallel processing operating system?
- 我怀念的是
- boost::variant
- 时间预估2 mathematica程序
- Working with Multicast Sockets
- Subversion服务器搭建
- 我的第一个JAVA程序,请各位老师多多指教
- ListView字母快速索引 自动搜索