FEX-Emu statt Box64: hermetic in-image emulator (EMULATOR=fex|box64 build-arg)
- Base ubuntu:24.04 (fex-emu PPA has no Debian series) - setup-arm64: installs fex-emu(+thunks) from ppa:fex-emu/fex and bakes the Ubuntu 24.04 x86_64 RootFS (unsquashed to /opt/fex-emu-rootfs) into the image - bedrock-entry.sh: USE_FEX=true (default on FEX builds) execs FEXInterpreter; FEX_EMU_DIR for JIT caches stays volume-friendly; box64 path kept as fallback - amd64 builds untouched (native exec)
This commit is contained in:
1 parent
6cc16c40af
commit
fc2454d208
3 files changed
+60
-8
No files matched your search
+39
-5
@@ -2,8 +2,14 @@
|
||||
|
||||
set -eu
|
||||
|
||||
if [ "$TARGETARCH" = "arm64" ] ; then
|
||||
apt-get update
|
||||
if [ "$TARGETARCH" != "arm64" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
EMULATOR="${EMULATOR:-fex}"
|
||||
apt-get update
|
||||
|
||||
if [ "$EMULATOR" = "box64" ] ; then
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y debian-keyring
|
||||
|
||||
curl -L https://ryanfortner.github.io/box64-debs/box64.list -o /etc/apt/sources.list.d/box64.list
|
||||
@@ -13,7 +19,35 @@ if [ "$TARGETARCH" = "arm64" ] ; then
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
"$BOX64_PACKAGE" \
|
||||
libjemalloc2
|
||||
else
|
||||
# FEX-Emu: comes from the official PPA (arm64 builds), Ubuntu base required
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
software-properties-common \
|
||||
squashfs-tools \
|
||||
ca-certificates \
|
||||
curl
|
||||
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
fi
|
||||
add-apt-repository -y ppa:fex-emu/fex
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
fex-emu \
|
||||
libjemalloc2
|
||||
|
||||
# Thunks are optional but speed up glibc-heavy servers
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y fex-emu-thunks 2>/dev/null || true
|
||||
|
||||
# Bake the x86_64 RootFS into the image so the container is fully self-contained
|
||||
# (no FEXRootFSFetcher at first start, no network needed at runtime)
|
||||
ROOTFS_URL=$(curl -fsSL https://rootfs.fex-emu.gg/RootFS_links.json \
|
||||
| python3 -c "import json,sys; d=json.load(sys.stdin)['v1']; print(d['Ubuntu 24.04 (SquashFS)']['URL'])")
|
||||
echo "Fetching FEX RootFS from $ROOTFS_URL"
|
||||
curl -fsSL "$ROOTFS_URL" -o /tmp/fex-rootfs.sqsh
|
||||
|
||||
# Extracted instead of mounted: works in containers without FUSE/SYS_ADMIN
|
||||
mkdir -p /opt/fex-emu-rootfs
|
||||
unsquashfs -q -d /opt/fex-emu-rootfs/rootfs /tmp/fex-rootfs.sqsh
|
||||
rm -f /tmp/fex-rootfs.sqsh
|
||||
fi
|
||||
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
Reference in new issue
Block a user