国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Virtual ARM Linux environment

2024-06-28 15:59:51
字體:
來源:轉載
供稿:網友
If you need to test ARM-specific code but don't have (or need) real ARM hardware for testing, you can set up a virtual ARM environment running Ubuntu linux in the QEMU emulator. This is the same emulator system used by the Firefox OS Simulator.Note: In this article, we'll be making use of Linux distributions and other software PRovided by Linaro, which provides distributions customized for various ARM hardware.PrerequisitesThis article assumes that the computer on which you'll be running the virtual ARM environment is Ubuntu Linux. This makes setup easier, since it's much easier to install the required software from external repositories. It's possible to set up this simulation on other platforms but that is not (yet) covered here.Select a target board and CPUQEMU is capable of emulating a variety of boards and ARM CPUs. At the time of writing, the author of this article was only able to get the Versatile Expressboard to work with more than 256 MB of RAM, so for the purposes of this article we'll use that one, and we'll use the Cortex A9 (ARMv7) CPU.Install the required softwareFirst, we need to tell the package manager to allow us to use Linaro's repository, since it contains the tools we'll need as well as recent versions of the QEMU simulator package. We need to be using at least QEMU 0.15*.sudo add-apt-repository ppa:linaro-maintainers/toolsNext, we install the Linaro tools and the QEMU packages:sudo apt-get install linaro-image-tools qemu-user-static qemu-systemIf you want to be able to cross-compile using your host computer to build code to run on the simulator, you'll need to install the GCC packages for doing so:sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabiDownload a Linaro release and hardware packYou can find suitable release and hardware pack tarballs on the Linaro release page. Some of them might work, others might not; you may have to experiment in order to come up with a combination that adequately simulates the environment you want to simulate. Those used in the instructions below worked well at the time this article was written.wget http://releases.linaro.org/platform/linaro-n/nano/alpha-3/linaro-natty-nano-tar-20110302-0.tar.gz wget http://releases.linaro.org/platform/linaro-n/hwpacks/alpha-3/hwpack_linaro-vexpress_20110302-0_armel_supported.tar.gzCreate the VM disk imageUsing the Linaro tools, you can easily create an SD card image from the downloaded packs. This will take a while, so be patient.linaro-media-create --image_file vexpress.img --dev vexpress / --binary linaro-natty-nano-tar-20110302-0.tar.gz / --hwpack hwpack_linaro-vexpress_20110302-0_armel_supported.tar.gzNote: These instructions were derived from Versatile Express support in QEMU, with some modification.Extracting the kernel and initrdThe VM image we just created contains the kernel and initrd for our machine. We need to extract them from the VM so QEMU can use them.First, we mount the image at /mnt/tmp. The snippet below finds the correct partition in the image and mounts it.sudo mount -o loop,offset="$(file vexpress.img | awk 'BEGIN { RS=";"; } /partition 2/ { print $7*512; }')" / -t auto vexpress.img /mnt/tmpNext, copy the kernel and initrd files from the VM image.Note: The actual names of the files might vary slightly in your build.cp /mnt/tmp/vmlinuz-2.6.38-1000-linaro-vexpress . cp /mnt/tmp/initrd.img-2.6.38-1000-linaro-vexpress .To make the kernel and initrd files easier to refer to, we can create symlinks:ln -s vmlinuz-2.6.38-1000-linaro-vexpress vmlinuzln -s initrd.img-2.6.38-1000-linaro-vexpress initrd.imgStarting QEMUYou can now start QEMU with the following command:qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -kernel ./vmlinuz / -initrd ./initrd.img -redir tcp:2200::22 -m 512 / -append "root=/dev/mmcblk0p2 vga=normal mem=512M devtmpfs.mount=0 rw" / -drive file=vexpress.img,if=sd,cache=writebackSome explanation of the non-obvious options:The ''-redir tcp:2200::22'' redirects TCP traffic on the host port 2200 to the guest machine (QEMU) port 22. This will allow us to SSH into the machine later by connecting to localhost on port 2200.The ''-m 512'' specifies that we want 512 MB of RAM. You can adjust this, but make sure you also change it in the ''-append'' string.The ''-drive file=vexpress.img,if=sd,cache=writeback'' attaches our images as an SD card. According to people at Linaro, this way provides faster I/O compared to the traditional ''-sd'' option.After starting the machine, you should end up with a Linux shell in the QEMU window after some startup time.Using SSHTo use SSH to connect to the VM, you first need to bring up its network and install the SSH server package.Bring up network temporarily using the following commands in the simulator:ifconfig eth0 updhclient eth0Now install SSH:apt-get install openssh-serverTo make the network changes permanent, edit the file /etc/network/interfaces (you can use the vi editor, for instance) and add the following lines:auto eth0 iface eth0 inet dhcpFinally, set a passWord for root using the passwd command, reboot the virtual machine and see if you are able to SSH into it by typing the following command into a terminal window on the host:ssh -p2200 root@localhost
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 寿阳县| 梧州市| 永昌县| 通许县| 古田县| 尖扎县| 蛟河市| 德阳市| 湟源县| 太和县| 璧山县| 沛县| 许昌市| 和平县| 荣成市| 马鞍山市| 天长市| 五常市| 霍城县| 麟游县| 谢通门县| 岑溪市| 平昌县| 朔州市| 西安市| 永胜县| 梧州市| 郓城县| 上犹县| 会东县| 若尔盖县| 大同市| 尚义县| 姜堰市| 青田县| 连山| 上虞市| 旬阳县| 剑川县| 玉溪市| 古交市|