Skip to the content.

Emulate Raspberry Pi 3 using QEMU in 64 bit

In this tutorial we will see how we can emulate Raspberry Pi 3 b using QEMU in linux environment. I have tried to piece together information from different repositories and assemble them together so it works right out of the box. Hope it helps.

Install QEMU 6.2 from source:

  1. Make sure you do not have QEMU preinstalled. Remove the existing installation if needed by executing the following -
    $ sudo apt-get autoremove qemu*
    
  2. Download QEMU 6.2 from here -
    $ wget https://download.qemu.org/qemu-6.2.0.tar.xz
    
  3. Decompress the source code for QEMU 6.2
    $ tar xvJf qemu-6.2.0.tar.xz
    
  4. Install the prerequisites for QEMU 6.2 -
    $ sudo apt-get install build-essential zlib1g-dev pkg-config libglib2.0-dev \
    binutils-dev libboost-all-dev autoconf libtool libssl-dev libpixman-1-dev \
    python-capstone virtualenv ninja-build
    
  5. Change to qemu-6.2.0 directory
    $ cd qemu-6.2.0
    
  6. Inside the qemu-6.2.0 directory, configure the build (default settings would work, but you can fix it as needed)
    $ ./configure
    
  7. Make the build with any number of physical threads you have.
    $ make -j8
    
  8. Add the build directory to the path in .bashrc file. Add the following line to the .bashrc file
    export PATH=$PATH:<path-to-qemu-6.2.0/build>
    

    Change <path-to-qemu-6.2.0/build> to appropriate value

  9. Restart the terminal or reload the environment by executing
    $ source ~/.bashrc
    

Download Required Files:

For the next step you need to download the kernel, dtb and disk image and save them to any folder. You would also need to download the launch script.

  1. Launch Script: launch.sh
  2. Kernel: kernel8.img
  3. DTB: bcm2710-rpi-3-b-plus.dtb
  4. Disk Image (disk.img): You can use download either the .xz format or the .img format directly -

    a. disk.xz Archive .xz format (~833MB) need to decompress using ($ tar xvJf disk.xz)

    b. disk.img Decompressed .img format (~4G)

Execute Launch Script:

Once you are done downloading, put all the files in the same directory and you should be able to execute the launch.sh without any trouble. When prompted, the id and the password for default account -

Username: pi
Password: raspberry

If you did this successfully you should be able to see this - Success!

References:

These are the references used for executing the script. However, you might need to modify the files directly obtained from these sources.