Re: Partition layout of ARM SD card images

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 10 Jul 2022 21:55:28 UTC
On 2022-Jul-10, at 14:34, Dr. Rolf Jansen <freebsd-rj@cyclaero.com> wrote:

>> Am 10.07.2022 um 17:48 schrieb Mark Millard <marklmi@yahoo.com>:
>> 
>> On 2022-Jul-10, at 12:26, Dr. Rolf Jansen <freebsd-rj@cyclaero.com> wrote:
>> 
>>> For example let's have a llok on the partition layout of, FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img (the others are similar):
>>> 
>>> # mdconfig -a -u 0 -t vnode -f diskimg/FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img
>>> # gpart show md0 md0s2
>>> 
>>> =>     63  6291393  md0  MBR  (3.0G)
>>>        63     2016       - free -  (1.0M)
>>>      2079   102312    1  fat32lba  [active]  (50M)
>>>    104391  6187041    2  freebsd  (3.0G)
>>>   6291432       24       - free -  (12K)
>>> 
>>> =>      0  6187041  md0s2  BSD  (3.0G)
>>>         0       57         - free -  (29K)
>>>        57  6186880      1  freebsd-ufs  (2.9G)
>>>   6186937      104         - free -  (52K)
>>> 
>>> The start of the fat32 boot slice s1 (containing the u-boot) stuff is neither aligned to 1M nor to 4k, it starts on an odd base. The start of the BSD payload slice s2 and its size are odd as well. The padding of 57 blocks within s2 lets the UFS partition start on a globally even base, namely 104391+57 = 104448, which as a matter of fact is 4k aligned (104448*512/4096 = 13056) and 1M aligned as well (104448*512/1024/1024 = 51), however all this keeps looking strange.
>>> 
>>> Are there reasons for this partition layout besides making it look more interesting? If yes, some insights would be good.
>> 
>> The layout details are more specific to the aarch64 RPi* context
>> than to general aarch64 SD card images. For example, the Rock64
>> image is different:
>> 
>> # mdconfig -a -u 0 -t vnode -f  FreeBSD-14.0-CURRENT-arm64-aarch64-ROCK64-20220708-a0b956f5ac5-256605.img
>> # gpart show md0
>> =>     40  6291376  md0  GPT  (3.0G)
>>      40    32728       - free -  (16M)
>>   32768   102400    1  efi  (50M)
>>  135168  6156160    2  freebsd-ufs  (2.9G)
>> 6291328       88       - free -  (44K)
> 
> This is a GPT table, while the others are still MBR. Images which come with u-boot must have a different layout.

I know it is a GPT table. That is part of the point about
the variety of contexts that there are across the Small
Board Computers.

No SBC that has a U-Boot/whatever needing more space
than is provided below is going to use the same
2079 figure:

=>     63  ???  md0  ???  (?)
       63     2016       - free -  (1.0M)
     2079   ??????    1  fat32lba  [active]  (?)

MBR vs. GPT is not the fundamental issue for that.

===
Mark Millard
marklmi at yahoo.com