Skip to content

Commit 3850e9f

Browse files
committed
fix: Android overlay.sh support for FC /dev/vdX paths, code cleanup
- Add /dev/vdX direct path branch to Android overlay.sh resolve_disk() so FC VMs can find disks (FC has no virtio serial support) - Skip configure_networking unless kernel ip= param is present - Extract GC Collect to shared Backend.GCCollect() (was duplicated) - Fix goroutine leak in mergeWatchChannels (missing ctx.Done check)
1 parent 3e87348 commit 3850e9f

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

os-image/android/overlay.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ resolve_disk() {
88
local serial="$1" timeout="${COCOON_TIMEOUT:-10}" i=0
99
case "$timeout" in ''|*[!0-9]*) timeout=10 ;; esac
1010

11+
# Direct device path (Firecracker uses /dev/vdX, no virtio serial support)
12+
case "$serial" in
13+
/dev/*)
14+
while [ $i -lt $timeout ]; do
15+
[ -b "$serial" ] && echo "$serial" && return 0
16+
sleep 1
17+
i=$((i + 1))
18+
done
19+
return 1
20+
;;
21+
esac
22+
23+
# Serial name lookup (Cloud Hypervisor virtio-blk serial)
1124
while [ $i -lt $timeout ]; do
1225
for sysdev in /sys/block/vd*; do
1326
[ -d "$sysdev" ] || continue
@@ -33,11 +46,13 @@ mountroot() {
3346
log_begin_msg "Cocoon: mounting stealth overlay rootfs"
3447

3548
# Process kernel ip= parameters if present (creates /run/net-*.conf).
36-
# Ubuntu 22.04 only calls configure_networking for BOOT=local (in local-top),
37-
# not for custom boot scripts. Call it explicitly so ipconfig always runs.
38-
# The function is idempotent — skips if networking is already configured.
49+
# Only call configure_networking when ip= is on the cmdline — without it,
50+
# the function probes for devices and waits for udev, adding delay on
51+
# VMs with no NICs.
3952
if ! ls /run/net-*.conf >/dev/null 2>&1; then
40-
configure_networking
53+
for _x in $(cat /proc/cmdline); do
54+
case $_x in ip=*) configure_networking; break ;; esac
55+
done
4156
fi
4257

4358
# Native environment: modprobe automatically resolves all underlying dependencies.

0 commit comments

Comments
 (0)