File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,8 +203,8 @@ jobs:
203203
204204 - name : Build remaining artifacts (initrd and shim)
205205 run : |
206- echo "Building shim, initrd and libkrun... "
207- docker buildx bake shim initrd libkrun
206+ echo "Building host and guest binaries: "
207+ docker buildx bake host-binaries guest-binaries
208208
209209 - name : Verify all artifacts
210210 run : |
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ ONI = "👹"
2323
2424ARCH = $(shell uname -m)
2525OS = $(shell uname -s)
26+
2627LDFLAGS_x86_64_Linux = -lkrun
2728LDFLAGS_aarch64_Linux = -lkrun
2829LDFLAGS_arm64_Darwin = -L/opt/homebrew/lib -lkrun
@@ -52,10 +53,13 @@ GO_STATIC_LDFLAGS := -ldflags '-extldflags "-static" $(LDFLAGS) $(EXTRA_LDFLAGS)
5253MODULE_NAME =$(shell go list -m)
5354API_PACKAGES =$(shell ($(GO ) list ${GO_TAGS} ./... | grep /api/ ) )
5455
55- .PHONY : clean all validate lint generate protos check-protos check-api-descriptors proto-fmt shell
56+ .PHONY : clean all build validate lint generate protos check-protos check-api-descriptors proto-fmt shell
57+
58+ all : build
5659
57- all :
58- $(BUILDX ) bake
60+ build :
61+ @echo " $( WHALE) $@ "
62+ HOST_OS=$(shell uname -s | tr '[:upper:]' '[:lower:]') KERNEL_ARCH=$(ARCH ) $(BUILDX ) bake
5963
6064_output/containerd-shim-nerdbox-v1 : cmd/containerd-shim-nerdbox-v1 FORCE
6165 @echo " $( WHALE) $@ "
Original file line number Diff line number Diff line change 1+ variable "HOST_OS" {
2+ default = " linux"
3+ }
4+
15variable "KERNEL_VERSION" {
26 default = " 6.12.44"
37}
@@ -47,44 +51,66 @@ target "_common" {
4751 }
4852}
4953
54+ target "_host_common" {
55+ inherits = [" _common" ]
56+ args = {
57+ TARGETOS = HOST_OS
58+ }
59+ }
60+
61+ target "_guest_common" {
62+ inherits = [" _common" ]
63+ args = {
64+ TARGETOS = " linux"
65+ }
66+ }
67+
5068variable "DESTDIR" {
5169 default = " _output"
5270}
5371
72+ group "default" {
73+ targets = [" host-binaries" , " guest-binaries" , " kernel" ]
74+ }
75+
76+ group "host-binaries" {
77+ targets = [" shim" , " libkrun" ]
78+ }
79+
80+ group "guest-binaries" {
81+ targets = [" initrd" ]
82+ }
83+
5484target "menuconfig" {
5585 inherits = [" _common" ]
5686 target = " kernel-build-base"
5787 output = [" type=image,name=nerdbox-menuconfig" ]
5888}
5989
6090target "kernel" {
61- inherits = [" _common " ]
91+ inherits = [" _guest_common " ]
6292 target = " kernel"
6393 output = [" ${ DESTDIR } " ]
6494}
6595
6696target "initrd" {
67- inherits = [" _common " ]
97+ inherits = [" _guest_common " ]
6898 target = " initrd"
6999 output = [" ${ DESTDIR } " ]
70100}
71101
72102target "shim" {
73- inherits = [" _common " ]
103+ inherits = [" _host_common " ]
74104 target = " shim"
75105 output = [" ${ DESTDIR } " ]
76106}
77107
78108target "libkrun" {
79- inherits = [" _common " ]
109+ inherits = [" _host_common " ]
80110 target = " libkrun"
81111 output = [" ${ DESTDIR } " ]
82112}
83113
84- group "default" {
85- targets = [" kernel" , " initrd" , " shim" ]
86- }
87-
88114target "dev" {
89115 inherits = [" _common" ]
90116 target = " dev"
You can’t perform that action at this time.
0 commit comments