tinkerbell / hook

In-memory Operating System Installation Environment for Executing Tinkerbell Workflows
Apache License 2.0
102 stars 49 forks source link

[Feature Request] Let the user choose which architecture to build #160

Closed mgrzybek closed 1 month ago

mgrzybek commented 1 year ago

The target architecture(s) (amd64 or arm64) should be configurable.

Expected Behaviour

I would like to be able to choose which architecture I want to build without patching rules.mk.

Current Behaviour

The targets actually build both amd64 and arm64.

Possible Solution

The dirty way, patching rules.mk:

diff --git a/rules.mk b/rules.mk
index b2c5133..717e1da 100644
--- a/rules.mk
+++ b/rules.mk
@@ -22,7 +22,7 @@ ifeq ($(ARCH),aarch64)
 ARCH = arm64
 endif

-arches := amd64 arm64
+arches := amd64
 modes := rel dbg

 hook-bootkit-deps := $(wildcard hook-bootkit/*)
@@ -87,7 +87,7 @@ push-hook-bootkit push-hook-docker:
        docker buildx build --platform $$platforms --push -t $(ORG)/$(container):$T $(container)

 .PHONY: dist
-dist: out/$T/rel/amd64/hook.tar out/$T/rel/arm64/hook.tar ## Build tarballs for distribution
+dist: out/$T/rel/amd64/hook.tar ## Build tarballs for distribution
 dbg-dist: out/$T/dbg/$(ARCH)/hook.tar ## Build debug enabled tarball
 dist dbg-dist:
        for f in $^; do
ubuntu@factory:~/tinkerbell/hook$ git diff > ../hook.patch
ubuntu@factory:~/tinkerbell/hook$ cat ../hook.patch 
diff --git a/rules.mk b/rules.mk
index b2c5133..717e1da 100644
--- a/rules.mk
+++ b/rules.mk
@@ -22,7 +22,7 @@ ifeq ($(ARCH),aarch64)
 ARCH = arm64
 endif

-arches := amd64 arm64
+arches := amd64
 modes := rel dbg

 hook-bootkit-deps := $(wildcard hook-bootkit/*)
@@ -87,7 +87,7 @@ push-hook-bootkit push-hook-docker:
        docker buildx build --platform $$platforms --push -t $(ORG)/$(container):$T $(container)

 .PHONY: dist
-dist: out/$T/rel/amd64/hook.tar out/$T/rel/arm64/hook.tar ## Build tarballs for distribution
+dist: out/$T/rel/amd64/hook.tar ## Build tarballs for distribution
 dbg-dist: out/$T/dbg/$(ARCH)/hook.tar ## Build debug enabled tarball
 dist dbg-dist:
        for f in $^; do

Context

Three reasons:

jacobweinstock commented 1 month ago

Hey @mgrzybek . Thanks for reporting this. Apologies for the very delayed response. The build process has been completely refactored and this capability is now available. ./build.sh build hook-latest-lts-amd64 for x86_64 and ./build.sh build hook-latest-lts-arm64 for arm64. Try it out and let me know how it goes. Thanks!