|
|
@ -27,7 +27,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
|
|
|
|
|
|
|
|
--- a/tools/env/fw_env.c
|
|
|
|
--- a/tools/env/fw_env.c
|
|
|
|
+++ b/tools/env/fw_env.c
|
|
|
|
+++ b/tools/env/fw_env.c
|
|
|
|
@@ -30,6 +30,9 @@
|
|
|
|
@@ -31,6 +31,9 @@
|
|
|
|
# include <mtd/mtd-user.h>
|
|
|
|
# include <mtd/mtd-user.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
#include "fw_env.h"
|
|
|
|
#include "fw_env.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <aes.h>
|
|
|
|
#include <aes.h>
|
|
|
|
@@ -810,6 +813,11 @@ static int flash_write_buf (int dev, int
|
|
|
|
@@ -811,6 +814,11 @@ static int flash_write_buf (int dev, int
|
|
|
|
off_t top_of_range; /* end of the last block we may use */
|
|
|
|
off_t top_of_range; /* end of the last block we may use */
|
|
|
|
loff_t blockstart; /* running start of the current block -
|
|
|
|
loff_t blockstart; /* running start of the current block -
|
|
|
|
MEMGETBADBLOCK needs 64 bits */
|
|
|
|
MEMGETBADBLOCK needs 64 bits */
|
|
|
@ -49,7 +49,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
int rc;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@@ -915,7 +923,30 @@ static int flash_write_buf (int dev, int
|
|
|
|
@@ -916,7 +924,30 @@ static int flash_write_buf (int dev, int
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -81,7 +81,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
erase.start = blockstart;
|
|
|
|
erase.start = blockstart;
|
|
|
|
ioctl(fd, MEMUNLOCK, &erase);
|
|
|
|
ioctl(fd, MEMUNLOCK, &erase);
|
|
|
|
/* These do not need an explicit erase cycle */
|
|
|
|
/* These do not need an explicit erase cycle */
|
|
|
|
@@ -932,7 +963,8 @@ static int flash_write_buf (int dev, int
|
|
|
|
@@ -933,7 +964,8 @@ static int flash_write_buf (int dev, int
|
|
|
|
fprintf (stderr,
|
|
|
|
fprintf (stderr,
|
|
|
|
"Seek error on %s: %s\n",
|
|
|
|
"Seek error on %s: %s\n",
|
|
|
|
DEVNAME (dev), strerror (errno));
|
|
|
|
DEVNAME (dev), strerror (errno));
|
|
|
@ -91,7 +91,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
#ifdef DEBUG
|
|
|
|
@@ -942,10 +974,11 @@ static int flash_write_buf (int dev, int
|
|
|
|
@@ -943,10 +975,11 @@ static int flash_write_buf (int dev, int
|
|
|
|
if (write (fd, data + processed, erasesize) != erasesize) {
|
|
|
|
if (write (fd, data + processed, erasesize) != erasesize) {
|
|
|
|
fprintf (stderr, "Write error on %s: %s\n",
|
|
|
|
fprintf (stderr, "Write error on %s: %s\n",
|
|
|
|
DEVNAME (dev), strerror (errno));
|
|
|
|
DEVNAME (dev), strerror (errno));
|
|
|
@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
ioctl(fd, MEMLOCK, &erase);
|
|
|
|
ioctl(fd, MEMLOCK, &erase);
|
|
|
|
|
|
|
|
|
|
|
|
processed += erasesize;
|
|
|
|
processed += erasesize;
|
|
|
|
@@ -956,6 +989,11 @@ static int flash_write_buf (int dev, int
|
|
|
|
@@ -957,6 +990,11 @@ static int flash_write_buf (int dev, int
|
|
|
|
if (write_total > count)
|
|
|
|
if (write_total > count)
|
|
|
|
free (data);
|
|
|
|
free (data);
|
|
|
|
|
|
|
|
|
|
|
@ -117,7 +117,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
return processed;
|
|
|
|
return processed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1067,12 +1105,8 @@ static int flash_read (int fd)
|
|
|
|
@@ -1068,12 +1106,8 @@ static int flash_read (int fd)
|
|
|
|
|
|
|
|
|
|
|
|
if (S_ISCHR(st.st_mode)) {
|
|
|
|
if (S_ISCHR(st.st_mode)) {
|
|
|
|
rc = ioctl(fd, MEMGETINFO, &mtdinfo);
|
|
|
|
rc = ioctl(fd, MEMGETINFO, &mtdinfo);
|
|
|
@ -132,7 +132,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
|
|
|
mtdinfo.type != MTD_NANDFLASH &&
|
|
|
|
mtdinfo.type != MTD_NANDFLASH &&
|
|
|
|
mtdinfo.type != MTD_DATAFLASH &&
|
|
|
|
mtdinfo.type != MTD_DATAFLASH &&
|
|
|
|
mtdinfo.type != MTD_UBIVOLUME) {
|
|
|
|
mtdinfo.type != MTD_UBIVOLUME) {
|
|
|
|
@@ -1080,6 +1114,28 @@ static int flash_read (int fd)
|
|
|
|
@@ -1081,6 +1115,28 @@ static int flash_read (int fd)
|
|
|
|
mtdinfo.type, DEVNAME(dev_current));
|
|
|
|
mtdinfo.type, DEVNAME(dev_current));
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|