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
F82338875: D43848.diff
Sat, Apr 27, 6:57 PM
Unknown Object (File)
Mon, Apr 22, 7:40 PM
Unknown Object (File)
Mon, Apr 22, 3:40 PM
Unknown Object (File)
Sun, Apr 14, 5:39 PM
Unknown Object (File)
Mon, Apr 8, 10:34 PM
Unknown Object (File)
Sat, Apr 6, 12:18 AM
Unknown Object (File)
Mar 19 2024, 10:59 AM
Unknown Object (File)
Mar 19 2024, 10:59 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