Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

feat(vm): Linux 7.0.5; legacy iptables; zstd squashfs builtin; overlayfs perf

ExTv86e8d4e766f7
diff --git a/Dockerfile b/Dockerfile
index ddea9db..e0355d7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,7 +7,7 @@
# SECTION 0: Custom Kernel Build (aarch64) — Image + modules
# ==============================================================================
FROM debian:bookworm AS kernel-builder
-ARG KERNEL_VERSION=6.6.87
+ARG KERNEL_VERSION=7.0.5
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates xz-utils make gcc gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu \
@@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
-RUN wget -q https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${KERNEL_VERSION}.tar.xz \
+RUN wget -q https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-${KERNEL_VERSION}.tar.xz \
&& tar xf linux-${KERNEL_VERSION}.tar.xz \
&& rm linux-${KERNEL_VERSION}.tar.xz
@@ -38,7 +38,7 @@ RUN printf '%s\n' \
'CONFIG_NETFILTER_ADVANCED=y' \
'CONFIG_NETFILTER_NETLINK=y' \
'CONFIG_NF_CONNTRACK=y' \
- 'CONFIG_NF_CONNTRACK_NETLINK=y' \
+ 'CONFIG_NF_CT_NETLINK=y' \
'CONFIG_NF_NAT=y' \
'CONFIG_NF_TABLES=y' \
'CONFIG_NF_TABLES_INET=y' \
@@ -59,6 +59,9 @@ RUN printf '%s\n' \
'CONFIG_IP6_NF_NAT=y' \
'CONFIG_IP6_NF_TARGET_MASQUERADE=y' \
'CONFIG_NETFILTER_XTABLES=y' \
+ 'CONFIG_NETFILTER_XTABLES_LEGACY=y' \
+ 'CONFIG_IP_NF_IPTABLES_LEGACY=y' \
+ 'CONFIG_IP6_NF_IPTABLES_LEGACY=y' \
'CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y' \
'CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y' \
'CONFIG_NETFILTER_XT_MATCH_MARK=y' \
@@ -71,6 +74,8 @@ RUN printf '%s\n' \
'CONFIG_EXT4_FS_SECURITY=y' \
'CONFIG_SQUASHFS_XATTR=y' \
'CONFIG_SQUASHFS_ZSTD=y' \
+ 'CONFIG_DECOMPRESS_ZSTD=y' \
+ 'CONFIG_ZSTD_DECOMPRESS=y' \
'CONFIG_IKCONFIG=y' \
'CONFIG_IKCONFIG_PROC=y' \
'CONFIG_IP_NF_RAW=y' \
@@ -116,12 +121,15 @@ RUN cd linux-${KERNEL_VERSION} \
&& make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- olddefconfig \
&& echo "=== verifying critical options are =y ===" \
&& for opt in IPV6 BRIDGE BRIDGE_NETFILTER NF_TABLES_BRIDGE \
+ NETFILTER_XTABLES_LEGACY \
+ IP_NF_IPTABLES_LEGACY IP6_NF_IPTABLES_LEGACY \
IP6_NF_IPTABLES IP6_NF_FILTER IP6_NF_NAT \
IP_NF_TARGET_MASQUERADE IP6_NF_TARGET_MASQUERADE \
NETFILTER_XT_TARGET_MASQUERADE NF_NAT_MASQUERADE \
NFT_COMPAT NFT_MASQ NFT_NAT \
VETH TUN NF_TABLES NF_NAT NETFILTER OVERLAY_FS FUSE_FS \
EXT4_FS_SECURITY SQUASHFS_XATTR SQUASHFS_ZSTD \
+ DECOMPRESS_ZSTD ZSTD_DECOMPRESS \
IKCONFIG IKCONFIG_PROC; do \
grep -q "^CONFIG_${opt}=y\$" .config \
|| { echo "FATAL: CONFIG_${opt} is not =y after merge" >&2; \
@@ -186,7 +194,7 @@ RUN cd /rootfs && find . | cpio -o -H newc 2>/dev/null | gzip -9 > /output/initr
# ==============================================================================
FROM debian:bookworm AS qemu-builder
-ARG QEMU_VERSION=11.0.0-rc2
+ARG QEMU_VERSION=11.0.0
ENV QEMU_DIR=qemu-${QEMU_VERSION}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
diff --git a/build-rootfs/build-rootfs.sh b/build-rootfs/build-rootfs.sh
index f9d8d4e..dad9b63 100755
--- a/build-rootfs/build-rootfs.sh
+++ b/build-rootfs/build-rootfs.sh
@@ -21,6 +21,8 @@ apk -X "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_BRANCH}/main" \
busybox-openrc \
bash \
podman \
+ docker docker-openrc docker-cli-compose \
+ lxc lxc-templates lxc-openrc lxc-bridge \
crun \
fuse-overlayfs \
iptables \
@@ -100,6 +102,13 @@ mkdir -p "$ROOTFS/etc/profile.d"
cp /work/files/etc/profile.d/*.sh "$ROOTFS/etc/profile.d/" 2>/dev/null || true
chmod 0644 "$ROOTFS/etc/profile.d/"*.sh 2>/dev/null || true
+# /etc/containers/storage.conf — pin Podman to the in-kernel overlay driver.
+# Without this file, Podman auto-detects fuse-overlayfs (still apk-installed
+# as a fallback) and uses it, which is slower than native overlay.
+mkdir -p "$ROOTFS/etc/containers"
+cp /work/files/etc/containers/storage.conf "$ROOTFS/etc/containers/storage.conf"
+chmod 0644 "$ROOTFS/etc/containers/storage.conf"
+
# Hostname (read by podroid-bootstrap via `hostname -F /etc/hostname`)
echo "podroid" > "$ROOTFS/etc/hostname"
echo "127.0.0.1 localhost podroid" > "$ROOTFS/etc/hosts"
diff --git a/build-rootfs/files/etc/containers/storage.conf b/build-rootfs/files/etc/containers/storage.conf
new file mode 100644
index 0000000..c4608c3
--- /dev/null
+++ b/build-rootfs/files/etc/containers/storage.conf
@@ -0,0 +1,12 @@
+# Podroid: use the in-kernel overlayfs driver instead of fuse-overlayfs.
+# Kernel >= 5.11 (we ship 6.6.87 with CONFIG_OVERLAY_FS=y) and Podman runs
+# as root inside this VM, so the FUSE indirection is pure overhead.
+[storage]
+driver = "overlay"
+runroot = "/run/containers/storage"
+graphroot = "/var/lib/containers/storage"
+
+[storage.options]
+# Empty mount_program forces native kernel overlay (default would
+# auto-pick fuse-overlayfs if the binary is present).
+mount_program = ""
diff --git a/build-rootfs/files/etc/init.d/podroid-bootstrap b/build-rootfs/files/etc/init.d/podroid-bootstrap
index f95164d..97ed070 100644
--- a/build-rootfs/files/etc/init.d/podroid-bootstrap
+++ b/build-rootfs/files/etc/init.d/podroid-bootstrap
@@ -42,12 +42,16 @@ start() {
# Downloads share — self-gating: host only adds the virtio-9p device when
# the user enables the toggle, so this returns ENODEV and exits silently
- # when off. Backgrounded so a slow share never blocks boot.
- # msize=512000 is the actual virtio-9p ceiling; asking for more just gets
- # capped with a kernel warning.
+ # when off. Foreground so a missing /dev/fuse or kernel feature surfaces
+ # in the boot log instead of being swallowed.
+ # msize=262144 (256 KB) — well under QEMU's virtio-9p 512 KB ceiling and
+ # large enough to amortize round-trips for big reads. cache=mmap is the
+ # next-best after cache=fscache (which requires CONFIG_9P_FSCACHE=y, not
+ # in this kernel build); mmap still page-caches mapped regions and is
+ # noticeably better than cache=loose for re-reads.
mkdir -p /mnt/downloads 2>/dev/null
- mount -t 9p -o trans=virtio,version=9p2000.L,rw,msize=512000,cache=loose,noatime \
- downloads /mnt/downloads 2>/dev/null &
+ mount -t 9p -o trans=virtio,version=9p2000.L,rw,msize=262144,cache=mmap,noatime \
+ downloads /mnt/downloads 2>/dev/null
mkdir -p /dev/net 2>/dev/null
[ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200 2>/dev/null
@@ -87,6 +91,22 @@ start() {
mkdir -p /mnt/persist/docker /var/lib/docker 2>/dev/null
mountpoint -q /var/lib/docker || mount --bind /mnt/persist/docker /var/lib/docker
+ # Same trick for Podman. Without this its overlay graph driver works
+ # (image pulls succeed) but each `podman run` falls back to
+ # fuse-overlayfs for the container's runtime mount — kernel overlay
+ # can't stack on the rootfs overlay we live on. Pinning Podman's
+ # store onto raw ext4 lets the kernel overlay stack cleanly and
+ # gives container IO the same speed Docker enjoys.
+ mkdir -p /mnt/persist/containers /var/lib/containers/storage 2>/dev/null
+ mountpoint -q /var/lib/containers/storage \
+ || mount --bind /mnt/persist/containers /var/lib/containers/storage
+
+ # And for LXC. The overlay storage backend (`lxc-create -B overlayfs`)
+ # has the same nested-overlay problem; even the default `dir` backend
+ # benefits from raw-ext4 IO over going through the rootfs overlay.
+ mkdir -p /mnt/persist/lxc /var/lib/lxc 2>/dev/null
+ mountpoint -q /var/lib/lxc || mount --bind /mnt/persist/lxc /var/lib/lxc
+
# LXC: pre-create lxcbr0 (10.0.3.1/24) so `lxc-start` works out of the
# box. Containers reach the internet via MASQUERADE → eth0 → SLIRP.
# The Alpine lxc-bridge package only ships dnsmasq config, not a
diff --git a/build-rootfs/files/etc/inittab b/build-rootfs/files/etc/inittab
index 1234136..773c43a 100644
--- a/build-rootfs/files/etc/inittab
+++ b/build-rootfs/files/etc/inittab
@@ -2,5 +2,5 @@
::sysinit:/sbin/openrc boot
::wait:/sbin/openrc default
-hvc0::respawn:/sbin/getty -L -l /usr/local/bin/podroid-login hvc0 115200 xterm-256color
+hvc0::respawn:/sbin/getty -L -l /usr/local/bin/podroid-login 115200 hvc0 xterm-256color
::shutdown:/sbin/openrc shutdown
diff --git a/gradle.properties b/gradle.properties
index 212bd86..c6dc9cf 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
podroidQemuVersion=11.0.0-rc2
-podroidKernelVersion=6.6.87
+podroidKernelVersion=7.0.5
diff --git a/init-podroid b/init-podroid
index 45b24e4..1d39caa 100755
--- a/init-podroid
+++ b/init-podroid
@@ -27,7 +27,7 @@ mount -t squashfs -o ro /dev/vdb /mnt/lower
mkdir -p /mnt/persist/upper /mnt/persist/work
mount -t overlay overlay \
- -o lowerdir=/mnt/lower,upperdir=/mnt/persist/upper,workdir=/mnt/persist/work \
+ -o lowerdir=/mnt/lower,upperdir=/mnt/persist/upper,workdir=/mnt/persist/work,metacopy=on,redirect_dir=on,index=on \
/mnt/overlay
# Move /mnt/persist into the new root so users can reach raw storage,
diff --git a/podroid_kernel.config b/podroid_kernel.config
index 7a750a4..368c2a2 100644
--- a/podroid_kernel.config
+++ b/podroid_kernel.config
@@ -64,6 +64,15 @@ CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_BTRFS_FS is not set
# CONFIG_XFS_FS is not set
+# ── Squashfs + zstd decoder — required to mount /dev/vdb (alpine-rootfs.squashfs)
+# build-rootfs.sh uses `mksquashfs -comp zstd -Xcompression-level 19`,
+# so the kernel MUST be able to decode zstd at mount time. Modules don't
+# load early enough — these must be builtin.
+CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_ZSTD=y
+CONFIG_DECOMPRESS_ZSTD=y
+CONFIG_ZSTD_DECOMPRESS=y
+
# ── virtio-9p: Downloads folder sharing ──────────────────────────────────────
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
@@ -104,7 +113,9 @@ CONFIG_NF_TABLES_IPV4=y
CONFIG_NF_TABLES_IPV6=y
CONFIG_NF_TABLES_BRIDGE=y
CONFIG_NF_TABLES_NETDEV=y
-CONFIG_NFT_COUNTER=y
+# NFT_COUNTER / NFT_SET_RBTREE / NFT_SET_HASH were merged into nf_tables core
+# in Linux ~6.2 — they are now built unconditionally when CONFIG_NF_TABLES=y
+# and the standalone Kconfig symbols no longer exist (verified absent in v7.0).
CONFIG_NFT_CONNLIMIT=y
CONFIG_NFT_LOG=y
CONFIG_NFT_LIMIT=y
@@ -112,8 +123,6 @@ CONFIG_NFT_MASQ=y
CONFIG_NFT_REDIR=y
CONFIG_NFT_NAT=y
CONFIG_NFT_CT=y
-CONFIG_NFT_SET_RBTREE=y
-CONFIG_NFT_SET_HASH=y
# iptables (legacy compat layer used by some container tools)
CONFIG_NETFILTER_XTABLES=y
@@ -140,8 +149,9 @@ CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
+# CONFIG_MEMCG_SWAP was removed in Linux 6.1 — swap accounting is now
+# unconditional and folded into MEMCG itself (verified absent in v7.0).
CONFIG_MEMCG=y
-CONFIG_MEMCG_SWAP=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
@@ -164,10 +174,11 @@ CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
# ── ARM64 hardware crypto (AES/SHA via CPU instructions) ─────────────────────
+# CRYPTO_SHA2_ARM64_CE and CRYPTO_AES_ARM64_CE were removed in Linux ~6.10–6.13.
+# Their accelerated routines moved to lib/crypto and are auto-selected by
+# CRYPTO_SHA256 / CRYPTO_AES on capable CPUs (verified absent in v7.0).
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_AES=y
-CONFIG_CRYPTO_SHA2_ARM64_CE=y
-CONFIG_CRYPTO_AES_ARM64_CE=y
CONFIG_CRYPTO_GHASH_ARM64_CE=y
# ── Disable: display / audio / input (no display in -display none) ───────────