Bug#413373: Patch for flash-kernel to improve speed
Op 04-03-2007 om 08:33 schreef Gordon Farquharson:
> --- flash-kernel.orig 2007-03-03 11:42:45.000000000 -0700
> +++ flash-kernel 2007-03-03 13:30:35.000000000 -0700
> @@ -131,10 +131,9 @@
> size=$(grep "Ramdisk" /proc/mtd | cut -d " " -f 2)
> size=$(printf "%d" 0x$size)
> isize=$(wc -c $ifile | awk '{print $1}')
> - cat $ifile > $tmp
unconditional overwrite of $tmp with $ifile is removed
> pad=$(expr $size - $isize - 16)
caculate the remainder
> if [ "$pad" -gt 0 ]; then
when there are padding bytes and only when there are padding bytes
> - dd if=/dev/zero bs=$pad count=1 2>/dev/null >> $tmp
the old append padding bytes instruction being removed
> + dd if=$ifile of=$tmp ibs=4M conv=sync 2>/dev/null
overwrite $tmp with the first four megabyte of $ifile
> fi
> (
> sercomm_header $isize
My gut feeling[1] says it should be
--- flash-kernel.orig 2007-03-03 11:42:45.000000000 -0700
+++ flash-kernel 2007-03-03 13:30:35.000000000 -0700
@@ -131,10 +131,6 @@
size=$(grep "Ramdisk" /proc/mtd | cut -d " " -f 2)
size=$(printf "%d" 0x$size)
isize=$(wc -c $ifile | awk '{print $1}')
- cat $ifile > $tmp
- pad=$(expr $size - $isize - 16)
- if [ "$pad" -gt 0 ]; then
- dd if=/dev/zero bs=$pad count=1 2>/dev/null >> $tmp
- fi
+ dd if=$ifile of=$tmp ibs=4M conv=sync 2>/dev/null
(
sercomm_header $isize
So $tmp is unconditional overwritten with $ifile
Actual is $tmp unconditional overwritten with the first 4Mb of $ifile,
but I have no clue to what the 4M corresponds.
Something else:
"isize" is not used in the proposed
+ dd if=$ifile of=$tmp ibs=4M conv=sync 2>/dev/null
not calculating $isize will also speed up flashing the kernel.
Cheers
Geert Stappers
[1] the patch is not tested.
Reply to: