Package: u-boot-menu
Severity: normal
Version: 3
Tags: patch

Some architectures which might make use of u-boot-menu do not have
kernel files matching "vmlinuz" (e.g. riscv64 has "vmlinux").

The attached patch uses "linux-version list --paths" to output the path
of each versioned kernel, which outputs the matching kernel filenames.

live well,
  vagrant

From f33424de3c643127d4f41284f9516ed7a54846af Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@debian.org>
Date: Thu, 9 May 2019 14:53:04 -0700
Subject: [PATCH] Use "linux-version list --paths" to avoid hard-coding
 "vmlinuz" kernels.

---
 u-boot-update | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/u-boot-update b/u-boot-update
index 9dd8b0e..bd4ccd2 100755
--- a/u-boot-update
+++ b/u-boot-update
@@ -132,7 +132,7 @@ timeout ${U_BOOT_TIMEOUT}
 "
 
 # Find linux versions
-_VERSIONS="$(linux-version list | linux-version sort --reverse)"
+_VERSIONS=$(linux-version list --paths | linux-version sort --reverse | sed -e 's,.*/boot/,,g')
 
 # Find boot directory as seen in u-boot, and path prefix while in linux
 if [ "$(stat --printf %d /)" = "$(stat --printf %d /boot)" ]
@@ -147,9 +147,11 @@ else
 fi
 
 
-for _VERSION in ${_VERSIONS}
+for _KERNEL in ${_VERSIONS}
 do
-	echo "P: Writing config for /boot/vmlinuz-${_VERSION}..."
+	# Strip kernel prefix to derive version.
+	_VERSION=${_KERNEL#*-}
+	echo "P: Writing config for ${_KERNEL}..."
 
 	_NUMBER="${_NUMBER:-0}"
 	_ENTRY="${_ENTRY:-1}"
@@ -181,7 +183,7 @@ do
 
 label l${_NUMBER}
 	menu label ${U_BOOT_MENU_LABEL} ${_VERSION}
-	linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
+	linux ${_BOOT_DIRECTORY}/${_KERNEL}
 	${_INITRD}
 	${_FDT}
 	append ${U_BOOT_ROOT} ${U_BOOT_PARAMETERS}"
@@ -196,7 +198,7 @@ label l${_NUMBER}
 
 label l${_NUMBER}r
 	menu label ${U_BOOT_MENU_LABEL} ${_VERSION} (rescue target)
-	linux ${_BOOT_DIRECTORY}/vmlinuz-${_VERSION}
+	linux ${_BOOT_DIRECTORY}/${_KERNEL}
 	${_INITRD}
 	${_FDT}
 	append ${U_BOOT_ROOT} $(echo ${U_BOOT_PARAMETERS} | sed -e 's| quiet||') single
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to