Wrong partition table

Hello,

I have prepared an auto-configuration scritp that allows to create all the partitions needed on my Digi Connect ME 9210:


Nr | Name   |  Start     | Size       | Type         | FS       | Flags
-----------------------------------------------------------------------
 0 | U-Boot |          0 |    192 KiB | U-Boot       |          | fixed
 1 | NVRAM  |    192 KiB |    128 KiB | NVRAM        |          | fixed
 2 | Kernel |    320 KiB |   1152 KiB | Linux-Kernel |          |
 3 | RootFS |   1472 KiB |      1 MiB | Filesystem   | SQUASHFS | rootfs
 4 | UserFS |   2496 KiB |   1600 KiB | Filesystem   | JFFS2    |

My scritp assumes that by default the system is configured only with U-Boot and NVRAM partitions and it works properly.

Recently we have received devices with a different default partition table:


Nr | Name   |  Start     | Size       | Type         | FS       | Flags
-----------------------------------------------------------------------
 0 | U-Boot |          0 |    192 KiB | U-Boot       |          | fixed
 1 | NVRAM  |    192 KiB |    128 KiB | NVRAM        |          | fixed
 2 | Kernel |    320 KiB |   1280 KiB | Linux-Kernel |          |
 3 | RootFS |   1600 KiB |   1536 KiB | Filesystem   | SQUASHFS | rootfs
 4 | UserFS |   3136 KiB |    960 KiB | Filesystem   | JFFS2    |

Therefore, after the execution of my script the result is:


Nr | Name   |  Start     | Size       | Type         | FS       | Flags
-----------------------------------------------------------------------
 0 | U-Boot |          0 |    192 KiB | U-Boot       |          | fixed
 1 | NVRAM  |    192 KiB |    128 KiB | NVRAM        |          | fixed
 2 | Kernel |    320 KiB |   1280 KiB | Linux-Kernel |          |
 3 | RootFS |   1600 KiB |   1536 KiB | Filesystem   | SQUASHFS | rootfs
 4 | UserFS |   3136 KiB |    960 KiB | Filesystem   | JFFS2    |
 5 | Kernel |    320 KiB |   1152 KiB | Linux-Kernel |          |
 6 | RootFS |   1472 KiB |      1 MiB | Filesystem   | SQUASHFS | rootfs
 7 | UserFS |   2496 KiB |   1600 KiB | Filesystem   | JFFS2    |

There are two Linux-Kernel partitions, 2 SQUASHFS partitions and 2 JFFS2 partitions.
In this situation, my application loaded in JFFS2 partition, seems to work the same. Could it be possible?
What can be happen with a wrong partition table as the last described?
How can modify the auto-configuration script in order to detect and delete all unwanted partition at the beginning?

Below the scritp:

intnvram set partition add name=Kernel chip=0 start=0x50000 size=0x120000 type=Linux-Kernel flag_fixed=0 flag_readonly=0
intnvram set partition add name=RootFS chip=0 start=0x170000 size=0x100000 type=Filesystem flag_fixed=0 flag_readonly=0 flag_fs_type=SQUASHFS flag_fs_root=1 flag_fs_mount_readonly=0
intnvram set partition add name=UserFS chip=0 start=0x270000 size=0x190000 type=Filesystem flag_fixed=0 flag_readonly=0 flag_fs_type=JFFS2 flag_fs_root=0 flag_fs_mount_readonly=0
erase_pt UserFS
setenv loadbootsc no
update linux
update rootfs
update userfs tftp userfs.jffs2
setenv bootcmd dboot linux flash
setenv start_app /tmp/mnt/UserFS/boot.sh
setenv console console=none
setenv dhcp on
saveenv
reset

Thanks in advance,
Paolo

Refer http://www.digi.com/support/kbase/kbaseresultdetl?id=3173