From d12a5be97bf8849d06514e0c6b0b865a4d8342bc Mon Sep 17 00:00:00 2001 From: Lei Li Date: Wed, 27 Mar 2024 08:03:50 +0000 Subject: [PATCH] podvm-mkosi: fix Architecture cannot be used in Match mkosi version in nix is 17.1, which doesn't support Architecture in [Match] As a workaround, use a flag files instead Signed-off-by: Lei Li Signed-off-by: Lei Li --- src/cloud-api-adaptor/podvm-mkosi/Makefile | 7 ++++++- .../mkosi.presets/initrd/mkosi.conf.d/fedora-s390x.conf | 6 +++++- .../mkosi.presets/system/mkosi.conf.d/fedora-bootable.conf | 6 +++++- .../mkosi.presets/system/mkosi.conf.d/fedora-s390x.conf | 6 +++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/cloud-api-adaptor/podvm-mkosi/Makefile b/src/cloud-api-adaptor/podvm-mkosi/Makefile index 750c00996..2015619ec 100644 --- a/src/cloud-api-adaptor/podvm-mkosi/Makefile +++ b/src/cloud-api-adaptor/podvm-mkosi/Makefile @@ -45,26 +45,31 @@ binaries: PHONY: image image: @echo "Enabling production preset..." - rm -rf resources/buildDebugImage + rm -rf resources/build*Image rm -rf ./build @echo "Building image..." ifeq ($(ARCH),s390x) + touch resources/buildS390xImage mkosi --profile production.conf ../hack/build-s390x-image.sh else + touch resources/buildBootableImage nix develop ..#podvm-mkosi --command mkosi --environment=VARIANT_ID=production endif PHONY: image-debug image-debug: @echo "Enabling debug preset..." + rm -rf resources/build*Image touch resources/buildDebugImage rm -rf ./build @echo "Building debug image..." ifeq ($(ARCH),s390x) + touch resources/buildS390xImage mkosi --profile debug.conf ../hack/build-s390x-image.sh else + touch resources/buildBootableImage nix develop ..#podvm-mkosi --command mkosi --environment=VARIANT_ID=debug endif diff --git a/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/initrd/mkosi.conf.d/fedora-s390x.conf b/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/initrd/mkosi.conf.d/fedora-s390x.conf index 2ca277b58..a0b32cc2e 100644 --- a/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/initrd/mkosi.conf.d/fedora-s390x.conf +++ b/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/initrd/mkosi.conf.d/fedora-s390x.conf @@ -1,7 +1,11 @@ [Match] Distribution=fedora -Architecture=s390x +# mkosi version in nix is 17.1, +# which doesn't support Architecture in [Match] +# As a workaround, use a flag file instead. +#Architecture=s390x +PathExists=../../resources/buildS390xImage [Content] Packages=kernel-core diff --git a/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-bootable.conf b/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-bootable.conf index 5ba2eafc7..432feea10 100644 --- a/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-bootable.conf +++ b/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-bootable.conf @@ -1,7 +1,11 @@ [Match] Distribution=fedora -Architecture=!s390x +# mkosi version in nix is 17.1, +# which doesn't support Architecture in [Match] +# As a workaround, use a flag file instead. +#Architecture=!s390x +PathExists=../../resources/buildBootableImage [Content] Packages=systemd-boot diff --git a/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-s390x.conf b/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-s390x.conf index 2d5ad9695..6228de4ec 100644 --- a/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-s390x.conf +++ b/src/cloud-api-adaptor/podvm-mkosi/mkosi.presets/system/mkosi.conf.d/fedora-s390x.conf @@ -1,7 +1,11 @@ [Match] Distribution=fedora -Architecture=s390x +# mkosi version in nix is 17.1, +# which doesn't support Architecture in [Match] +# As a workaround, use a flag file instead. +#Architecture=s390x +PathExists=../../resources/buildS390xImage [Content] Bootable=no