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

2014-11-04 Thread Ian Campbell
On Mon, 2014-11-03 at 19:10 +0100, Cyril Brulebois wrote:
 Ian Campbell i...@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 /*?

Indeed, that would be best I think.

Ian.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2014-11-04 Thread Uwe Kleine-König
tag 767744 + patch
quit

Hello,

On 11/03/2014 07:10 PM, Cyril Brulebois wrote:
 Ian Campbell i...@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?= u...@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 u...@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



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

2014-11-03 Thread Ian Campbell
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.

Another possibility would be to search /etc/flash-kernel/dtbs (perhaps
with and without $kvers) before /usr/lib/blah.

I suppose you are needing to use flash-kernel's dtb appending mode,
otherwise you could just drop the file in /boot.

Ian.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2014-11-03 Thread Cyril Brulebois
Ian Campbell i...@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 /*?

Mraw,
KiBi.


signature.asc
Description: Digital signature


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

2014-11-02 Thread Uwe Kleine-König
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?

Best regards
Uwe

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: armhf (armv7l)

Kernel: Linux 3.16-3-armmp (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages flash-kernel depends on:
ii  debconf [debconf-2.0]  1.5.53
ii  devio  1.2-1
ii  initramfs-tools0.116
ii  linux-base 3.5
ii  ucf3.0030

flash-kernel recommends no packages.

Versions of packages flash-kernel suggests:
ii  u-boot-tools  2014.10~rc3+dfsg1-1

-- debconf information excluded


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org