-#if RDC3210_FACTORY_DFLT
- /* 1. Adjust Redboot */
- tmp = flashdrv_get_size() - rdc3210_parts[4].size;
- rdc3210_parts[4].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));
- rdc3210_parts[4].size = flashdrv_get_size() - rdc3210_parts[4].offset;
-
- /* 2. Adjust NVRAM */
- tmp -= rdc3210_parts[3].size;
- rdc3210_parts[3].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));
- rdc3210_parts[3].size = rdc3210_parts[4].offset - rdc3210_parts[3].offset;
-
- /* 3. Adjust Factory Default */
- tmp -= rdc3210_parts[2].size;
- rdc3210_parts[2].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));
- rdc3210_parts[2].size = rdc3210_parts[3].offset - rdc3210_parts[2].offset;
-
- /* 4. Adjust Linux (Kernel + ROMFS) */
- rdc3210_parts[0].size = rdc3210_parts[2].offset - rdc3210_parts[0].offset;
-
- /* 5. Adjust ROMFS */
- tmp = hdr->kernelsz + sizeof(gt_imghdr_t);
- rdc3210_parts[1].offset = rdc3210_parts[0].offset + (((tmp / tmp2) + ((tmp % tmp2) ? 1 : 0)) * tmp2);
- rdc3210_parts[1].size = rdc3210_parts[2].offset - rdc3210_parts[1].offset;
-#else
- /* 1. Adjust Redboot */
- tmp = flashdrv_get_size() - rdc3210_parts[3].size;
- rdc3210_parts[3].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));
- rdc3210_parts[3].size = flashdrv_get_size() - rdc3210_parts[3].offset;
-
- /* 2. Adjust NVRAM */
- tmp -= rdc3210_parts[2].size;
- rdc3210_parts[2].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));
- rdc3210_parts[2].size = rdc3210_parts[3].offset - rdc3210_parts[2].offset;
-
- /* 4. Adjust Linux (Kernel + ROMFS) */
- rdc3210_parts[0].size = rdc3210_parts[2].offset - rdc3210_parts[0].offset;
-
- /* 5. Adjust ROMFS */
- tmp = hdr->kernelsz + sizeof(gt_imghdr_t);
- rdc3210_parts[1].offset = rdc3210_parts[0].offset + (((tmp / tmp2) + ((tmp % tmp2) ? 1 : 0)) * tmp2);
- rdc3210_parts[1].size = rdc3210_parts[2].offset - rdc3210_parts[1].offset;
-#endif
-
- rdc3210_mtd->module = THIS_MODULE;
- add_mtd_partitions(rdc3210_mtd, rdc3210_parts, sizeof(rdc3210_parts)/sizeof(rdc3210_parts[0]));