Support AArch64 root partition type GUID (#4671)
This commit is contained in:
parent
bb0df33556
commit
c25589e772
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
import os
|
||||
import platform
|
||||
from pathlib import Path
|
||||
|
||||
from parted import Device, Disk, DiskException, FileSystem, Geometry, IOException, Partition, PartitionException, freshDisk, getAllDevices, getDevice, newDisk
|
||||
|
|
@ -10,6 +11,7 @@ from archinstall.lib.disk.utils import (
|
|||
find_lsblk_info,
|
||||
get_all_lsblk_info,
|
||||
get_lsblk_info,
|
||||
linux_root_guid,
|
||||
mount,
|
||||
udev_sync,
|
||||
umount,
|
||||
|
|
@ -26,7 +28,6 @@ from archinstall.lib.models.device import (
|
|||
LsblkInfo,
|
||||
ModificationStatus,
|
||||
PartitionFlag,
|
||||
PartitionGUID,
|
||||
PartitionModification,
|
||||
PartitionTable,
|
||||
SubvolumeModification,
|
||||
|
|
@ -339,6 +340,7 @@ class DeviceHandler:
|
|||
block_device: BDevice,
|
||||
disk: Disk,
|
||||
requires_delete: bool,
|
||||
arch: str | None = None,
|
||||
) -> None:
|
||||
# when we require a delete and the partition to be (re)created
|
||||
# already exists then we have to delete it first
|
||||
|
|
@ -394,7 +396,7 @@ class DeviceHandler:
|
|||
|
||||
if disk.type == PartitionTable.GPT.value:
|
||||
if part_mod.is_root():
|
||||
partition.type_uuid = PartitionGUID.LINUX_ROOT_X86_64.bytes
|
||||
partition.type_uuid = linux_root_guid(arch).bytes
|
||||
elif PartitionFlag.LINUX_HOME not in part_mod.flags and part_mod.is_home():
|
||||
partition.setFlag(PartitionFlag.LINUX_HOME.flag_id)
|
||||
|
||||
|
|
@ -536,11 +538,19 @@ class DeviceHandler:
|
|||
# don't touch existing partitions
|
||||
filtered_part = [p for p in modification.partitions if not p.exists()]
|
||||
|
||||
arch = platform.machine()
|
||||
|
||||
for part_mod in filtered_part:
|
||||
# if the entire disk got nuked then we don't have to delete
|
||||
# any existing partitions anymore because they're all gone already
|
||||
requires_delete = modification.wipe is False
|
||||
self._setup_partition(part_mod, modification.device, disk, requires_delete=requires_delete)
|
||||
self._setup_partition(
|
||||
part_mod,
|
||||
modification.device,
|
||||
disk,
|
||||
requires_delete=requires_delete,
|
||||
arch=arch,
|
||||
)
|
||||
|
||||
disk.commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from pydantic import BaseModel
|
|||
from archinstall.lib.command import SysCommand, run
|
||||
from archinstall.lib.exceptions import DiskError, SysCallError
|
||||
from archinstall.lib.log import debug, info, warn
|
||||
from archinstall.lib.models.device import LsblkInfo
|
||||
from archinstall.lib.models.device import LsblkInfo, PartitionGUID
|
||||
|
||||
|
||||
class LsblkOutput(BaseModel):
|
||||
|
|
@ -196,3 +196,10 @@ def swapon(path: Path) -> None:
|
|||
SysCommand(['swapon', str(path)])
|
||||
except SysCallError as err:
|
||||
raise DiskError(f'Could not enable swap {path}:\n{err.message}')
|
||||
|
||||
|
||||
def linux_root_guid(arch: str | None) -> PartitionGUID:
|
||||
if arch == 'aarch64':
|
||||
return PartitionGUID.LINUX_ROOT_AARCH64
|
||||
|
||||
return PartitionGUID.LINUX_ROOT_X86_64
|
||||
|
|
|
|||
|
|
@ -805,9 +805,11 @@ class PartitionFlag(PartitionFlagDataMixin, Enum):
|
|||
|
||||
class PartitionGUID(Enum):
|
||||
"""
|
||||
A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
|
||||
A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here:
|
||||
https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
|
||||
"""
|
||||
|
||||
LINUX_ROOT_AARCH64 = 'B921B045-1DF0-41C3-AF44-4C6F280D3FAE'
|
||||
LINUX_ROOT_X86_64 = '4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709'
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Reference in New Issue