The current implementation of mtd will not append the backup
file created by sysupgrade to the correct partition, as mtd will append
the data to first jffs2 partition it finds. As the kernel is also
stored on a jffs2 partition (which resides before the overlay
partition), the data will be appended to this partition.
To fix this problem, a new option
-s <number> skip the first n bytes when appending data to the jffs2 partiton, defaults to "0"
is added to mtd.
Signed-off-by: Peter Wagner <tripolar@gmx.at>
SVN-Revision: 38807
default_do_upgrade() {
sync
if [ "$SAVE_CONFIG" -eq 1 ]; then
default_do_upgrade() {
sync
if [ "$SAVE_CONFIG" -eq 1 ]; then
- get_image "$1" | mtd -j "$CONF_TAR" write - "${PART_NAME:-image}"
+ get_image "$1" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}"
else
get_image "$1" | mtd write - "${PART_NAME:-image}"
fi
else
get_image "$1" | mtd write - "${PART_NAME:-image}"
fi
# initialize defaults
RAMFS_COPY_BIN="" # extra programs for temporary ramfs root
RAMFS_COPY_DATA="" # extra data files
# initialize defaults
RAMFS_COPY_BIN="" # extra programs for temporary ramfs root
RAMFS_COPY_DATA="" # extra data files
+export MTD_CONFIG_ARGS=""
export INTERACTIVE=0
export VERBOSE=1
export SAVE_CONFIG=1
export INTERACTIVE=0
export VERBOSE=1
export SAVE_CONFIG=1
int no_erase;
int mtdsize = 0;
int erasesize = 0;
int no_erase;
int mtdsize = 0;
int erasesize = 0;
int mtd_open(const char *mtd, bool block)
{
int mtd_open(const char *mtd, bool block)
{
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
}
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
}
if (part_offset > 0) {
fprintf(stderr, "Seeking on mtd device '%s' to: %u\n", mtd, part_offset);
lseek(fd, part_offset, SEEK_SET);
if (part_offset > 0) {
fprintf(stderr, "Seeking on mtd device '%s' to: %u\n", mtd, part_offset);
lseek(fd, part_offset, SEEK_SET);
+ if (jffs2file && w >= jffs2_skip_bytes) {
if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) {
if (!quiet)
fprintf(stderr, "\b\b\b ");
if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) {
if (!quiet)
fprintf(stderr, "\b\b\b ");
" -e <device> erase <device> before executing the command\n"
" -d <name> directory for jffs2write, defaults to \"tmp\"\n"
" -j <name> integrate <file> into jffs2 data when writing an image\n"
" -e <device> erase <device> before executing the command\n"
" -d <name> directory for jffs2write, defaults to \"tmp\"\n"
" -j <name> integrate <file> into jffs2 data when writing an image\n"
+ " -s <number> skip the first n bytes when appending data to the jffs2 partiton, defaults to \"0\"\n"
" -p write beginning at partition offset\n");
if (mtd_fixtrx) {
fprintf(stderr,
" -p write beginning at partition offset\n");
if (mtd_fixtrx) {
fprintf(stderr,
#ifdef FIS_SUPPORT
"F:"
#endif
#ifdef FIS_SUPPORT
"F:"
#endif
- "frnqe:d:j:p:o:")) != -1)
+ "frnqe:d:s:j:p:o:")) != -1)
switch (ch) {
case 'f':
force = 1;
switch (ch) {
case 'f':
force = 1;
case 'j':
jffs2file = optarg;
break;
case 'j':
jffs2file = optarg;
break;
+ case 's':
+ errno = 0;
+ jffs2_skip_bytes = strtoul(optarg, 0, 0);
+ if (errno) {
+ fprintf(stderr, "-s: illegal numeric string\n");
+ usage();
+ }
+ break;
case 'q':
quiet++;
break;
case 'q':
quiet++;
break;
om2p-lc)
platform_do_upgrade_openmesh "$ARGV"
;;
om2p-lc)
platform_do_upgrade_openmesh "$ARGV"
;;
+ uap-pro)
+ MTD_CONFIG_ARGS="-s 0x180000"
+ default_do_upgrade "$ARGV"
+ ;;
*)
default_do_upgrade "$ARGV"
;;
*)
default_do_upgrade "$ARGV"
;;