Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2015-01-02 Thread Uwe Kleine-König

Hello Ian,


Uwe, any chance you could try this please:

diff --git a/functions b/functions
index d45a4e6..a7ff6de 100644
--- a/functions
+++ b/functions
@@ -41,7 +41,11 @@ error() {
  mtdblock() {
local mtdname=$1

-   sed -rn s,^mtd([^:]*).*\$mtdname\\$,/dev/mtdblock\\1,p $PROC_MTD
+   local dev=`sed -rn s,^mtd([^:]*).*\$mtdname\\$,/dev/mtdblock\\1,p 
$PROC_MTD`
+
+   modprobe -q mtdblock  udevadm settle --exit-if-exists=$dev || :
+
+   echo $dev
I would have added the modprobe call only if the device doesn't exist, 
but I guess that's only cosmetic.


I just installed flash-kernel 3.30 and as expected this one works fine.

Sorry I didn't come around to test this earlier, I was AFK most of the 
time around Christmas/new year. Thanks for your work on this bug.


Best regards
Uwe


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



Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2015-01-02 Thread Ian Campbell
On Fri, 2015-01-02 at 11:09 +0100, Uwe Kleine-König wrote:
 Hello Ian,
 
  Uwe, any chance you could try this please:
 
  diff --git a/functions b/functions
  index d45a4e6..a7ff6de 100644
  --- a/functions
  +++ b/functions
  @@ -41,7 +41,11 @@ error() {
mtdblock() {
  local mtdname=$1
 
  -   sed -rn s,^mtd([^:]*).*\$mtdname\\$,/dev/mtdblock\\1,p $PROC_MTD
  +   local dev=`sed -rn s,^mtd([^:]*).*\$mtdname\\$,/dev/mtdblock\\1,p 
  $PROC_MTD`
  +
  +   modprobe -q mtdblock  udevadm settle --exit-if-exists=$dev || :
  +
  +   echo $dev
 I would have added the modprobe call only if the device doesn't exist, 
 but I guess that's only cosmetic.

modprobe will silently do nothing if the module is already loaded or is
builtin so not checking is fine plus is simpler. There's also a benign
TOCTOU race with checking for the device first (from something else
modprobing in parallel).

 I just installed flash-kernel 3.30 and as expected this one works fine.

Thanks.

 Sorry I didn't come around to test this earlier, I was AFK most of the 
 time around Christmas/new year. Thanks for your work on this bug.

No problem.

Ian.


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



Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2014-12-29 Thread Ian Campbell
On Fri, 2014-12-26 at 20:30 +0100, Uwe Kleine-König wrote:
 I wonder if flash-kernel should be smart enough to
 load the module itself.

I think it should.

I think all which is needed is to add modprobe -q mtdblock into the
mtdblock function. I believe anything which uses an mtdblock device
passes through that function to translate the name into a device node.

What do you 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#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2014-12-29 Thread Ben Hutchings
On Mon, 2014-12-29 at 13:24 +, Ian Campbell wrote:
 On Fri, 2014-12-26 at 20:30 +0100, Uwe Kleine-König wrote:
  I wonder if flash-kernel should be smart enough to
  load the module itself.
 
 I think it should.
 
 I think all which is needed is to add modprobe -q mtdblock into the
 mtdblock function. I believe anything which uses an mtdblock device
 passes through that function to translate the name into a device node.
 
 What do you think?

You also need 'udevadm settle' to wait for the device nodes to appear.

Ben.

-- 
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.


signature.asc
Description: This is a digitally signed message part


Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2014-12-29 Thread Ian Campbell
On Mon, 2014-12-29 at 14:50 +0100, Ben Hutchings wrote:
 On Mon, 2014-12-29 at 13:24 +, Ian Campbell wrote:
  On Fri, 2014-12-26 at 20:30 +0100, Uwe Kleine-König wrote:
   I wonder if flash-kernel should be smart enough to
   load the module itself.
  
  I think it should.
  
  I think all which is needed is to add modprobe -q mtdblock into the
  mtdblock function. I believe anything which uses an mtdblock device
  passes through that function to translate the name into a device node.
  
  What do you think?
 
 You also need 'udevadm settle' to wait for the device nodes to appear.

Good point, thanks.

Ian.


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



Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2014-12-29 Thread Ian Campbell
On Mon, 2014-12-29 at 13:58 +, Ian Campbell wrote:
 On Mon, 2014-12-29 at 14:50 +0100, Ben Hutchings wrote:
  On Mon, 2014-12-29 at 13:24 +, Ian Campbell wrote:
   On Fri, 2014-12-26 at 20:30 +0100, Uwe Kleine-König wrote:
I wonder if flash-kernel should be smart enough to
load the module itself.
   
   I think it should.
   
   I think all which is needed is to add modprobe -q mtdblock into the
   mtdblock function. I believe anything which uses an mtdblock device
   passes through that function to translate the name into a device node.
   
   What do you think?
  
  You also need 'udevadm settle' to wait for the device nodes to appear.
 
 Good point, thanks.

Uwe, any chance you could try this please:

diff --git a/functions b/functions
index d45a4e6..a7ff6de 100644
--- a/functions
+++ b/functions
@@ -41,7 +41,11 @@ error() {
 mtdblock() {
local mtdname=$1
 
-   sed -rn s,^mtd([^:]*).*\$mtdname\\$,/dev/mtdblock\\1,p $PROC_MTD
+   local dev=`sed -rn s,^mtd([^:]*).*\$mtdname\\$,/dev/mtdblock\\1,p 
$PROC_MTD`
+
+   modprobe -q mtdblock  udevadm settle --exit-if-exists=$dev || :
+
+   echo $dev
 }
 
 check_block_dev() {


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



Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded

2014-12-26 Thread Uwe Kleine-König
Package: flash-kernel
Version: 3.28
Severity: normal

Hello,

on my ReadyNAS 104 (see database entry included below) a typical run
after a fresh reboot looks as follows:

$ sudo flash-kernel 
Installing armada-370-netgear-rn104.dtb into /boot/dtb-3.16.0-4-armmp
Taking backup of dtb-3.16.0-4-armmp.
Installing new dtb-3.16.0-4-armmp.
flash-kernel: installing version 3.16.0-4-armmp
/dev/mtdblock2 is not a block device

After

$ sudo modprobe mtdblock

it works just fine. I wonder if flash-kernel should be smart enough to
load the module itself.

Best regards
Uwe

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

Kernel: Linux 3.16.0-4-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
Init: systemd (via /run/systemd/system)

Versions of packages flash-kernel depends on:
ii  debconf [debconf-2.0]  1.5.55
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+dfsg1-2

-- Configuration Files:
/etc/flash-kernel/db changed:
Machine: NETGEAR ReadyNAS 104
DTB-Id: armada-370-netgear-rn104.dtb
DTB-Append: yes
Mtd-Kernel: uImage
Mtd-Initrd: minirootfs
U-Boot-Kernel-Address: 0x0400
U-Boot-Initrd-Address: 0x0500
Required-Packages: u-boot-tools


-- 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