@@ -23,13 +23,10 @@ ARCH = arm64
2323endif
2424
2525arches := amd64 arm64
26- DOCKER_2_HW_amd64 := x86_64
27- DOCKER_2_HW_arm64 := aarch64
26+ modes := rel dbg
2827
29- dist-files :=
3028hook-bootkit-deps := $(wildcard hook-bootkit/* )
3129hook-docker-deps := $(wildcard hook-docker/* )
32- modes := rel dbg
3330
3431define foreach_mode_arch_rules =
3532# mode := $(1)
@@ -52,11 +49,6 @@ out/$T/$(1)/$(2)/hook.yaml: $$(LINUXKIT_CONFIG)
5249 if [[ $(1 ) == dbg ]]; then
5350 sed -i '/^\s*# dbg/ s|#dbg||' $$@
5451 fi
55-
56- out/$T/$(1 ) /hook_$(DOCKER_2_HW_$(2 ) ) .tar.gz: out/$T/$(1 ) /initramfs-$(DOCKER_2_HW_$(2 ) ) out/$T/$(1 ) /vmlinuz-$(DOCKER_2_HW_$(2 ) )
57- out/$T/$(1 ) /initramfs-$(DOCKER_2_HW_$(2 ) ) : out/$T/$(1 ) /$(2 ) /initrd.img
58- out/$T/$(1 ) /vmlinuz-$(DOCKER_2_HW_$(2 ) ) : out/$T/$(1 ) /$(2 ) /kernel
59- dist-files += out/$T/$(1 ) /initramfs-$(DOCKER_2_HW_$(2 ) ) out/$T/$(1 ) /vmlinuz-$(DOCKER_2_HW_$(2 ) )
6052endef
6153$(foreach m,$(modes),$(foreach a,$(arches),$(eval $(call foreach_mode_arch_rules,$m,$a))))
6254
@@ -65,7 +57,6 @@ define foreach_arch_rules =
6557
6658debug: dbg-image-$(1 )
6759dbg-image-$(1 ) : out/$T/dbg/$(1 ) /hook.tar
68- dist: out/$T/rel/hook_$(DOCKER_2_HW_$(1 ) ) .tar.gz
6960images: out/$T/rel/$(1 ) /hook.tar
7061
7162hook-bootkit: out/$T/hook-bootkit-$(1 )
@@ -85,15 +76,6 @@ run-$(1):
8576endef
8677$(foreach a,$(arches),$(eval $(call foreach_arch_rules,$a)))
8778
88- define foreach_mode_rules =
89- # mode := $(1)
90-
91- out/$T/$(1 ) /hook_%.tar.gz:
92- tar -C $$(@D ) -cvf- $$(^F ) | pigz > $$@
93-
94- endef
95- $(foreach m,$(modes),$(eval $(call foreach_mode_rules,$m)))
96-
9779push-hook-bootkit : $(hook-bootkit-deps )
9880push-hook-docker : $(hook-docker-deps )
9981push-hook-bootkit push-hook-docker : platforms=$(addprefix linux/,$(arches ) )
@@ -104,12 +86,19 @@ push-hook-bootkit push-hook-docker:
10486 docker buildx build --platform $$ platforms --push -t $(ORG ) /$(container ) :$T $(container )
10587
10688.PHONY : dist
107- dist : # # Build tarballs for distribution
108- $(dist-files ) :
109- cp $< $@
110-
111- .PHONY : dbg-dist
112- dbg-dist : out/$T/dbg/hook_$(DOCKER_2_HW_$(ARCH ) ) .tar.gz # # Build debug enabled tarball
89+ dist : out/$T/rel/amd64/hook.tar out/$T/rel/arm64/hook.tar # # Build tarballs for distribution
90+ dbg-dist : out/$T/dbg/$(ARCH ) /hook.tar # # Build debug enabled tarball
91+ dist dbg-dist :
92+ for f in $^; do
93+ case $$ f in
94+ * amd64* ) arch=x86_64 ;;
95+ * arm64* ) arch=aarch64 ;;
96+ * ) echo unknown arch && exit 1;;
97+ esac
98+ d=$$(dirname $$(dirname $$f ) )
99+ tar -xf $$ f -C $$ d/ kernel && mv $$ d/kernel $$ d/vmlinuz-$$ arch
100+ tar -xf $$ f -C $$ d/ initrd.img && mv $$ d/initrd.img $$ d/initramfs-$$ arch
101+ done
113102
114103.PHONY : deploy
115104deploy : dist # # Push tarball to S3
0 commit comments