misc: Add limine subdir to stage3 and config search paths. Closes #225
diff --git a/CONFIG.md b/CONFIG.md
index 66e135a2..b73e0d4c 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -5,7 +5,8 @@
Limine scans for a config file on *the boot drive*. Every partition on the boot drive
is scanned sequentially - first partition first (or, on UEFI, the partition containing the
EFI executable of the booted Limine is scanned first), last partition last - for the presence
-of either a `/limine.cfg`, `/boot/limine.cfg`, or a `/EFI/BOOT/limine.cfg` file, in that order.
+of either a `/limine.cfg`, `/limine/limine.cfg`, `/boot/limine.cfg`, `/boot/limine/limine.cfg`,
+or a `/EFI/BOOT/limine.cfg` file, in that order.
Once the file is located, Limine will use it as its config file. Other possible
candidates in subsequent partitions or directories are ignored.
diff --git a/README.md b/README.md
index 443d695e..85b5a09b 100644
--- a/README.md
+++ b/README.md
@@ -127,9 +127,9 @@ the `/EFI/BOOT` directory of a FAT formatted EFI system partition. These files c
be installed there and coexist with a BIOS installation of Limine (see below) so
that the disk will be bootable on both BIOS and UEFI systems.
-The boot device must to contain the `limine.cfg` file in
-either the root or the `boot` directory of one of the partitions, formatted
-with a supported file system (the ESP partition is recommended).
+The boot device must to contain the `limine.cfg` files in
+either the root, `limine`, `boot`, or `boot/limine` directory of one of the
+partitions, formatted with a supported file system (the ESP partition is recommended).
### BIOS/MBR
In order to install Limine on a MBR device (which can just be a raw image file),
@@ -140,8 +140,8 @@ limine-deploy <path to device/image>
```
The boot device must to contain the `limine.sys` and `limine.cfg` files in
-either the root or the `boot` directory of one of the partitions, formatted
-with a supported file system.
+either the root, `limine`, `boot`, or `boot/limine` directory of one of the
+partitions, formatted with a supported file system.
### BIOS/GPT
If using a GPT formatted device, there are 2 options one can follow for
@@ -162,15 +162,15 @@ simply omit the partition number, and invoke `limine-deploy` the same as one
would do for an MBR partitioned device.
The boot device must to contain the `limine.sys` and `limine.cfg` files in
-either the root or the `boot` directory of one of the partitions, formatted
-with a supported file system.
+either the root, `limine`, `boot`, or `boot/limine` directory of one of the
+partitions, formatted with a supported file system.
### BIOS/UEFI hybrid ISO creation
In order to create a hybrid ISO with Limine, place the
`limine-cd-efi.bin`, `limine-cd.bin`, `limine.sys`, and `limine.cfg` files
into a directory which will serve as the root of the created ISO.
-(`limine.sys` and `limine.cfg` must either be in the root or inside a `boot`
-subdirectory; `limine-cd-efi.bin` and `limine-cd.bin` can reside
+(`limine.sys` and `limine.cfg` must either be in the root, `limine`, `boot`, or
+`boot/limine` directory; `limine-cd-efi.bin` and `limine-cd.bin` can reside
anywhere).
Place any other file you want to be on the final ISO in said directory, then
diff --git a/common/entry.s2.c b/common/entry.s2.c
index efdfe042..6e344c58 100644
--- a/common/entry.s2.c
+++ b/common/entry.s2.c
@@ -42,7 +42,9 @@ static bool stage3_init(struct volume *part) {
bool old_cif = case_insensitive_fopen;
case_insensitive_fopen = true;
if ((stage3 = fopen(part, "/limine.sys")) == NULL
- && (stage3 = fopen(part, "/boot/limine.sys")) == NULL) {
+ && (stage3 = fopen(part, "/limine/limine.sys")) == NULL
+ && (stage3 = fopen(part, "/boot/limine.sys")) == NULL
+ && (stage3 = fopen(part, "/boot/limine/limine.sys")) == NULL) {
case_insensitive_fopen = old_cif;
return false;
}
diff --git a/common/entry.s3.c b/common/entry.s3.c
index 6750367a..fb600156 100644
--- a/common/entry.s3.c
+++ b/common/entry.s3.c
@@ -72,7 +72,9 @@ could_not_match:
bool old_cif = case_insensitive_fopen;
case_insensitive_fopen = true;
if ((f = fopen(volume_index[i], "/limine.cfg")) == NULL
+ && (f = fopen(volume_index[i], "/limine/limine.cfg")) == NULL
&& (f = fopen(volume_index[i], "/boot/limine.cfg")) == NULL
+ && (f = fopen(volume_index[i], "/boot/limine/limine.cfg")) == NULL
&& (f = fopen(volume_index[i], "/EFI/BOOT/limine.cfg")) == NULL) {
case_insensitive_fopen = old_cif;
continue;
diff --git a/common/lib/config.c b/common/lib/config.c
index c270d8dc..ac3ad2a5 100644
--- a/common/lib/config.c
+++ b/common/lib/config.c
@@ -24,7 +24,9 @@ int init_config_disk(struct volume *part) {
bool old_cif = case_insensitive_fopen;
case_insensitive_fopen = true;
if ((f = fopen(part, "/limine.cfg")) == NULL
+ && (f = fopen(part, "/limine/limine.cfg")) == NULL
&& (f = fopen(part, "/boot/limine.cfg")) == NULL
+ && (f = fopen(part, "/boot/limine/limine.cfg")) == NULL
&& (f = fopen(part, "/EFI/BOOT/limine.cfg")) == NULL) {
case_insensitive_fopen = old_cif;
return -1;
