fiasco: Document and show partition info block
Partition info block is available only for kernel image in RX-44 and RX-48 fiasco images.
This commit is contained in:
1 parent
255333f503
commit
b67949fb5d
2 files changed
+44
-1
No files matched your search
+11
-1
@@ -66,7 +66,17 @@ FILE DATA BLOCK
|
|||||||
|
|
||||||
PARTITION INFO BLOCK
|
PARTITION INFO BLOCK
|
||||||
|
|
||||||
N bytes -- unknown
|
1 byte -- asic index (always APE - 0x01)
|
||||||
|
1 byte -- device type (always NAND - 0x01)
|
||||||
|
1 byte -- device index (always 0x00)
|
||||||
|
4 bytes -- partition version (always 0x00 0x00 0x00 0x00)
|
||||||
|
4 bytes -- spare (always 0xFF 0xFF 0xFF 0xFF)
|
||||||
|
4 bytes -- number of partition blocks (big endian)
|
||||||
|
block {
|
||||||
|
1 byte -- partition type (0x03 - kernel, 0x04 - initfs, 0x05 - rootfs)
|
||||||
|
1 byte -- partition attribute (0x01 - read/write, 0x02 - read-only)
|
||||||
|
4 bytes -- partition size (big endian, 0 - remaining space)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IMAGE DATA PART BLOCK
|
IMAGE DATA PART BLOCK
|
||||||
|
|||||||
@@ -272,6 +272,39 @@ struct fiasco * fiasco_alloc_from_file(const char * file) {
|
|||||||
if ( image_part->name )
|
if ( image_part->name )
|
||||||
VERBOSE(" partition name: %s\n", image_part->name);
|
VERBOSE(" partition name: %s\n", image_part->name);
|
||||||
}
|
}
|
||||||
|
} else if ( byte == 0x2F ) {
|
||||||
|
VERBOSE("partition info\n");
|
||||||
|
if ( length8 < 15 ) {
|
||||||
|
VERBOSE(" (damaged)\n");
|
||||||
|
} else {
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int part_type;
|
||||||
|
unsigned int part_attr;
|
||||||
|
unsigned int part_size;
|
||||||
|
unsigned int num_parts = ((unsigned)buf[11] << 24) | ((unsigned)buf[12] << 16) | ((unsigned)buf[13] << 8) | ((unsigned)buf[14] << 0);
|
||||||
|
VERBOSE(" asic idx: %d\n", buf[0]);
|
||||||
|
VERBOSE(" device type: %d\n", buf[1]);
|
||||||
|
VERBOSE(" device idx: %d\n", buf[2]);
|
||||||
|
VERBOSE(" version: 0x%02x%02x%02x%02x\n", buf[3], buf[4], buf[5], buf[6]);
|
||||||
|
VERBOSE(" spare: 0x%02x%02x%02x%02x\n", buf[7], buf[8], buf[9], buf[10]);
|
||||||
|
VERBOSE(" partitions: %d\n", num_parts);
|
||||||
|
for ( i = 0; i < num_parts; i++ ) {
|
||||||
|
VERBOSE(" partition\n");
|
||||||
|
if ( 20 + i*6 >= length8 ) {
|
||||||
|
VERBOSE(" (damaged)\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
part_type = buf[15 + i*6];
|
||||||
|
part_attr = buf[16 + i*6];
|
||||||
|
part_size = ((unsigned)buf[17 + i*6] << 24) | ((unsigned)buf[18 + i*6] << 16) | ((unsigned)buf[19 + i*6] << 8) | ((unsigned)buf[20 + i*6] << 0);
|
||||||
|
VERBOSE(" type: 0x%02x (%s)\n", part_type, part_type == 0x03 ? "kernel" : part_type == 0x04 ? "initfs" : part_type == 0x05 ? "rootfs" : "unknown");
|
||||||
|
VERBOSE(" attribute: 0x%02x (%s)\n", part_attr, part_attr == 0x1 ? "read/write" : part_attr == 0x2 ? "read-only" : "unknown");
|
||||||
|
if ( part_size == 0 )
|
||||||
|
VERBOSE(" size: remaining space\n");
|
||||||
|
else
|
||||||
|
VERBOSE(" size: %u bytes\n", part_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
VERBOSE("unknown (%#x)\n", byte);
|
VERBOSE("unknown (%#x)\n", byte);
|
||||||
|
|||||||
Reference in new issue
Block a user