From 3c289eec96a32ded06e8e6745dece48540fd9217 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Tue, 8 Oct 2024 12:16:26 +0900 Subject: [PATCH 1/4] inject-cmdline-to-template.sh: use `limactl edit` instead of `yq -i` Signed-off-by: Norio Nomura --- hack/inject-cmdline-to-template.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/inject-cmdline-to-template.sh b/hack/inject-cmdline-to-template.sh index 04431e7d1ab..674c168cd71 100755 --- a/hack/inject-cmdline-to-template.sh +++ b/hack/inject-cmdline-to-template.sh @@ -91,7 +91,7 @@ function inject_to() { for field_name in location digest cmdline; do [[ -z ${!field_name} ]] || fields+=("\"${field_name}\": \"${!field_name}\"") done - yq -i -I 2 eval "setpath([(.images[] | select(.arch == \"${arch}\") | path)].[${index}] + \"${key}\"; { ${fields[*]}})" "${template}" + limactl edit --log-level error --set "setpath([(.images[] | select(.arch == \"${arch}\") | path)].[${index}] + \"${key}\"; { ${fields[*]}})" "${template}" } inject_to "${template}" "${arch}" "${index}" "kernel" "${kernel_location}" "${kernel_digest}" "${cmdline}" inject_to "${template}" "${arch}" "${index}" "initrd" "${initrd_location}" "${initrd_digest}" From b1609f2ebdad1ed8fba3971728d01bf35c7e76ef Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Fri, 11 Oct 2024 19:01:49 +0900 Subject: [PATCH 2/4] inject-cmdline-to-template.sh: simplify `yq` filter Signed-off-by: Norio Nomura --- hack/inject-cmdline-to-template.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hack/inject-cmdline-to-template.sh b/hack/inject-cmdline-to-template.sh index 674c168cd71..6500915143b 100755 --- a/hack/inject-cmdline-to-template.sh +++ b/hack/inject-cmdline-to-template.sh @@ -29,9 +29,7 @@ esac # 2. extract location by parsing template using arch readonly yq_filter=" -[ - .images | map(select(.arch == \"${arch}\")) | [.[].location] -]|flatten|.[] + .images[]|select(.arch == \"${arch}\")|.location " parsed=$(yq eval "${yq_filter}" "${template}") From 520df46a93e106607d8edead54ab71efda39d9dc Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Fri, 11 Oct 2024 19:02:22 +0900 Subject: [PATCH 3/4] inject-cmdline-to-template.sh: add `armv7l` and `riscv64` to arch Signed-off-by: Norio Nomura --- hack/inject-cmdline-to-template.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hack/inject-cmdline-to-template.sh b/hack/inject-cmdline-to-template.sh index 6500915143b..09e25b717d7 100755 --- a/hack/inject-cmdline-to-template.sh +++ b/hack/inject-cmdline-to-template.sh @@ -21,6 +21,8 @@ arch="${arch:-$(uname -m)}" case "${arch}" in amd64 | x86_64) arch=x86_64 ;; aarch64 | arm64) arch=aarch64 ;; +armv7l | armhf) arch=armv7l ;; +riscv64) arch=riscv64 ;; *) echo "Unsupported arch: ${arch}" >&2 exit 1 From d07eef34dd49bb7ad88d61ac2f366a400f1eb569 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Thu, 7 Nov 2024 15:23:54 +0900 Subject: [PATCH 4/4] inject-cmdline-to-template.sh: change `default_cmdline` for minimal flavor use `root=/dev/vda1` instead of `root=LABEL=cloudimg-rootfs` Signed-off-by: Norio Nomura --- hack/inject-cmdline-to-template.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hack/inject-cmdline-to-template.sh b/hack/inject-cmdline-to-template.sh index 09e25b717d7..13dec85cef7 100755 --- a/hack/inject-cmdline-to-template.sh +++ b/hack/inject-cmdline-to-template.sh @@ -57,6 +57,8 @@ done if [[ -z ${location} ]]; then echo "Failed to get the image location for ${template}" >&2 exit 1 +elif [[ ${location} == https://cloud-images.ubuntu.com/minimal/* ]]; then + readonly default_cmdline="root=/dev/vda1 ro console=tty1 console=ttyAMA0" elif [[ ${location} == https://cloud-images.ubuntu.com/* ]]; then readonly default_cmdline="root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyAMA0" else