++ p++;
++ } while (p < MAX_NUM_PARTITIONS);
++
++ p = 0;
++
++ ar7_partinfo[p].name = strdup("adam2");
++ ar7_partinfo[p].offset = 0;
++ ar7_partinfo[p].size = adam2_size;
++ ar7_partinfo[p++].mask_flags = 0;
++
++ ar7_partinfo[p].name = strdup("linux");
++ ar7_partinfo[p].offset = adam2_size;
++ ar7_partinfo[p].size = config_offset - adam2_size;
++ ar7_partinfo[p++].mask_flags = 0;
++
++ for (offset = adam2_size; !found && (offset < rootfs_start); offset += 1024) {
++ if (ar7_read32(&ar7_map, offset) == TRX_MAGIC) {
++ found = 1;
++ rootfs_start = offset;
++ }
++ }
++
++ ar7_partinfo[p].name = strdup("rootfs");
++ ar7_partinfo[p].offset = rootfs_start;
++ ar7_partinfo[p].size = config_offset - rootfs_start;
++
++ ar7_copy_from(&ar7_map, &hdr, rootfs_start, sizeof(hdr));
++ if (hdr.magic == TRX_MAGIC) {
++ printk("TRX header in rootfs partition detected.\n");
++ printk("offset[0] = 0x%05x\n", hdr.offsets[0]);
++ printk("offset[1] = 0x%05x\n", hdr.offsets[1]);
++ printk("offset[2] = 0x%05x\n", hdr.offsets[2]);
++ ar7_partinfo[p].offset += hdr.offsets[0];
++ ar7_partinfo[p].size -= hdr.offsets[0];
++ }
++
++ ar7_partinfo[p++].mask_flags = 0;
++
++ ar7_partinfo[p].name = strdup("config");
++ ar7_partinfo[p].offset = config_offset;
++ ar7_partinfo[p].size = WINDOW_SIZE - config_offset;
++ ar7_partinfo[p++].mask_flags = 0;
++
++ if (ar7_read32(&ar7_map, rootfs_start + hdr.offsets[0]) == 0x73717368) {
++ int newsize;
++
++ printk("Squashfs detected. Adding extra partition\n");
++ newsize = hdr.len;
++ if (newsize % ar7_mtd_info->erasesize)
++ newsize += ar7_mtd_info->erasesize - ((newsize + hdr.offsets[0]) % ar7_mtd_info->erasesize);
++