Skip to content

Commit

Permalink
Merge pull request #2 from rancher-sandbox/binfmt
Browse files Browse the repository at this point in the history
Add support for binfmt_misc to run aarch64 binaries
  • Loading branch information
jandubois authored Jul 9, 2021
2 parents 9112fb6 + f2b5af2 commit dd00775
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions edition/min
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export LIMA_INSTALL_CLOUD_INIT=false
export LIMA_INSTALL_LIMA_INIT=false
export LIMA_INSTALL_BINFMT_MISC=false
export LIMA_INSTALL_K3S=false
export LIMA_INSTALL_SSHFS=false
1 change: 1 addition & 0 deletions edition/std
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source edition/min
LIMA_INSTALL_LIMA_INIT=true
LIMA_INSTALL_BINFMT_MISC=true
LIMA_INSTALL_SSHFS=true
13 changes: 13 additions & 0 deletions genapkovl-lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ if [ "${LIMA_INSTALL_K3S}" == "true" ]; then
rc_add k3s default
fi

if [ "${LIMA_INSTALL_BINFMT_MISC}" == "true" ]; then
echo "qemu-aarch64" >> "$tmp"/etc/apk/world

mkdir -p "${tmp}/etc/init.d/"
APKBUILD=/home/build/aports/community/qemu-openrc/APKBUILD
PKGVER=$(awk '/^pkgver=/ {split($1, a, "="); print a[2]}' ${APKBUILD})
URL=$(awk '/^url=/ {split($1, a, "="); print a[2]}' ${APKBUILD} | tr -d '"' | sed 's/github/raw.githubusercontent/')
wget "${URL}/v${PKGVER}/qemu-binfmt.initd" -O "${tmp}/etc/init.d/qemu-binfmt"
chmod +x "${tmp}/etc/init.d/qemu-binfmt"

rc_add qemu-binfmt default
fi

if [ "${LIMA_INSTALL_SSHFS}" == "true" ]; then
echo "sshfs" >> "$tmp"/etc/apk/world
fi
Expand Down
3 changes: 3 additions & 0 deletions mkimg.lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ profile_lima() {
if [ "${LIMA_INSTALL_LIMA_INIT}" == "true" ]; then
apks="$apks e2fsprogs lsblk sfdisk shadow sudo udev"
fi
if [ "${LIMA_INSTALL_BINFMT_MISC}" == "true" ]; then
apks="$apks qemu-aarch64"
fi
if [ "${LIMA_INSTALL_K3S}" == "true" ]; then
apks="$apks k3s"
fi
Expand Down

0 comments on commit dd00775

Please sign in to comment.