I'm trying to develop a custom machine in QEMU and kind of successful in doing so. Now I want to build a module that can communicate with QEMU to provide some inputs to QEMU and interact with it.
I have chosen MATLAB to build a model that interfaces with my custom machine in QEMU. I know MATLAB has Embedded coder interface and QEMU add on that runs QEMU as third party software internally(downloads the QEMU itself).
But since I have customized QEMU for my machine, how do I interface MATLAB with custom QEMU?
I thought it would be something like running QEMU as
qemu-system-arm -machine x -s -S -kernel x.elf so that when I run QEMU with -s it listens on a port and communicate with other modules. Is this possible with MATLAB? Or is there any other way?
Related
I install qemu-system-arm in Ubuntu 16.04 to run firmware of dlink DIR868L. But when I use the command chroot ./squashfs-root/ /bin/sh, it just shows Illegal instruction. I get squashfs-root/from DIR868LB1_FW203b01.bin by binwalk and I am sure that /bin/sh exists in squashfs-root/.
I start qemu by sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1" -net nic -net tap and use scp to cpoy squashfs-root/ into virtual mechine. And I met the same problem when using debian_wheezy_armel_standard.qcow2
What should I do ? It has bothered me for the whole afternoon.
Or can anyone give me an example to run the arm firmware in qemu ? I only find lots of examples using firmware based on mips.
Thanks a lot !
The problem is almost certainly because whatever CPU is in the DIR868lL is newer than the ARM926 CPU that the "versatilepb" board has. If the binaries from that firmware are built to use newer instructions, then running them in an emulation of an older CPU will result in an 'illegal instruction' signal, just as if you'd run them on real older ARM hardware.
This is similar to taking binaries that were built for a Core2 Duo and trying to run them on your old Pentium system: it won't work.
I am trying to create an ARM virtual machine for my code and I want to have at least 3 network interfaces in the VM (bridged to interfaces in the host), I tried to do it in many different ways but again and again, it get only 1 interface (eth0)
I tried to run qemu in this way:
sudo qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel zImage -dtb vexpress-v2p-ca15-tc1.dtb -no-reboot -initrd initramfs.cpio.anp.gz -nographic -append 'console=ttyAMA0,115200' -net nic,name=eth0 -net tap,ifname=tap0 -net nic,name=eth1 -net tap,ifname=tap1}
but I get only eth0 in my guest OS.
How can I add eth1/eth2 to the VM?
You can't do this with vexpress-a15 -- it is a model of a specific development board which in hardware has only one ethernet adaptor and no PCI bus you could use to plug more ethernet devices into.
Unless you have a strong requirement to use vexpress-a15 in particular I would recommend using the "virt" board instead, which is much more flexible and in particular has a PCI bus that you can use to provide the number of ethernet devices you need. (You'll probably need to rebuild your kernel appropriately and you'll need to tweak your commandline too.)
I'm working on creating file that I can load with -kernel option of qemu. I mostly mind here u-boot config file that I have found information should be placed somewhere in file. That file have to contain u-boot binary, freebsd kernel and RTOS to run ( so i can choose which kernel to load or do some experimental developement in loading 2 OS at same time - eg. FreeBSD is loaded by u-boot and then FreeBSD loads FreeRTOS on 2nd core - so called ASMP ). It seems there is no tools around to do that in automatic way ( I mean supporting multiple kernels in one flash file ). So I need to know how is u-boot flash file structured to make my own and pass it to qemu emulating am versatilepb.
qemu-system-arm -M versatilepb -m 128M -nographic -kernel myflashfile
So the answer here depends in part on the board you are emulating with QEMU. Next, unfortunately the versatilepb has been dropped from mainline U-Boot some time ago (and being ARM926EJS it is not the ideal core for ASMP, you may wish to try vexpress a9 instead). Now, all of that said, you want -pflash to pass along a binary file you control the contents of as the parallel flash device used by the machine. And you lay that out however you like since you're still using -kernel u-boot.bin to boot the machine. You may however find it easier to use -tftp /some/dir and load the files via the network instead.
Can a new machine type be added for qemu-system-arm -M <MachineType> without having to recompile qemu or write code? Are there docs to do this? I would like to be able to emulate raspberry pi and pandaboard using qemu.
I know that meego's fork of qemu supports pandaboard, but I am trying to stick with the main stream qemu that I can manage from the apt-get package manager. the main stream qemu now supports beagleboard rev C and beagleboard xm that were previously supported only in the meego fork.
without having to recompile qemu or write code?
No. There must be some code doing the device specific emulation, like for example the way the Raspberry Pi or the Pandaboard implement video output. This is not a matter of just a few config files.
I've been able to emulate the Pi with -M versatilepb: https://raspberrypi.stackexchange.com/questions/165/emulation-on-a-linux-pc/53991#53991 and -M raspi2 has was later added in QEMU 2.6.
Maybe this feature is feasible to implement, see my experience with adding a new platform device: How to add a new device in QEMU source code?
There, I only needed to add a single line to attach a new device to versatilepb:
sysbus_create_simple("lkmc_platform_device", 0x101e9000, pic[18]);
so maybe we could have a config file containing lines of type:
type name regid irq
sysbus lkmc_platform_device 0x101e9000 18
Related: out-of-tree devices: How to create out-of-tree QEMU devices?
I need to test NAND FTL on QEMU. My NAND controller(Tc6393xb) which is already emulated on QEMU has to be interfaced with ARM Cortex-M3. So I chose stellaris as my base machine. can somebody help me with information on adding this controller(Tc6393xb.c in QEMU 1.2.0) to stellaris. Secondly how do I test it on non-OS environment.
In Qemu version 2.2.1, there is a device (PXA255 Sharp Zaurus) that instantiates the controller Tc6393xb: tc6393xb_init function.