[HD Mini Android Development] munjeni:
I modified lk bootloader:

board_htcphoton.c:

#define HTCPHOTON_RESERVED_SECTORS 0
#define HTCPHOTON_FLASH_SIZE 0x1000

#define HTCPHOTON_FLASH_OFFSET (HTCPHOTON_RESERVED_SECTORS)

#define HTCPHOTON_FLASH_JTAG_START 0
#define HTCPHOTON_FLASH_JTAG_SIZE 321

#define HTCPHOTON_FLASH_LK_START 321
#define HTCPHOTON_FLASH_LK_SIZE 1

#define HTCPHOTON_FLASH_BOOT_START (HTCPHOTON_FLASH_LK_START + \
HTCPHOTON_FLASH_LK_SIZE)
#define HTCPHOTON_FLASH_BOOT_SIZE 0x40

#define HTCPHOTON_FLASH_RECOVERY_START (HTCPHOTON_FLASH_BOOT_START + \
HTCPHOTON_FLASH_BOOT_SIZE)
#define HTCPHOTON_FLASH_RECOVERY_SIZE 0x40

#define HTCPHOTON_FLASH_MISC_START (HTCPHOTON_FLASH_RECOVERY_START + \
HTCPHOTON_FLASH_RECOVERY_SIZE)
#define HTCPHOTON_FLASH_MISC_SIZE 5

#define HTCPHOTON_FLASH_SYS_START (HTCPHOTON_FLASH_MISC_START + \
HTCPHOTON_FLASH_MISC_SIZE)
#define HTCPHOTON_FLASH_SYS_SIZE 0x834

#define HTCPHOTON_FLASH_DATA_START (HTCPHOTON_FLASH_SYS_START + \
HTCPHOTON_FLASH_SYS_SIZE)
#define HTCPHOTON_FLASH_DATA_SIZE 0x5d5

#define HTCPHOTON_FLASH_CACHE_SIZE 0x27
#define HTCPHOTON_FLASH_CACHE_START (HTCPHOTON_FLASH_SIZE - \
(HTCPHOTON_FLASH_OFFSET + HTCPHOTON_FLASH_CACHE_SIZE))

#if HTCPHOTON_FLASH_CACHE_START < HTCPHOTON_FLASH_OFFSET
#error Cache partition starts in protected zone
#endif

#if (HTCPHOTON_FLASH_DATA_START + HTCPHOTON_FLASH_DATA_SIZE) \
> HTCPHOTON_FLASH_CACHE_START
#error Incorrect flash layout. Verify partition sizes manually
#endif

static struct ptable flash_ptable;
static struct ptentry htcphoton_part_list[] = {
{
.start = HTCPHOTON_FLASH_JTAG_START,
.length = HTCPHOTON_FLASH_JTAG_SIZE,
.name = "jtag",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_LK_START,
.length = HTCPHOTON_FLASH_LK_SIZE,
.name = "lkbootloader",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_BOOT_START,
.length = HTCPHOTON_FLASH_BOOT_SIZE,
.name = "boot",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_RECOVERY_START,
.length = HTCPHOTON_FLASH_RECOVERY_SIZE,
.name = "recovery",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_MISC_START,
.length = HTCPHOTON_FLASH_MISC_SIZE,
.name = "misc",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_SYS_START,
.length = HTCPHOTON_FLASH_SYS_SIZE,
.name = "system",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_DATA_START,
.length = HTCPHOTON_FLASH_DATA_SIZE,
.name = "userdata",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
{
.start = HTCPHOTON_FLASH_CACHE_START,
.length = HTCPHOTON_FLASH_CACHE_SIZE,
.name = "cache",
.type = TYPE_APPS_PARTITION,
.perm = PERM_WRITEABLE,
},
};

static void htcphoton_nand_init(void) {
struct flash_info *flash_info;
int nparts = ARRAY_SIZE(htcphoton_part_list);
unsigned offset = HTCPHOTON_FLASH_OFFSET;
ptable_init(&flash_ptable);
flash_init();
flash_info = flash_get_info();
if (!flash_info) {
dprintf(CRITICAL, "%s: error initializing flash");
return;
}

for (int i = 0; i < nparts; i++) {
struct ptentry *ptn = &htcphoton_part_list[i];
unsigned len = ptn->length;

if ((len == 0) && (i == nparts - 1)) {
len = flash_info->num_blocks - offset - ptn->start;
}
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
len, ptn->flags, ptn->type, ptn->perm);
}

flash_set_ptable(&flash_ptable);
}

tinboot.S:

ldr r0,smi_mpu_addr @disable MPU to allow us to copy the bootloader
mov r1, #0
str r1, [r0]

ldr r0,nand_mpu_addr @disable nand MPU
mov r1, #0
str r1, [r0]
smi_mpu_addr:
.word 0xa8250800
nand_mpu_addr:
.word 0xa0b00000

I can erase jtag partition without any displayed error, but when rebot device is not bricked so it mean I can not erased offset from 0 to 0x2820000 !!! When I try to write I got error "out of space" :confused: