1

My question is related to this other one but not a duplicate, so please try to understand before marking as duplicate. I am not able to comment on this other one.

In this other one, I understand the answer and agree with it. However, I have to use DOS MBR and not GPT, because of a limitation in the i.MX6UL processor. How can I align my logical partitions in the extended partition to 8 MiB?

Some detailed example with numbers would be much appreciated. I have the following partitioning scheme on a 16 GiB eMMC:

p1 primary 128 MiB
p2 primary 128 MiB
p3 primary  16 MiB
p4 extended
p5 logical 256 MiB
p6 logical 256 MiB
p7 logical 256 MiB
p8 logical whatever remains

I need to skip the first 4 MiB for U-Boot. To align to 8 MiB, I can start my first primary partition p1 at offset 8 MiB or block number 16,384. The calculation is straight forward for p1, p2, and p3.

However, given that the extended partition contains one EBR before every logical partition, I don't know how to take that into account. The EBR size is 512 bytes, however, https://en.wikipedia.org/wiki/Extended_boot_record says that logical partitions are aligned at 1-MiB boundary.

Here is what I have so far, but I would appreciate if someone can verify and explain if this is correct or not:

Partition    Start Block     End Block   Partition Type
---------    -----------     ---------   --------------
1                 16,384       278,527   primary
2                278,528       540,671   primary
3                540,672       573,439   primary
4                573,440    29,884,415   extended
5                589,824     1,114,111   logical
6              1,114,112     1,638,399   logical
7              1,638,400     2,146,303   logical
8              2,146,304    29,884,415   logical
  • Or you can create a boot + a big LVM and handle this in LVM instead of logical partitions – A.B Mar 21 '18 at 18:08
  • Why do you need to use DOS partitions and not GPT? You can create a gap between the GPT header an the partition table. This way the GPT only reserves two 512 byte biocks at the start: the MBR and the GPT header. Granted, this is one more than with just an MBR, but maybe you can live with this? – Johan Myréen Mar 21 '18 at 20:42
  • @A.B This is for an embedded system. We can't use LVM. – Craftonix - AA Mar 26 '18 at 14:12
  • @JohanMyréen As I already mentioned, the i.MX6UL has a limitation which prevents us from using GPT. I already tried. It expects the SPL and U-Boot to be at a fixed location in the memory map of the eMMC block device. This location conflicts with the GPT location. I don't understand what you mean by create a gap between the GPT header and the partition table; I already have an 8 MiB gap. Is this what you are referring to? – Craftonix - AA Mar 26 '18 at 14:13
0

I recommend using GPT instead of MBR partitions after all. GPT partitions are much simpler to deal with (no extended/logical mess), and you can work around the restriction imposed by the i.MX6UL boot ROM. The Reference Manual (IMX6ULRM) states in Table 8.25 that the Image Vector Table is read from offset 1024 on eMMCs. This is just the right amount to hold the MBR and the GPT header before the IVT. Normally, the partition entry table follows the GPT Header starting at LBA 2, but it can be moved by setting the field "Starting LBA of array of partition entries" (offset 72) in the header. This way you can free up as much space for the image as you need between the GPT Header and the partition entry table. To create a GPT with a relocated partition entry table, you can use sgdisk (use the -j option).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.