[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#767744: flash-kernel: There is no way to specify a custom dtb



tag 767744 + patch
quit

Hello,

On 11/03/2014 07:10 PM, Cyril Brulebois wrote:
> Ian Campbell <ijc@hellion.org.uk> (2014-11-03):
>> On Sun, 2014-11-02 at 12:08 +0100, Uwe Kleine-König wrote:
>>> Package: flash-kernel
>>> Version: 3.28
>>> Severity: wishlist
>>>
>>> Hello,
>>>
>>> I want to use flash-kernel on a machine that uses a device tree blob that isn't
>>> included in the kernel package. So flash-kernel's assumption to find
>>> /usr/lib/linux-image-$kvers/$dtb_id is wrong.
>>>
>>> Maybe something like:
>>>
>>> 	# if dtb_name starts with / assume it's a stand alone file. Otherwise
>>> 	# pick the one shipped by the linux image.
>>> 	if expr "$dtb_name" : "/" >/dev/null; then
>>> 		dtb="$dtb_name" 
>>> 	else
>>> 		dtb="/usr/lib/linux-image-$kvers/$dtb_name"
>>> 	fi
>>>
>>> would work?
>>
>> expr isn't a builtin, right? So we don't need to worry about dash vs
>> bash for it and whether the ":" operator is implemented.
> 
> Just use case and match on /*?
Good idea. The attached patch (nearly[1]) works for me.

Best regards
Uwe

[1] only nearly because the armmp kernel doesn't have mtdblock support
which is needed for my machine as it uses "Mtd-Kernel:"
>From a7232e140d67a1416b162b720f2c68b7a0385ad5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <uwe@kleine-koenig.org>
Date: Tue, 4 Nov 2014 10:45:19 +0100
Subject: [PATCH] Allow DTB-Id to be an absolute file name

This makes it easier to support systems that don't have a corresponding
device tree shipped with the kernel image package.
---
 README           |  2 ++
 debian/changelog |  7 +++++++
 functions        | 19 +++++++++++++++++--
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 0ddae85..d0adb13 100644
--- a/README
+++ b/README
@@ -107,6 +107,8 @@ The supported fields are:
   DTB-Append-From.
 
 * DTB-Id: (optional) specifies the name of the DTB file for this device
+  If this is a relative filename it is interpreted with
+  /usr/lib/linux-image-$kvers as base directory.
 
 * DTB-Append: (optional) when yes the DTB specified by DTB-Id will be appended
   to the kernel image.
diff --git a/debian/changelog b/debian/changelog
index 3a5b348..62d6643 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+flash-kernel (3.29) UNRELEASED; urgency=medium
+
+  * Fix "There is no way to specify a custom dtb" by allowing DTB-Id to be an
+    absolute file name. (Closes: #767744)
+
+ -- Uwe Kleine-Koenig <uwe@kleine-koenig.org>  Tue, 04 Nov 2014 10:16:12 +0100
+
 flash-kernel (3.28) unstable; urgency=medium
 
   [ Ian Campbell ]
diff --git a/functions b/functions
index d45a4e6..93e5977 100644
--- a/functions
+++ b/functions
@@ -414,7 +414,15 @@ handle_dtb() {
 		return
 	fi
 
-	local dtb="/usr/lib/linux-image-$kvers/$dtb_id"
+	local dtb
+	case "$dtb_id" in
+		/*)
+			dtb="$dtb_id"
+		;;
+		*)
+			dtb="/usr/lib/linux-image-$kvers/$dtb_id"
+		;;
+	esac
 	if [ "x$FK_KERNEL_HOOK_SCRIPT" = "xpostrm.d" ] ; then
 		rm -f "/boot/dtb-$kvers"
 	else
@@ -643,7 +651,14 @@ case "$method" in
 		kernel="$kfile"
 		initrd="$ifile"
 		if [ "$dtb_append" = "yes" ]; then
-			dtb="/usr/lib/linux-image-$kvers/$dtb_name"
+			case "$dtb_name" in
+				/*)
+					dtb="$dtb_name"
+				;;
+				*)
+					dtb="/usr/lib/linux-image-$kvers/$dtb_name"
+				;;
+			esac
 			if [ ! -f "$dtb" ]; then
 				error "Couldn't find $dtb"
 			fi
-- 
2.1.1


Reply to: