1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

Kernel: Allow to boot from a partition with partition UUID

Instead of specifying the boot argument to be root=/dev/hdXY, now
one can write root=PARTUUID= with the right UUID, and if the partition
is found, the kernel will boot from it.

This feature is mainly used with GUID partitions, and is considered to
be the most reliable way for the kernel to identify partitions.
This commit is contained in:
Liav A 2020-12-31 13:17:03 +02:00 committed by Andreas Kling
parent d22d29a29a
commit 9dc8bea3e7
9 changed files with 162 additions and 62 deletions

View file

@ -41,9 +41,9 @@ class StorageManagement {
AK_MAKE_ETERNAL;
public:
StorageManagement(String root_device, bool force_pio);
StorageManagement(String boot_argument, bool force_pio);
static bool initialized();
static void initialize(String root_device, bool force_pio);
static void initialize(String boot_argument, bool force_pio);
static StorageManagement& the();
NonnullRefPtr<FS> root_filesystem() const;
@ -51,22 +51,24 @@ public:
NonnullRefPtrVector<StorageController> ide_controllers() const;
private:
NonnullRefPtr<BlockDevice> boot_block_device() const;
bool boot_argument_contains_partition_uuid();
NonnullRefPtrVector<StorageController> enumerate_controllers(bool force_pio) const;
NonnullRefPtrVector<StorageDevice> enumerate_storage_devices() const;
NonnullRefPtrVector<DiskPartition> enumerate_disk_partitions() const;
NonnullRefPtr<StorageDevice> determine_boot_device(String root_device) const;
NonnullRefPtr<BlockDevice> determine_boot_block_device(String root_device) const;
void determine_boot_device();
void determine_boot_device_with_partition_uuid();
OwnPtr<PartitionTable> try_to_initialize_partition_table(const StorageDevice&) const;
RefPtr<BlockDevice> boot_block_device() const;
String m_boot_argument;
RefPtr<BlockDevice> m_boot_block_device { nullptr };
NonnullRefPtrVector<StorageController> m_controllers;
NonnullRefPtrVector<StorageDevice> m_storage_devices;
NonnullRefPtrVector<DiskPartition> m_disk_partitions;
NonnullRefPtr<StorageDevice> m_boot_device;
NonnullRefPtr<BlockDevice> m_boot_block_device;
};
}