Skip to content

Commit 3d79868

Browse files
committed
fix(image-factory): refuse the os_image fallback for a named board
image_url falls back to os_image when a platform has no image of its own. That is right for the host architecture, which legitimately has none. For a named board it is not: with no "<board>_image" pinned, the x86_64 image was written to an ARM card - an image that builds cleanly and never boots. Reached today by orangepi-zero3, whose entry in release.json was null. Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent 2eeb587 commit 3d79868

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎image-factory/create_image.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ if [[ ! -f "${CONFIG_PATH}" ]]; then
7676
fi
7777
export OS_ARCH="${OS_ARCH:-"$(arch)"}"
7878

79+
# The fallback to os_image is for a platform that has no image of its own
80+
# because it does not need one - the host architecture. For a named board it
81+
# would quietly write a foreign architecture onto the card: an image that builds
82+
# cleanly and never boots.
83+
case "${OS_ARCH}" in
84+
rpi-arm64|rpi-arm32|orangepi-zero3)
85+
image_url "${OS_ARCH}" >/dev/null || raise \
86+
"No \"${OS_ARCH}_image\" in the configuration. Refusing to fall back to
87+
os_image: that is a different architecture, and it would produce an image
88+
that builds cleanly and never boots. Pin it in release.json."
89+
;;
90+
esac
91+
7992
OS_IMAGE="$(image_url "${OS_ARCH}" || image_url "os")" || \
8093
action_on_failure "cuos:updater:os_image_not_defined" "OS image not defined"
8194
OS_DIGEST="$(jq -r --arg arch "${OS_ARCH}" '.[$arch+"_image_digest"] // .os_image_digest // empty' "${CONFIG_PATH}")"

0 commit comments

Comments
 (0)