1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:57:36 +00:00

Kernel: Allow booting from an SD card

This commit is contained in:
Marco Cutecchia 2023-03-24 22:11:39 +01:00 committed by Andrew Kaster
parent 5fe6c6fc24
commit 425acb513e
2 changed files with 14 additions and 0 deletions

View file

@ -54,6 +54,7 @@ static constexpr StringView block_device_prefix = "block"sv;
static constexpr StringView ata_device_prefix = "ata"sv;
static constexpr StringView nvme_device_prefix = "nvme"sv;
static constexpr StringView logical_unit_number_device_prefix = "lun"sv;
static constexpr StringView sd_device_prefix = "sd"sv;
UNMAP_AFTER_INIT StorageManagement::StorageManagement()
{
@ -324,6 +325,13 @@ UNMAP_AFTER_INIT void StorageManagement::determine_nvme_boot_device()
});
}
UNMAP_AFTER_INIT void StorageManagement::determine_sd_boot_device()
{
determine_hardware_relative_boot_device(sd_device_prefix, [](StorageDevice const& device) -> bool {
return device.command_set() == StorageDevice::CommandSet::SD;
});
}
UNMAP_AFTER_INIT void StorageManagement::determine_block_boot_device()
{
VERIFY(m_boot_argument.starts_with(block_device_prefix));
@ -387,6 +395,11 @@ UNMAP_AFTER_INIT void StorageManagement::determine_boot_device()
determine_nvme_boot_device();
return;
}
if (m_boot_argument.starts_with(sd_device_prefix)) {
determine_sd_boot_device();
return;
}
PANIC("StorageManagement: Invalid root boot parameter.");
}

View file

@ -54,6 +54,7 @@ private:
void determine_boot_device_with_logical_unit_number();
void determine_block_boot_device();
void determine_nvme_boot_device();
void determine_sd_boot_device();
void determine_ata_boot_device();
void determine_hardware_relative_boot_device(StringView relative_hardware_prefix, Function<bool(StorageDevice const&)> filter_device_callback);
Array<unsigned, 3> extract_boot_device_address_parameters(StringView device_prefix);