Package: flash-kernel
Version: 0.9
Tags: patch

Could you please apply the attached patch to flash-kernel?

It tightens up the grep match patterns (I got stung because I had both
"filesystem" and "filesystem2" partitions), and adds support for
flashing the Iomega NAS 100d.

With this patch, and the kernel patches I sent Martin previously, Debian
kernel 2.6.19 runs nicely on the NAS100d.  Next, I'll be looking at what
else needs to be done to support it in the installer.

This is not etch-critical, but would save me having to hand-edit this
file each time I do a test debian-installer installation.

Thanks,

-- Rod

Index: flash-kernel
===================================================================
--- flash-kernel        (revision 43316)
+++ flash-kernel        (working copy)
@@ -19,7 +19,7 @@
 }
 
 mtdblock() {
-       grep "$1" /proc/mtd | cut -d: -f 1 | sed 's/mtd/\/dev\/mtdblock/'
+       grep "\"$1\"" /proc/mtd | cut -d: -f 1 | sed 's/mtd/\/dev\/mtdblock/'
 }
 
 # See http://www.nslu2-linux.org/wiki/Info/BootFlash -- the NSLU2 uses a
@@ -128,7 +128,7 @@
                ) > "$mtdkernel" || error "failed."
                echo "done." >&2
                printf "Flashing initramfs: " >&2
-               size=$(grep "Ramdisk" /proc/mtd | cut -d " " -f 2)
+               size=$(grep "\"Ramdisk\"" /proc/mtd | cut -d " " -f 2)
                size=$(printf "%d" 0x$size)
                isize=$(wc -c $ifile | awk '{print $1}')
                cat $ifile > $tmp
@@ -143,6 +143,30 @@
                ) > $mtdramdisk || error "failed."
                echo "done." >&2
        ;;
+       "Iomega NAS 100d")
+               check_mtd
+               mtdramdisk=$(mtdblock filesystem)
+               if [ -z "$mtdramdisk" ]; then
+                       error "Cannot find mtd partition 'filesystem'"
+               fi
+               mtdkernel=$(mtdblock kernel)
+               if [ -z "$mtdkernel" ]; then
+                       error "Cannot find mtd partition 'kernel'"
+               fi
+               printf "Flashing kernel: " >&2
+               cat $kfile > "$mtdkernel" || error "failed."
+               echo "done." >&2
+               printf "Flashing initramfs: " >&2
+               size=$(grep "\"filesystem\"" /proc/mtd | cut -d " " -f 2)
+               size=$(printf "%d" 0x$size)
+               isize=$(wc -c $ifile | awk '{print $1}')
+               pad=$(expr $size - $isize)
+               (
+                       cat $ifile
+                       dd if=/dev/zero bs=$pad count=1 2>/dev/null
+               ) > $mtdramdisk || error "failed."
+               echo "done." >&2
+       ;;
        "Thecus N2100")
                check_mtd
                mtdramdisk=$(mtdblock ramdisk)
@@ -160,7 +184,7 @@
                ) > $mtdkernel || error "failed."
                echo "done." >&2
                printf "Flashing initramfs... " >&2
-               size=$(grep "ramdisk" /proc/mtd | cut -d " " -f 2)
+               size=$(grep "\"ramdisk\"" /proc/mtd | cut -d " " -f 2)
                size=$(printf "%d" 0x$size)
                isize=$(wc -c $ifile | awk '{print $1}')
                pad=$(expr $size - $isize)

Reply via email to