Skip to content

Commit e8ffccc

Browse files
committed
Support AArch64 root partition type GUID
1 parent fe16238 commit e8ffccc

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

archinstall/lib/disk/device_handler.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import os
3+
import platform
34
from pathlib import Path
45

56
from parted import Device, Disk, DiskException, FileSystem, Geometry, IOException, Partition, PartitionException, freshDisk, getAllDevices, getDevice, newDisk
@@ -10,6 +11,7 @@
1011
find_lsblk_info,
1112
get_all_lsblk_info,
1213
get_lsblk_info,
14+
linux_root_guid,
1315
mount,
1416
udev_sync,
1517
umount,
@@ -26,7 +28,6 @@
2628
LsblkInfo,
2729
ModificationStatus,
2830
PartitionFlag,
29-
PartitionGUID,
3031
PartitionModification,
3132
PartitionTable,
3233
SubvolumeModification,
@@ -339,6 +340,7 @@ def _setup_partition(
339340
block_device: BDevice,
340341
disk: Disk,
341342
requires_delete: bool,
343+
arch: str | None = None,
342344
) -> None:
343345
# when we require a delete and the partition to be (re)created
344346
# already exists then we have to delete it first
@@ -394,7 +396,7 @@ def _setup_partition(
394396

395397
if disk.type == PartitionTable.GPT.value:
396398
if part_mod.is_root():
397-
partition.type_uuid = PartitionGUID.LINUX_ROOT_X86_64.bytes
399+
partition.type_uuid = linux_root_guid(arch).bytes
398400
elif PartitionFlag.LINUX_HOME not in part_mod.flags and part_mod.is_home():
399401
partition.setFlag(PartitionFlag.LINUX_HOME.flag_id)
400402

@@ -536,11 +538,19 @@ def partition(
536538
# don't touch existing partitions
537539
filtered_part = [p for p in modification.partitions if not p.exists()]
538540

541+
arch = platform.machine()
542+
539543
for part_mod in filtered_part:
540544
# if the entire disk got nuked then we don't have to delete
541545
# any existing partitions anymore because they're all gone already
542546
requires_delete = modification.wipe is False
543-
self._setup_partition(part_mod, modification.device, disk, requires_delete=requires_delete)
547+
self._setup_partition(
548+
part_mod,
549+
modification.device,
550+
disk,
551+
requires_delete=requires_delete,
552+
arch=arch,
553+
)
544554

545555
disk.commit()
546556

archinstall/lib/disk/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from archinstall.lib.command import SysCommand, run
77
from archinstall.lib.exceptions import DiskError, SysCallError
88
from archinstall.lib.log import debug, info, warn
9-
from archinstall.lib.models.device import LsblkInfo
9+
from archinstall.lib.models.device import LsblkInfo, PartitionGUID
1010

1111

1212
class LsblkOutput(BaseModel):
@@ -196,3 +196,10 @@ def swapon(path: Path) -> None:
196196
SysCommand(['swapon', str(path)])
197197
except SysCallError as err:
198198
raise DiskError(f'Could not enable swap {path}:\n{err.message}')
199+
200+
201+
def linux_root_guid(arch: str | None) -> PartitionGUID:
202+
if arch == 'aarch64':
203+
return PartitionGUID.LINUX_ROOT_AARCH64
204+
205+
return PartitionGUID.LINUX_ROOT_X86_64

archinstall/lib/models/device.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,11 @@ def from_string(cls, s: str) -> Self | None:
805805

806806
class PartitionGUID(Enum):
807807
"""
808-
A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
808+
A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here:
809+
https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
809810
"""
810811

812+
LINUX_ROOT_AARCH64 = 'B921B045-1DF0-41C3-AF44-4C6F280D3FAE'
811813
LINUX_ROOT_X86_64 = '4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709'
812814

813815
@property

0 commit comments

Comments
 (0)