Beagleboard Emulator in Ubuntu with Qemu

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 : 0x41
CPU architecture: 7
CPU variant : 0x2
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/

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus

51 Replies to “Beagleboard Emulator in Ubuntu with Qemu”

  1. 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.

  2. 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?

  3. 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?

    1. 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.

  4. 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

  5. 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?

  6. @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

  7. @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.

  8. “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

  9. 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’

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

    runing this command showa error

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

  12. 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

  13. 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

  14. @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.

  15. @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.

  16. 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

  17. @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

  18. 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?

  19. 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.

  20. @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…

  21. @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.

  22. When i execute the following command:

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

    I get an error : qemu-system-arm: -M beaglexm: Unsupported machine type
    Use -machine help to list supported machines!

    beaglexm is not present in the list of supported machines.

    What do i do?

  23. @cnxsoft
    hey thanks!
    Another doubt: I am trying to run RTEMS on qemu, and bbxm_boot_sdcard is the RTEMS image, but when i execute the following command am I just invoking the linaro or am I running RTEMS as well?

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

    1. Those instructions are close to 9 years old, and they may still work, but the PPA has last been updated 186 weeks ago.
      What kind of error do you get?

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC