Home > Linux, Texas Instruments OMAP 3 > Beagleboard Emulator in Ubuntu with Qemu

Beagleboard Emulator in Ubuntu with Qemu

September 26th, 2011 Leave a comment Go to comments

If you just want to try a program on Beagleboard, but do not want (or have the means) to purchase a board, you may be able to use qemu to emulate the Beagleboard or BeableBoard-xM. I’ll details the instructions to run the Nano build (minimal kernel) and the ARM Linux Internet Platform (ALIP) distribution for Beagleboard on qemu. Please read the full post before starting the installation before there are currently some issues such as no Ethernet support.

First, install or update linaro-media-create:

sudo add-apt-repository ppa:linaro-maintainers/tools
sudo apt-get update
sudo apt-get install linaro-image-tools

Then download the nano image and omap3 hardware pack:

wget http://releases.linaro.org/platform/linaro-n/nano/11.08/nano-n-tar-20110823-1.tar.gz
wget http://releases.linaro.org/platform/linaro-n/nano/11.08/hwpack_linaro-omap3_20110823-0_armel_supported.tar.gz

Generate the image for qemu:

sudo linaro-media-create --image_file beagle_sd.img --dev beagle --binary nano-n-tar-20110823-1.tar.gz --hwpack hwpack_linaro-omap3_20110823-0_armel_supported.tar.gz

If you don’t have it already, get the latest qemu-linaro package from Linaro Maintainers PPA:

sudo apt-get install qemu-system

Check the version is correct:

qemu-system-arm -version
QEMU emulator version 0.15.50 (Debian 0.15.50-2011.08-0ubuntu2~ppa10.04.1), Copyright (c) 2003-2008 Fabrice Bellard

Finally run the nano image in qemu for Beagleboard:

sudo qemu-system-arm -M beagle -m 256 -sd ./beagle_sd.img -clock unix -serial stdio

For Beagleboard-xM use the following command line:

sudo qemu-system-arm -M beaglexm -m 512 -sd ./beagle_sd.img -clock unix -serial stdio

After a few minutes, you should be able to access the command line in the emulator and check the CPU info:

root@linaro-nano:~# cat /proc/cpuinfo

Processor : ARMv7 Processor rev 3 (v7l)
processor : 0
BogoMIPS : 81.39

Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls
CPU implementer : 0×41
CPU architecture: 7
CPU variant : 0×2
CPU part : 0xc08
CPU revision : 3

Hardware : OMAP3 Beagle Board
Revision : 0000
Serial : 0000000000000000
root@linaro-nano:~#

Currently you can not access Ethernet, since this is not implemented, but this will be added to the October 2011 release of qemu-linaro. This is an issue because if you want to copy a program or other files to the emulator, you’ll have to create a qemu image each time. If you have another solution let me know. Following comments by readers, you can use the overo hardware pack to use Ethernet.

The next thing we can try is to run the ARM Linux Internet Platform ( ALIP) in the emulator.

First download the ALIP image and hardware pack for OMAP3 and X11:

wget http://releases.linaro.org/platform/linaro-n/alip/11.08/alip-n-tar-20110823-1.tar.gz
wget http://releases.linaro.org/platform/linaro-n/alip/11.08/hwpack_linaro-omap3-x11-base_20110823-0_armel_supported.tar.gz

Then create a qemu image with those 2 files:

sudo linaro-media-create --image_file beagle_sd_alip_x11.img --dev beagle --binary alip-n-tar-20110823-1.tar.gz --hwpack hwpack_linaro-omap3-x11-base_20110823-0_armel_supported.tar.gz

and run the ALIP image in qemu for Beagleboard:

sudo qemu-system-arm -M beagle -m 256 -drive file=./beagle_sd_alip_x11.img,if=sd,cache=writeback -clock unix -serial stdio -device usb-kbd -device usb-mouse

After a few minutes, you should be able to see the desktop:

Qemu BeagleBoard ARM Linux Internet Platform

ALIP for Beagleboard Running in Qemu

The screenshot above shows the ALIP desktop in the background and the terminal window which started qemu.

Update: Thanks to Peter Maydell for explaining me I initially did not add the USB keyboard and mouse options in the command line above. Once I add -device usb-kbd -device usb-mouse, the mouse and keyboard works fine.  I’ll leave the old version of the post below for reference.

However, there is a rather annoying issue: Once you get in the desktop, the mouse and keyboard do not respond. However, it is supposed to work: “USB keyboard and mouse are supported starting with qemu-linaro 2011.06, for Linaro images of the 11.05 release or later. “, so I must have missed a step.

I’ve also tried to compile the latest Git version of qemu-linaro (20 September 2011), but it did not fix the issue. I still document the steps I followed below:

git clone git://git.linaro.org/qemu/qemu-linaro.git
cd qemu-linaro
sudo apt-get install zlib1g-dev
sudo apt-get install libglib2.0-dev
./configure --prefix=/usr
make
sudo make install

I had to install zlib1g-dev and libglib-2.0-dev due to the following errors during the configure script:

Error: zlib check failed
Make sure to have the zlib libs and headers installed.

glib-2.0 required to compile QEMU

Sources:
https://wiki.linaro.org/Platform/DevPlatform/Ubuntu/ImageInstallation
http://www.linaro.org/downloads/

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Linux, Texas Instruments OMAP 3 Tags: beagleboard, linaro, qemu, ubuntu
  1. Fred
    September 26th, 2011 at 14:49 | #1

    The overo image is the same as the beagle but it has a built in ethernet port that is emulated.

  2. Peter Maydell
    September 26th, 2011 at 15:30 | #2

    For keyboard and mouse you need to add the qemu command line options to say “plug in a USB mouse and keyboard” — that’s the ‘-device usb-kbd -device usb-mouse’ part on the wiki page you link to. Otherwise it’s like running a real beagle board with no mouse plugged in!

    You will also find that your SD card performance is much better if you use ‘-drive file=./beagle_sd_all_x11.img,if=sd,cache=writeback’ instead of ‘-sd ./beagle_sd_ali_x11.img’.

    Finally, while you’re waiting for the next qemu-linaro release you can use the ‘overo’ model instead — this is another OMAP3 board like the beagle, but it has working ethernet. You’ll need the overo hwpack but otherwise it should be much the same process as running on the beagle model.

  3. September 26th, 2011 at 16:22 | #3

    @Peter Maydell
    Thanks Peter and Fred. I’ve updated the blog post based on your comments.

  4. Virgie Puckett
    September 26th, 2011 at 20:05 | #4

    What’s the beagleboard? I’m sorry I’m a newbie about linux

    • September 26th, 2011 at 20:36 | #5

      Hi Virgie,

      The Beagleboard is a low cost single board computer based on Texas Instrument OMAP3 processor.
      It’s used by developers and hobbyist.

      For details http://beagleboard.org/.

  5. Rob
    September 28th, 2011 at 11:10 | #6

    Thanks for the tutorial! The mouse and keyboard worked just fine for me, without having to compile from source. Do you know how to run a similar emulator with android releases?

  6. September 28th, 2011 at 12:47 | #7

    @Rob
    I haven’t tried, but if you go to http://www.linaro.org/downloads/ at the bottom there is an Android build for Beagleboard. So it should also be possible to create a qemu image for that.

  7. Brett
    October 14th, 2011 at 04:26 | #8

    Thanks for this great tutorial! I’m trying to simulate a Beagleboard xM to see if it fits my needs before I purchase. Do you know how to get networking setup either with the ALIP version or the 11.09 linaro release?

    • October 14th, 2011 at 10:25 | #9

      Hi Brett,

      Networking is not enabled for Beagleboard-xM, you’ll have to wait for October release of qemu or you can simply run qemu for overo (this is similar): http://www.cnx-software.com/2011/09/20/emulate-gumstix-overo-com-with-qemu-and-linaro-nano-image/. This post shows how to do with nano but you can use alip instead.
      I use overo emulating for now, until the next release of qemu.

      They have fixed it yesterday (https://bugs.launchpad.net/qemu-linaro/+bug/656530):

      This is now fixed for the beagle model in qemu-linaro 2011.10. To enable USB networking, run the model with extra command line arguments “-usb -device usb-net,netdev=mynet -netdev user,id=mynet”. This should cause the kernel to automatically load the cdc_ether module. Depending on what image you’re using (eg nano) you might have to run ‘dhclient eth1′ to bring the interface up. (For me the ethernet is detected as eth0 and then udev helpfully renames it to eth1; your image might differ.)

      So it should be available very soon, or if you can’t wait you may be able to get a snapshot somewhere.

  8. October 15th, 2011 at 18:31 | #10

    Finally, Linaro QEMU 2011.11 has just been released and ethernet can be enabled in beagleboard qemu by adding “-usb -device usb-net,netdev=mynet -netdev user,id=mynet” to qemu-system-arm command line.

    http://www.linaro.org/linaro-blog/2011/10/13/linaro-qemu-2011-10-released/

  9. Gustav
    November 20th, 2011 at 00:02 | #11

    Hello! Following this tutorial I got this:

    sudo qemu-system-arm -M beagle -m 256 -sd ./beagle_sd.img -clock unix -serial stdio
    Could not initialize SDL(No available video device) – exiting

    Any ideas? I don’t need graphics, just the CLI.

    Running in a ubuntu server in vbox on mac

  10. November 20th, 2011 at 07:55 | #12

    @Gustav
    You may want to add -nographic to the command line.

  11. Gláuber
    November 8th, 2012 at 22:16 | #13

    Hey!

    I just can’t create the linaro imagem :( i’m using “sudo linaro-media-create –image_file beagle_sd.img –dev beagle –binary nano-n-tar-20110823-1.tar.gz –hwpack hwpack_linaro-omap3_20110823-0_armel_supported.tar.gz”

    And the linaro returns me: “linaro-media-create: error: argument –hwpack is required”

    What can I do?

  12. November 9th, 2012 at 08:59 | #14

    @Gláuber
    Sorry, there was a problem with formatting in this post, and double dash, where converted to single dash. I’ve corrected it, so the line is actually:

    sudo linaro-media-create –-image_file beagle_sd.img –-dev beagle –-binary nano-n-tar-20110823-1.tar.gz –-hwpack hwpack_linaro-omap3_20110823-0_armel_supported.tar.gz

  13. Gláuber
    November 11th, 2012 at 10:08 | #15

    @cnxsoft
    Thank you!

    How can I install Angstrom Linux in this QEmu simulation of BB?

  14. November 11th, 2012 at 10:16 | #16

    @Gláuber
    Not sure, I suppose you could try to find angstrom rootfs and use it instead of alip-n-tar-20110823-1.tar.gz to create the SD card image with linaro-media-create.

  15. Gláuber
    November 11th, 2012 at 10:17 | #17

    @cnxsoft

    Now, after running the “sudo linar-media, bla bla bla

    My system noticed that doesnt have any bootloader…

    What should I do?

  16. November 11th, 2012 at 10:21 | #18

    @Gláuber
    Sorry, I don’t know enough details about Angstrom and the linaro-media-create tools… You’ll need to find out what’s inside alip-n-tar-20110823-1.tar.gz, and try to reproduce something similar with Angstrom, this may require some reading on Linaro website.

  17. Gláuber
    November 11th, 2012 at 10:25 | #19

    No, im getting this error without using Angstrom!

    I’m using your image

  18. Gláuber
    November 11th, 2012 at 10:26 | #20

    “qemu: hardware error: no boot device found
    CPU #0:
    R00=00000000 R01=00000000 R02=00000000 R03=00000000
    R04=00000000 R05=00000000 R06=00000000 R07=00000000
    R08=00000000 R09=00000000 R10=00000000 R11=00000000
    R12=00000000 R13=00000000 R14=00000000 R15=400140a4
    PSR=400001d3 -Z– A svc32

  19. November 11th, 2012 at 10:39 | #21

    @Gláuber
    Ah ok. Those instructions are a bit old, so I’m not sure they still work.
    Does it say anything before the log you showed me?

  20. Gláuber
    November 11th, 2012 at 10:55 | #22

    No, but when I install all packages i get this log:

    if cls.bootloader_copy_files is None:
    AttributeError: type object ‘BeagleConfig’ has no attribute ‘bootloader_copy_files’

  21. santhosh
    November 21st, 2012 at 20:56 | #23

    sudo qemu-system-arm -M beagle -m 256 -sd ./beagle_sd.img -clock unix -serial stdio

    runing this command showa error

  22. Anubhav
    January 16th, 2013 at 00:00 | #24

    I get a black QEMU screen instead of the screen mentioned above when I use ALIP image in qemu for Beagleboard. Please help..!!

  23. Lukas
    January 29th, 2013 at 23:16 | #25

    It doesn’t work on Ubuntu 12. I have tried to find linaro for ubuntu 12 (http://releases.linaro.org/platform/linaro-n/ubuntu-desktop) but there are version from 11.04-11.09. unfortunately these ubuntu version are not downloadable. is there any solution to run this on ubuntu 12 or older ubuntu (11.04 for example – http://old-releases.ubuntu.com/releases/11.04/)?
    Thank

  24. January 30th, 2013 at 09:51 | #26

    @Lukas
    It should be possible to run the command by separating the kernel and rootfs like I’ve done for the Raspberry Pi http://www.cnx-software.com/2011/10/18/raspberry-pi-emulator-in-ubuntu-with-qemu/ (Skip the kernel build and debootstrap part).

    You can just extract the kernel in the 11.08 image, and download Ubuntu 12 armhf rootfs from Linaro.

  25. Nghia Bui
    January 30th, 2013 at 10:41 | #27

    Hi supporter,
    I have run the command and received this error message.
    Please give me the instruction
    udo qemu-system-arm -M beagle -m 256 -sd ./beagle_sd.img -clock unix -serial stdio
    VNC server running on `127.0.0.1:5901′
    qemu: hardware error: no boot device found
    CPU #0:
    R00=00000000 R01=00000000 R02=00000000 R03=00000000
    R04=00000000 R05=00000000 R06=00000000 R07=00000000
    R08=00000000 R09=00000000 R10=00000000 R11=00000000
    R12=00000000 R13=00000000 R14=00000000 R15=400140a4
    PSR=400001d3 -Z– A svc32
    s00=00000000 s01=00000000 d00=0000000000000000
    s02=00000000 s03=00000000 d01=0000000000000000
    s04=00000000 s05=00000000 d02=0000000000000000
    s06=00000000 s07=00000000 d03=0000000000000000
    s08=00000000 s09=00000000 d04=0000000000000000
    s10=00000000 s11=00000000 d05=0000000000000000
    s12=00000000 s13=00000000 d06=0000000000000000
    s14=00000000 s15=00000000 d07=0000000000000000
    s16=00000000 s17=00000000 d08=0000000000000000
    s18=00000000 s19=00000000 d09=0000000000000000
    s20=00000000 s21=00000000 d10=0000000000000000
    s22=00000000 s23=00000000 d11=0000000000000000
    s24=00000000 s25=00000000 d12=0000000000000000
    s26=00000000 s27=00000000 d13=0000000000000000
    s28=00000000 s29=00000000 d14=0000000000000000
    s30=00000000 s31=00000000 d15=0000000000000000
    s32=00000000 s33=00000000 d16=0000000000000000
    s34=00000000 s35=00000000 d17=0000000000000000
    s36=00000000 s37=00000000 d18=0000000000000000
    s38=00000000 s39=00000000 d19=0000000000000000
    s40=00000000 s41=00000000 d20=0000000000000000
    s42=00000000 s43=00000000 d21=0000000000000000
    s44=00000000 s45=00000000 d22=0000000000000000
    s46=00000000 s47=00000000 d23=0000000000000000
    s48=00000000 s49=00000000 d24=0000000000000000
    s50=00000000 s51=00000000 d25=0000000000000000
    s52=00000000 s53=00000000 d26=0000000000000000
    s54=00000000 s55=00000000 d27=0000000000000000
    s56=00000000 s57=00000000 d28=0000000000000000
    s58=00000000 s59=00000000 d29=0000000000000000
    s60=00000000 s61=00000000 d30=0000000000000000
    s62=00000000 s63=00000000 d31=0000000000000000
    FPSCR: 00000000

  26. January 30th, 2013 at 10:56 | #28

    @Nghia Bui
    Try it in Ubuntu 11.04.

  27. Nghia Bui
    January 30th, 2013 at 15:04 | #29

    Thanks for your reply. Will it work with ubuntu 12.04? and in 32 bit or 64 bit version??
    And will new ubuntu will fix the error message:
    “qemu: hardware error: no boot device found
    CPU #0:
    R00=00000000 R01=00000000 R02=00000000 R03=00000000
    R04=00000000 R05=00000000 R06=00000000 R07=00000000
    R08=00000000 R09=00000000 R10=00000000 R11=00000000
    R12=00000000 R13=00000000 R14=00000000 R15=400140a4
    PSR=400001d3 -Z– A svc32

    Thanks

  28. January 30th, 2013 at 15:51 | #30

    @Nghia Bui
    The honest is answer is “I don’t know, you have to try”.

  29. Lukas
    January 30th, 2013 at 17:00 | #31

    @cnxsoft
    Thank for reply, but where to download Ubuntu 12 armhf rootfs from Linaro? And what does means “You can just extract the kernel in the 11.08 image”? Sorry for stupid questions I am lost in it. I did steps described above in Ubuntu 12 32bit, qemu seems to work but during linaro-media-create some errors occured (error with /bin/df) and then there were some problems with image(disk) geometry (?) at the end. Ubuntu 12 show even crash of linaro-media-create. beagle_sd.img was created but I think it is not useable – i will got same error as Nghia Bui (no boot device found). Thank you very much for the help.

  30. Nghia Bui
    January 30th, 2013 at 17:14 | #32

    Sorry, I meant you are sure that it work fines in Ubuntu 11.04, right?. But which env, 32 or 64 bit?

  31. January 30th, 2013 at 17:44 | #33

    @Lukas
    For the rootfs download: http://www.linaro.org/downloads/
    The kernel must be in hwpack_linaro-omap3-x11-base_20110823-0_armel_supported.tar.gz.

    @Nghia Bui
    I guess it should. I used Ubuntu 11.04 32-bit at the time.

  32. Lukas
    January 30th, 2013 at 21:10 | #34

    @cnxsoft
    I have still problems to create img file. Is it possible to do it for qemu running under Ubuntu 12? There are some problems with packages dependencies (cpp-4.5 : Depends: gcc-4.5-base (= 4.5.2-8ubuntu4) but 4.5.3-9ubuntu1 is to be installed ….). I got same error with Ubuntu 11.10.

    I downloaded these packages:
    hwpack_linaro-omap3-x11-base_20110823-0_armel_supported.tar.gz
    http://releases.linaro.org/12.03/ubuntu/oneiric-images/nano/linaro-o-nano-tar-20120327-1.tar.gz

    I am not sure second package is right for me.

  33. Nghia Bui
    February 4th, 2013 at 14:54 | #35

    It worked. Thank you alot!

  34. RAHUL RAVI
    February 6th, 2013 at 16:36 | #36

    linaro-media-create: error: argument –hwpack is required

  35. Nermine
    May 15th, 2013 at 15:38 | #37

    Good Morning

    I created the image beagle_sd_alip_x11.img and I tried to turn it on ebv beagle board.
    I have a small probleme the keyboard and mouse are not not FUNCTIONAL and when i rebbot the ebv beagle board i get console mode not graphic mode like the first boot

    I need your help for this probleme and thank you

  36. May 15th, 2013 at 15:44 | #38

    @Nermine
    I’m a little confused. Do you actually have a board? Those instructions are for people not owning a board. I don’t own a Beagleboard myself.

  37. Nermine
    May 15th, 2013 at 15:56 | #39

    @cnxsoft

    Yes I have a ebv beagle Borad , My probleme is when ebv boot in th MMC card, the mouse and keyboard not FUNCTIONAL

  38. Nermine
    May 15th, 2013 at 16:01 | #40

    @cnxsoft

    and i use this instruction for generation of the MMC card :

    zcat ./beagle_sd_alip_x11.img.gz |sudo dd bs=4M of=/dev/sde ; sudo sync

  39. Franc
    July 5th, 2013 at 10:18 | #41

    I tried adding “-usb -device usb-net,netdev=mynet -netdev user,id=mynet” to qemu-system-arm command line, but QEMU start and it crashes right away. I also tried usb_add net:vlan on monitor after adding -net tap at the qemu-system-arm command line but QEMU crashes everytime it tries to connect the vlan to the usb-net device.

    Have you any idea waht could be going wrong?

  40. Hamed
    February 7th, 2014 at 21:55 | #42

    Hi, I am trying to create a n image using following command:

    sudo linaro-media-create –image_file beagle_sd.img –image-size 128M –dev beagle –binary nano-n-tar-20110823-1.tar.gz –hwpack hwpack_linaro-omap3_20110823-0_armel_supported.tar.gz

    But I got an error message:

    Cleaning up …Done
    proc umounted
    Traceback (most recent call last):
    File “/usr/bin/linaro-media-create”, line 206, in
    verified_files, extract_kpkgs, *hwpacks)
    File “/usr/lib/pymodules/python2.7/linaro_image_tools/media_create/chroot_utils.py”, line 89, in install_hwpacks
    hwpack_force_yes or hwpack_verified)
    File “/usr/lib/pymodules/python2.7/linaro_image_tools/media_create/chroot_utils.py”, line 129, in install_hwpack
    cmd_runner.run(args, as_root=True, chroot=chroot_dir).wait()
    File “/usr/lib/pymodules/python2.7/linaro_image_tools/cmd_runner.py”, line 100, in wait
    raise SubcommandNonZeroReturnValue(self._my_args, returncode)
    linaro_image_tools.cmd_runner.SubcommandNonZeroReturnValue: Sub process “['chroot', '/tmp/tmphZZUgU/rootfs/binary', 'linaro-hwpack-install', '--hwpack-version', '20110823-0', '--hwpack-arch', 'armel', '--hwpack-name', 'linaro-omap3', '/hwpack_linaro-omap3_20110823-0_armel_supported.tar.gz']” returned a non-zero value: 100

    Could someone please let me know how I can solve this problem. Many thanks in advance.

  41. Veeresh
    February 11th, 2014 at 05:17 | #43

    Hi,

    Is it possible to run the image generated by Yocto toolchain using qemu-system arm?

    Regards,
    Veeresh

  42. February 11th, 2014 at 09:54 | #44

    @Veeresh
    You can generate a qemu image with Yocto.
    If you want to run a Yocto image built for an ARM platform supported by QEMU, it may also work

    You can do something similar to what I’ve done in the post below, except with newer version and selecting an ARM platform instead of x86
    http://www.cnx-software.com/2012/02/09/yocto-project-quick-start-guide-for-ubuntu/

  43. Veeresh
    February 15th, 2014 at 00:06 | #45

    @cnxsoft
    I have already tested the qemu images generated with yocto… Now I have built a beaglebone image (core-image-minimal) using yocto… My question is if i can run this beagle bone image on qemu? I am sure it cant be done directly.. but since linaro guys have developed some tools like linaro-image-create, is it possible to run this tool on the yocto generated image and format it as qemu requires?
    Sorry for not being clear enough earlier…

  44. February 15th, 2014 at 09:53 | #46

    @Veeresh
    I’d assume it could run directly. Have you tried? Otherwise you could pass the kernel and rootfs files in the command line.
    Not sure how to do though. It’s been a while I haven’t used qemu (directly) with all these low cost boards on the market now.

  1. No trackbacks yet.