pengutronix / genimage

tool to generate multiple filesystem and flash images from a tree
GNU General Public License v2.0
305 stars 110 forks source link

Extended partition size? #177

Closed mirschkyn closed 2 years ago

mirschkyn commented 2 years ago

Created a hdimage with genimage. The extended partition seems to occupy a physical sector, by starting the next partition at sector + 1 (fdisk output). I can't find any information regarding this.

/dev/loop33p4 16384 16384004 16367621 7,8G f W95 Ext'd (LBA) /dev/loop33p5 16385 540672 524288 256M da Non-FS data

edit: The question is partly about the alignment post EBR in relation to the EBR size.

michaelolbrich commented 2 years ago

That sector is the EBR (https://en.wikipedia.org/wiki/Extended_boot_record). It's the first sector in the extended partition so the logical partition will start at least on sector after the extended partition. The offset may be larger depending on the alignment of the partition. Each partition has its align property. If that's not set, then the align from the hdimage section is used.

mirschkyn commented 2 years ago

Ok. But it looks strange. More like an offset than an alignment?

/dev/loop33p4 16384 15859708 15843325 7,6G f W95 Ext'd (LBA) /dev/loop33p5 16385 540672 524288 256M da Non-FS data /dev/loop33p6 540674 1064961 524288 256M da Non-FS data /dev/loop33p7 1064963 1589250 524288 256M da Non-FS data

Here. p4 is at 16384, occupies 1. p5 starts at +1 p6 starts at +2, even. p7 starts at +2, uneven, despite sizes being even.

I have no explicit alignment anywhere in the config to genimage. So expected behavior would be align to something even, and if not aligning, then not add 2? But rather step to the next sector? Am I reading this wrong?

michaelolbrich commented 2 years ago

Your reading this wrong: 540672 is the last sector of p5, 540673 is the EBR and 540674 is the first sector of p6. So there is no gap. The default alignment is on sector.

milkylainen commented 2 years ago

Ah. Yes, the EBR is a linked list, with an entry in front of every logical partition, right? That explains the sectors. Thanks for filling in the gaps!