mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
PartitionTable: Initial GPT Support, Adding Block Limit
Also added a script to handle creation of GPT partitioned disk (with GRUB config file). Block limit will be used to disallow potential access to other partitions.
This commit is contained in:
parent
b5a043cf42
commit
de49714f36
10 changed files with 273 additions and 13 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <Kernel/Devices/DiskPartition.h>
|
||||
#include <Kernel/Devices/FloppyDiskDevice.h>
|
||||
#include <Kernel/Devices/FullDevice.h>
|
||||
#include <Kernel/Devices/GPTPartitionTable.h>
|
||||
#include <Kernel/Devices/KeyboardDevice.h>
|
||||
#include <Kernel/Devices/MBRPartitionTable.h>
|
||||
#include <Kernel/Devices/MBVGADevice.h>
|
||||
|
@ -96,18 +97,34 @@ VFS* vfs;
|
|||
}
|
||||
|
||||
MBRPartitionTable mbr(root_dev);
|
||||
|
||||
if (!mbr.initialize()) {
|
||||
kprintf("init_stage2: couldn't read MBR from disk\n");
|
||||
hang();
|
||||
}
|
||||
|
||||
auto partition = mbr.partition(partition_number);
|
||||
if (!partition) {
|
||||
kprintf("init_stage2: couldn't get partition %d\n", partition_number);
|
||||
hang();
|
||||
if (mbr.is_protective_mbr()) {
|
||||
dbgprintf("GPT Partitioned Storage Detected!\n");
|
||||
GPTPartitionTable gpt(root_dev);
|
||||
if (!gpt.initialize()) {
|
||||
kprintf("init_stage2: couldn't read GPT from disk\n");
|
||||
hang();
|
||||
}
|
||||
auto partition = gpt.partition(partition_number);
|
||||
if (!partition) {
|
||||
kprintf("init_stage2: couldn't get partition %d\n", partition_number);
|
||||
hang();
|
||||
}
|
||||
root_dev = *partition;
|
||||
} else {
|
||||
dbgprintf("MBR Partitioned Storage Detected!\n");
|
||||
auto partition = mbr.partition(partition_number);
|
||||
if (!partition) {
|
||||
kprintf("init_stage2: couldn't get partition %d\n", partition_number);
|
||||
hang();
|
||||
}
|
||||
root_dev = *partition;
|
||||
}
|
||||
|
||||
root_dev = *partition;
|
||||
}
|
||||
|
||||
auto e2fs = Ext2FS::create(root_dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue