Skip to content

Commit 06f483f

Browse files
tomassrnkaclaude
andcommitted
build: add fetch-busybox target for multi-arch busybox binary
The embedded busybox binary is x86_64. On ARM64 hosts, add a Makefile target that extracts the correct busybox from the busybox-static apt package, ensuring the binary comes from a trusted source rather than copying an arbitrary system binary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c3b6cb0 commit 06f483f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/orchestrator/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ build-template:
123123
-kernel $(KERNEL_VERSION) \
124124
-firecracker $(FIRECRACKER_VERSION)
125125

126+
.PHONY: fetch-busybox
127+
fetch-busybox:
128+
@ARCH=$$(dpkg --print-architecture 2>/dev/null || echo "amd64"); \
129+
if [ "$$ARCH" = "arm64" ]; then \
130+
echo "Fetching arm64 busybox via apt..."; \
131+
TMPDIR=$$(mktemp -d); \
132+
apt-get download busybox-static 2>/dev/null && \
133+
dpkg-deb -x busybox-static_*.deb "$$TMPDIR" && \
134+
cp "$$TMPDIR/bin/busybox" ./internal/template/build/core/systeminit/busybox_1.36.1-2 && \
135+
rm -rf "$$TMPDIR" busybox-static_*.deb && \
136+
echo "✓ Replaced embedded busybox with arm64 binary (from busybox-static package)" || \
137+
{ rm -rf "$$TMPDIR" busybox-static_*.deb; echo "⚠ Failed to fetch busybox-static — install it: apt install busybox-static"; exit 1; }; \
138+
else \
139+
echo "✓ Using bundled amd64 busybox"; \
140+
fi
141+
126142
.PHONY: migrate
127143
migrate:
128144
./scripts/upload-envs.sh /mnt/disks/fc-envs/v1 $(TEMPLATE_BUCKET_NAME)

0 commit comments

Comments
 (0)