<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-15"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Kelvie Wong wrote:
<blockquote cite="mid200809250106.45588.kelvie@ieee.org" type="cite">
  <meta name="qrichtext" content="1">
  <style type="text/css">
p, li { white-space: pre-wrap; }</style>
  <p style="margin: 0px; text-indent: 0px;">[root@om-gta02 ~] $
flash_eraseall /dev/mtd3</p>
  <p style="margin: 0px; text-indent: 0px;">Erasing 128 Kibyte @ 7e0000
-- 98 % complete.</p>
  <p style="margin: 0px; text-indent: 0px;">[root@om-gta02 ~] $ cat
uImage.bin &gt; /dev/mtd3</p>
  <p style="margin: 0px; text-indent: 0px;">cat: write error: Invalid
argument</p>
  <br>
</blockquote>
The problem is that the mtd driver will only accept writes with length
equal a multiple of 2048, so the last write operation will always fail
(unless you are very lucky with the size). To get past the problem you
have to pad the uImage file with some extra 0xff.<br>
<br>
You can write a program that does this nicely or you can just do the
following hack:<br>
Run the following command for a while (stop it with ctrl-c) to generate
a file containing only 0xff<br>
  while true ; do echo -n xx | tr 'x' '\377' &gt;&gt; ff.file; done<br>
The size should be at least 2048 bytes, but it does not matter if it is
too big. Then pad the kernel<br>
  cat uImage.bin ff.file &gt; uImagePad.bin<br>
And now you can download the kernel with<br>
  cat uImagePad.bin &gt; /dev/mtd3<br>
You will still get the error message, but it is after the end of the
code so it does not matter.<br>
<br>
Tore<br>
<br>
<br>
</body>
</html>