Skip to content

Commit 8feeef8

Browse files
e2bclaude
authored andcommitted
feat: commit both amd64 and arm64 busybox binaries with build tags
Replace the single x86-64 busybox binary + fetch-busybox Makefile hack with two architecture-specific binaries selected via Go build tags. GOARCH automatically picks the right binary at compile time. - busybox_amd64: existing x86-64 static binary (renamed) - busybox_arm64: aarch64 static binary - busybox_amd64.go / busybox_arm64.go: build-tag-gated embeds - Remove fetch-busybox Makefile target (no longer needed) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2c3c1bf commit 8feeef8

File tree

5 files changed

+13
-31
lines changed

5 files changed

+13
-31
lines changed

packages/orchestrator/Makefile

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ build:
2828
@docker build --platform $(BUILD_PLATFORM) --output=bin --build-arg COMMIT_SHA="$(COMMIT_SHA)" -f ./Dockerfile ..
2929

3030
.PHONY: build-local
31-
build-local: fetch-busybox
31+
build-local:
3232
# Allow for passing commit sha directly for docker builds
3333
$(eval COMMIT_SHA ?= $(shell git rev-parse --short HEAD))
3434
CGO_ENABLED=1 GOOS=linux GOARCH=$(BUILD_ARCH) go build -o bin/orchestrator -ldflags "-X=main.commitSHA=$(COMMIT_SHA)" .
3535
CGO_ENABLED=1 GOOS=linux GOARCH=$(BUILD_ARCH) go build -o bin/clean-nfs-cache -ldflags "-X=main.commitSHA=$(COMMIT_SHA)" ./cmd/clean-nfs-cache
3636

3737
.PHONY: build-debug
38-
build-debug: fetch-busybox
38+
build-debug:
3939
CGO_ENABLED=1 GOOS=linux GOARCH=$(BUILD_ARCH) go build -race -gcflags=all="-N -l" -o bin/orchestrator .
4040

4141
.PHONY: run-debug
@@ -132,34 +132,6 @@ build-template:
132132
-kernel $(KERNEL_VERSION) \
133133
-firecracker $(FIRECRACKER_VERSION)
134134

135-
.PHONY: fetch-busybox
136-
fetch-busybox:
137-
@ARCH=$$(go env GOARCH); \
138-
BUSYBOX_TARGET=./pkg/template/build/core/systeminit/busybox_1.36.1-2; \
139-
if [ "$$ARCH" != "arm64" ]; then \
140-
echo "✓ Using bundled amd64 busybox"; \
141-
elif file "$$BUSYBOX_TARGET" 2>/dev/null | grep -q 'aarch64\|ARM aarch64'; then \
142-
echo "✓ Busybox is already arm64"; \
143-
elif command -v busybox >/dev/null 2>&1 && file "$$(command -v busybox)" 2>/dev/null | grep -q 'aarch64\|ARM aarch64' && file "$$(command -v busybox)" 2>/dev/null | grep -q 'statically linked'; then \
144-
cp "$$(command -v busybox)" "$$BUSYBOX_TARGET" && \
145-
echo "✓ Copied host busybox (arm64, static) to embedded path"; \
146-
elif command -v apt-get >/dev/null 2>&1 && command -v dpkg-deb >/dev/null 2>&1; then \
147-
echo "Fetching arm64 busybox via apt..."; \
148-
TMPDIR=$$(mktemp -d); \
149-
apt-get download busybox-static 2>/dev/null && \
150-
dpkg-deb -x busybox-static_*.deb "$$TMPDIR" && \
151-
cp "$$TMPDIR/bin/busybox" "$$BUSYBOX_TARGET" && \
152-
rm -rf "$$TMPDIR" busybox-static_*.deb && \
153-
echo "✓ Replaced embedded busybox with arm64 binary (from busybox-static package)" || \
154-
{ rm -rf "$$TMPDIR" busybox-static_*.deb; echo "⚠ apt-get download failed"; exit 1; }; \
155-
else \
156-
echo "⚠ ARM64 busybox required but no method available to fetch it."; \
157-
echo " Options:"; \
158-
echo " 1. Install busybox-static: apt install busybox-static, then re-run"; \
159-
echo " 2. Manually place an arm64 busybox binary at: $$BUSYBOX_TARGET"; \
160-
exit 1; \
161-
fi
162-
163135
.PHONY: migrate
164136
migrate:
165137
./scripts/upload-envs.sh /mnt/disks/fc-envs/v1 $(TEMPLATE_BUCKET_NAME)

packages/orchestrator/pkg/template/build/core/systeminit/busybox_1.36.1-2 renamed to packages/orchestrator/pkg/template/build/core/systeminit/busybox_amd64

File renamed without changes.

packages/orchestrator/pkg/template/build/core/systeminit/busybox.go renamed to packages/orchestrator/pkg/template/build/core/systeminit/busybox_amd64.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
//go:build amd64
2+
13
package systeminit
24

35
import _ "embed"
46

5-
//go:embed busybox_1.36.1-2
7+
//go:embed busybox_amd64
68
var BusyboxBinary []byte
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//go:build arm64
2+
3+
package systeminit
4+
5+
import _ "embed"
6+
7+
//go:embed busybox_arm64
8+
var BusyboxBinary []byte

0 commit comments

Comments
 (0)