Qemu user mode
Agent skills for making and fixing bitbake stuff
npx -y skills add BenGardiner/bitbake-yocto-agent-skills --skill qemu-user-modeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Runs target binaries via QEMU user-mode emulation. Use when testing ARM binaries natively on a host system, extracting root filesystems, or running headless Yocto tests without booting a full QEMU system image. Do not use for full system emulation or kernel debugging.
SKILL.md
3.1 KB, as published. Nobody here has run it
QEMU ARM User-Mode Emulation for Yocto
When testing target binaries compiled for ARM in a Yocto project, booting the full system image using system-mode QEMU can be slow and prone to kernel or TTY multiplexing issues (especially when running headless or in CI/CD environments).
QEMU user-mode emulation (qemu-arm) offers a lightweight alternative by executing target architecture Linux executables directly on the host system. It translates system calls seamlessly while relying on the host kernel.
This project includes two convenience scripts to streamline testing via QEMU user-mode emulation.
1. Extracting the Root Filesystem
Before running any target binaries, you need an uncompressed version of your image's root filesystem. This provides the qemu-arm emulator with the correct target libraries (glibc, Python dependencies, etc.) to link against at runtime.
Script Usage:
./meta-tcat/scripts/extract_rootfs.sh
What it does:
- Locates the latest
core-image-tcat.rootfs.tar.xzin your build's deploy directory (build/deploy-ti/images/tcat). - Extracts it to a local folder named
rootfs-extractin your current working directory.
2. Running Commands in User-Mode
Once the rootfs is extracted, use the run script to execute binaries natively.
Script Usage:
./meta-tcat/scripts/run_in_qemu_user.sh <absolute_path_in_rootfs> [args...]
Examples:
Run the target's Python 3 interpreter:
./meta-tcat/scripts/run_in_qemu_user.sh /usr/bin/python3 --version
Run a specific Python script (like pretty_j1939.py) installed in the image:
cd rootfs-extract/opt/tcat/programs/pretty_j1939
# Notice that since we are passing a relative path (pretty_j1939.py),
# we invoke the python interpreter via its absolute path within the rootfs:
../../../../../../meta-tcat/scripts/run_in_qemu_user.sh /usr/bin/python3 pretty_j1939.py --help
What it does:
- Locates the
qemu-armbinary in Yocto's native sysroots (build/tmp-glibc/sysroots-components/x86_64/qemu-native/usr/bin/). - Maps the root directory (
-L) to yourrootfs-extractfolder so all shared object libraries (.so) are correctly resolved. - Automatically prepends the
rootfs-extractpath to your command if you provide an absolute path (e.g.,/usr/bin/python3becomesrootfs-extract/usr/bin/python3).
Why use User-Mode QEMU?
- Speed: No kernel boot time. Tests start instantly.
- Simplicity: No networking setup (SSH, SLIRP, TAP) needed to communicate with the guest.
- CI/CD Friendly: Easily scriptable without background processes or terminal multiplexing.
- Direct File Access: The target program can read/write directly to files on your host system, simplifying the injection of test data (e.g.,
candumplogs) and extraction of results.