Page MenuHomeFreeBSD

release: make SD card partition layout more flexible
ClosedPublic

Authored by mhorne on Feb 12 2024, 5:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 9:40 PM
Unknown Object (File)
Sun, Nov 10, 9:40 PM
Unknown Object (File)
Sun, Nov 10, 1:23 AM
Unknown Object (File)
Sun, Nov 10, 12:43 AM
Unknown Object (File)
Apr 15 2024, 5:54 PM
Unknown Object (File)
Apr 11 2024, 7:51 PM
Unknown Object (File)
Apr 8 2024, 10:34 PM
Unknown Object (File)
Apr 6 2024, 12:18 AM
Subscribers

Details

Summary

Currently the partition layout is hardcoded to create an EFI/FAT
partition and a UFS root partition, with some logic to handle GPT/MBR
differences.

On RISC-V platforms we are seeing the emerging pattern that firmware
should be placed in a partition of a known type, rather than just a
known sector of the disk. Thus, some functionality is needed to
customize the layout for SD card images.

Add a hook, arm_create_partitions(), which can be overridden to insert
additional platform-specific partitions, possibly preceding the standard
EFI and UFS ones. A couple of new variables are added to track the
indices, e.g. ROOTFSPART_SUFFIX=p2.

In a couple places this de-duplicates the GPT/MBR logic.

Test Plan

SD card images built with these patches generate the expected partition layouts:

arm64/ROCKPRO64.conf:

$ gpart show md0
=>      40  10485680  md0  GPT  (5.0G)
        40     32728       - free -  (16M)
     32768    102400    1  efi  (50M)
    135168  10350464    2  freebsd-ufs  (4.9G)
  10485632        88       - free -  (44K)

arm64/RPI.conf:

$ gpart show md1
=>      63  10485697  md1  MBR  (5.0G)
        63      1985       - free -  (993K)
      2048    102400    1  fat32lba  [active]  (50M)
    104448  10381312    2  freebsd  (5.0G)

riscv/GENERICSD.conf (with D43849 applied):

$ gpart show md2
=>      40  12582832  md2  GPT  (6.0G)
        40      4056       - free -  (2.0M)
      4096      4096    1  hifive-fsbl  (2.0M)
      8192      8192    2  hifive-bbl  (4.0M)
     16384    110592    3  efi  (54M)
    126976  12455808    4  freebsd-ufs  (5.9G)
  12582784        88       - free -  (44K)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable