Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suport for QemuUserEmulation #119

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions images/linux/scripts/installers/qemu-user-emulation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
################################################################################
## File: qemu-user-emulation.sh
## Desc: Installs qemu, binfmt-support and qemu-user-static
################################################################################

# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh

PACKAGES="qemu binfmt-support qemu-user-static"

# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
if ! IsInstalled "$PACKAGES"; then
echo "Installing $PACKAGES"
apt-get install -y --no-install-recommends $PACKAGES
else
echo "$PACKAGES are already installed"
fi

# Check if qemu emulation is enabled at least for arm
if [ -r /proc/sys/fs/binfmt_misc/qemu-arm ] ; then
echo "qemu-arm-static is not registered in binfmt_misc"
exit 1
fi

# Check if fixed binary is enabled
# Needed for running containers without /usr/bin/qemu-xxx-static in rootfs
# https://www.kernel.org/doc/html/v4.14/admin-guide/binfmt-misc.html
QEMU_ARM_FIX_BIN=$(cat /proc/sys/fs/binfmt_misc/qemu-arm | grep flags | grep F)
if [ -z "$QEMU_ARM_FIX_BIN" ] ; then
echo "qemu static binary is lazy loaded by binfmt_misc"
fi

# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "QemuUserEmulation with $PACKAGES"