uri: Replace bios:// with hdd:// and odd://
This commit is contained in:
parent
1a1be5b09b
commit
de4fd786dd
@ -104,7 +104,8 @@ The format for `root` changes depending on the resource used.
|
||||
|
||||
A resource can be one of the following:
|
||||
* `boot` - If booted off PXE this is an alias of `tftp`. Else the `root` is the 1-based decimal value representing the partition on the boot drive (values of 5+ for MBR logical partitions). If omitted, the partition containing the configuration file on the boot drive is used. For example: `boot://2/...` will use partition 2 of the boot drive and `boot:///...` will use the partition containing the config file on the boot drive.
|
||||
* `bios` - The `root` takes the form of `drive:partition`; for example: `bios://3:1/...` would use BIOS drive 3, partition 1. Partitions and BIOS drives are both 1-based (partition values of 5+ for MBR logical partitions). Omitting the drive is possible; for example: `bios://:2/...`. Omitting the drive makes Limine use the boot drive.
|
||||
* `hdd` - Hard disk drives. The `root` takes the form of `drive:partition`; for example: `hdd://3:1/...` would use hard drive 3, partition 1. Partitions and drives are both 1-based (partition values of 5+ for MBR logical partitions). Omitting the partition is possible; for example: `hdd://2:/...`. Omitting the partition will access the entire volume instead of a specific partition (useful for unpartitioned media).
|
||||
* `odd` - Optical disk drives (CDs/DVDs/...). The `root` takes the form of `drive:partition`; for example: `odd://3:1/...` would use optical drive 3, partition 1. Partitions and drives are both 1-based (partition values of 5+ for MBR logical partitions). Omitting the partition is possible; for example: `odd://2:/...`. Omitting the partition will access the entire volume instead of a specific partition (useful for unpartitioned media, which is often the case for optical media).
|
||||
* `guid` - The `root` takes the form of a GUID/UUID, such as `guid://736b5698-5ae1-4dff-be2c-ef8f44a61c52/...`. The GUID is that of either a filesystem, when available, or a GPT partition GUID, when using GPT, in a unified namespace.
|
||||
* `uuid` - Alias of `guid`.
|
||||
* `tftp` - The `root` is the IP address of the tftp server to load the file from. If the root is left empty (`tftp:///...`) the file will be loaded from the server Limine booted from. This resource is only available when booting off PXE.
|
||||
|
@ -54,11 +54,8 @@ bool uri_resolve(char *uri, char **resource, char **root, char **path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined (bios)
|
||||
// BIOS partitions are specified in the <BIOS drive>:<partition> form.
|
||||
// The drive may be omitted, the partition cannot.
|
||||
static bool parse_bios_partition(char *loc, uint8_t *drive, uint8_t *partition) {
|
||||
uint64_t val;
|
||||
static bool parse_bios_partition(char *loc, int *drive, int *partition) {
|
||||
int64_t val;
|
||||
|
||||
for (size_t i = 0; ; i++) {
|
||||
if (loc[i] == 0)
|
||||
@ -67,38 +64,62 @@ static bool parse_bios_partition(char *loc, uint8_t *drive, uint8_t *partition)
|
||||
if (loc[i] == ':') {
|
||||
loc[i] = 0;
|
||||
if (*loc == 0) {
|
||||
*drive = boot_volume->drive;
|
||||
panic("Drive number cannot be omitted for hdd:// and odd://");
|
||||
} else {
|
||||
val = strtoui(loc, NULL, 10);
|
||||
if (val < 1 || val > 16) {
|
||||
panic("BIOS drive number outside range 1-16");
|
||||
panic("Drive number outside range 1-16");
|
||||
}
|
||||
*drive = (val - 1) + 0x80;
|
||||
*drive = val;
|
||||
}
|
||||
loc += i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*loc == 0)
|
||||
return false;
|
||||
if (*loc == 0) {
|
||||
*partition = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
val = strtoui(loc, NULL, 10);
|
||||
if (val < 1 || val > 256) {
|
||||
panic("BIOS partition number outside range 1-256");
|
||||
panic("Partition number outside range 1-256");
|
||||
}
|
||||
*partition = val - 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool uri_bios_dispatch(struct file_handle *fd, char *loc, char *path) {
|
||||
uint8_t drive, partition;
|
||||
static bool uri_hdd_dispatch(struct file_handle *fd, char *loc, char *path) {
|
||||
int drive, partition;
|
||||
|
||||
if (!parse_bios_partition(loc, &drive, &partition))
|
||||
return false;
|
||||
|
||||
drive = (drive - 1) + 0x80;
|
||||
|
||||
struct volume *volume = volume_get_by_coord(drive, partition);
|
||||
|
||||
if (volume == NULL)
|
||||
return false;
|
||||
|
||||
if (fopen(fd, volume, path))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool uri_odd_dispatch(struct file_handle *fd, char *loc, char *path) {
|
||||
int drive, partition;
|
||||
|
||||
if (!parse_bios_partition(loc, &drive, &partition))
|
||||
return false;
|
||||
|
||||
drive = (drive - 1) + 0xe0;
|
||||
|
||||
struct volume *volume = volume_get_by_coord(drive, partition);
|
||||
|
||||
if (volume == NULL)
|
||||
return false;
|
||||
|
||||
@ -107,7 +128,6 @@ static bool uri_bios_dispatch(struct file_handle *fd, char *loc, char *path) {
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool uri_guid_dispatch(struct file_handle *fd, char *guid_str, char *path) {
|
||||
struct guid guid;
|
||||
@ -199,11 +219,12 @@ bool uri_open(struct file_handle *fd, char *uri) {
|
||||
resource++;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
#if defined (bios)
|
||||
} else if (!strcmp(resource, "bios")) {
|
||||
ret = uri_bios_dispatch(fd, root, path);
|
||||
#endif
|
||||
if (!strcmp(resource, "bios")) {
|
||||
panic("bios:// resource is no longer supported. Check CONFIG.md for hdd:// and odd://");
|
||||
} else if (!strcmp(resource, "hdd")) {
|
||||
ret = uri_hdd_dispatch(fd, root, path);
|
||||
} else if (!strcmp(resource, "odd")) {
|
||||
ret = uri_odd_dispatch(fd, root, path);
|
||||
} else if (!strcmp(resource, "boot")) {
|
||||
ret = uri_boot_dispatch(fd, root, path);
|
||||
} else if (!strcmp(resource, "guid")) {
|
||||
|
@ -56,12 +56,22 @@ KERNEL_CMDLINE=Woah! Another example!
|
||||
MODULE_PATH=boot:///boot/bg.bmp
|
||||
MODULE_STRING=yooooo
|
||||
|
||||
:Test bios://
|
||||
:Test hdd://
|
||||
|
||||
PROTOCOL=stivale2
|
||||
RESOLUTION=640x480x16
|
||||
KERNEL_PATH=bios://:1/boot/test.elf
|
||||
KERNEL_PATH=hdd://1:1/boot/test.elf
|
||||
KERNEL_CMDLINE=Woah! Another example!
|
||||
|
||||
MODULE_PATH=bios://:1/boot/bg.bmp
|
||||
MODULE_PATH=hdd://1:1/boot/bg.bmp
|
||||
MODULE_STRING=yooooo
|
||||
|
||||
:Test odd://
|
||||
|
||||
PROTOCOL=stivale2
|
||||
RESOLUTION=640x480x16
|
||||
KERNEL_PATH=odd://1:/boot/test.elf
|
||||
KERNEL_CMDLINE=Woah! Another example!
|
||||
|
||||
MODULE_PATH=odd://1:/boot/bg.bmp
|
||||
MODULE_STRING=yooooo
|
||||
|
Loading…
Reference in New Issue
Block a user