Building for Emulation
Building an image for emulation allows you to simulate your image without actual target hardware.
This section describes the steps you need to take to build the AGL demo image for emulation using either Quick EMUlator (QEMU) or VirtualBox.
1. Making Sure Your Build Environment is Correct
“Initializing Your Build Environment”
section presented generic information for setting up your build environment
If you are building the AGL demo image for emulation, you need to specify some
specific options when you run the script:
source meta-agl/scripts/aglsetup.sh -f -m qemux86-64 agl-demo agl-devel
The “-m” option specifies the “qemux86-64” machine. The list of AGL features used with script are appropriate for development of the AGL demo image suited for either QEMU or VirtualBox.
2. Using BitBake
This section shows the
bitbake command used to build the AGL image.
Before running BitBake to start your build, it is good to be reminded that AGL
does provide pre-built images for developers that can be emulated
using QEMU and VirtualBox.
You can find these pre-built images on the
AGL Download web site.
For supported images, the filenames have the following forms:
<release-name>/<release-number>/qemuarm/* <release-name>/<release-number>/qemuarm64/* <release-name>/<release-number>/qemux86-64/*
Start the build using the
NOTE: An initial build can take many hours depending on your CPU and and Internet connection speeds. The build also takes approximately 100G-bytes of free disk space.
For this example, the target is “agl-demo-platform”:
By default, the build process puts the resulting image in the Build Directory:
3. Deploying the AGL Demo Image
Deploying the image consists of decompressing the image and then booting it using either QEMU or VirtualBox.
Decompress the image:
For Linux, use the following commands to decompress the image and prepare it for boot:
cd tmp/deploy/images/qemux86-64 xz -d agl-demo-platform-qemux86-64.vmdk.xz
For Windows, download 7-Zip and then select agl-demo-platform-qemux86-64.vmdk.xz to decompress the image and prepare it for boot.
Boot the Image:
The following steps show you how to boot the image with QEMU or VirtualBox.
Depending on your Linux distribution, use these commands to install QEMU:
NOTE: if you have created an AGL crosssdk, it will contain a QEMU binary for the build host. This SDK QEMU binary does not support graphics. Consequently, you cannot use it to boot the AGL image.
If your build host is running Arch Linux, use the following commands:
sudo pacman -S qemu
If your build host is running Debian or Ubuntu, use the following commands:
sudo apt-get install qemu-system-x86
If you build host is running Fedora, use the following commands:
sudo yum install qemu-kvm
Once QEMU is installed, boot the image with KVM support:
qemu-system-x86_64 -enable-kvm -m 2048 \ -hda agl-demo-platform-qemux86-64.vmdk \ -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \ -vga virtio -show-cursor \ -device virtio-rng-pci \ -serial mon:stdio -serial null \ -soundhw hda \ -net nic,vlan=0 \ -net user,hostfwd=tcp::2222-:22
Start by downloading and installing VirtualBox 5.2.0 or later.
Once VirtualBox is installed, follow these steps to boot the image:
- Start VirtualBox
- Click New to create a new machine
- Enter AGL QEMU as the Name
- Select Linux as the Type
- Select Other Linux (64-bit) as the Version
- Set Memory size to 2 GB
- Click Use an existing virtual hard disk file under Hard disk
- Navigate to and select the agl-demo-platform-qemux86-64.vmdk image
- Ensure that the newly created AGL QEMU machine is highlighted.
- Click Start