kbuild: buildtar: install riscv compressed images as vmlinuz
authorEmil Renner Berthing <emil.renner.berthing@canonical.com>
Thu, 2 May 2024 11:16:08 +0000 (13:16 +0200)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 9 May 2024 19:34:52 +0000 (04:34 +0900)
Use the KBUILD_IMAGE variable to determine the right kernel image to
install and install compressed images to /boot/vmlinuz-$version like the
'make install' target already does.

Signed-off-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/package/buildtar

index fe816f62a290c944eedce71d22b955bfb6226e05..eb67787f8673305ed104e1aac51d10909bfed651 100755 (executable)
@@ -54,9 +54,8 @@ cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
 # Install arch-specific kernel image(s)
 #
 # Note:
-#   mips, arm64, and riscv copy the first image found. This may not produce
-#   the desired outcome because it may pick up a stale file remaining in the
-#   build tree.
+#   mips and arm64 copy the first image found. This may not produce the desired
+#   outcome because it may pick up a stale file remaining in the build tree.
 #
 case "${ARCH}" in
        alpha)
@@ -98,13 +97,12 @@ case "${ARCH}" in
                done
                ;;
        riscv)
-               # Please note the following code may copy a stale file.
-               for i in Image.bz2 Image.gz Image; do
-                       if [ -f "${objtree}/arch/riscv/boot/${i}" ] ; then
-                               cp -v -- "${objtree}/arch/riscv/boot/${i}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
-                               break
-                       fi
-               done
+               case "${KBUILD_IMAGE##*/}" in
+                       Image.*|vmlinuz.efi)
+                               cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}";;
+                       *)
+                               cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}";;
+               esac
                ;;
        *)
                cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"