Compare commits
36 Commits
v3.17.3-bi
...
v3.0-branc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
751e802e17 | ||
|
|
b081e70e19 | ||
|
|
9b748f508d | ||
|
|
3cfdc8a88d | ||
|
|
2b12406a79 | ||
|
|
997f6ccaa6 | ||
|
|
889a82106c | ||
|
|
bab8bea067 | ||
|
|
9a11151f0c | ||
|
|
b5dbed953c | ||
|
|
8a28109a17 | ||
|
|
7a0c0a7fb3 | ||
|
|
bc5dbcae08 | ||
|
|
71e05dc165 | ||
|
|
97f617767c | ||
|
|
13e9ba0ebc | ||
|
|
e42e1c0d1b | ||
|
|
101c1490f7 | ||
|
|
95e78137b0 | ||
|
|
ec558edef4 | ||
|
|
d96dc79a42 | ||
|
|
27816688cf | ||
|
|
c5ceb70e60 | ||
|
|
032c49db72 | ||
|
|
5c8f3f2f99 | ||
|
|
6bfc97dd87 | ||
|
|
111ae25c86 | ||
|
|
e98107b7db | ||
|
|
0d3698d6d8 | ||
|
|
35132937f8 | ||
|
|
510a4389d5 | ||
|
|
bc318c8d5e | ||
|
|
d6d0e88689 | ||
|
|
daaf492656 | ||
|
|
fac3a4bc54 | ||
|
|
34f4e9c222 |
BIN
BOOTIA32.EFI
BIN
BOOTIA32.EFI
Binary file not shown.
BIN
BOOTX64.EFI
BIN
BOOTX64.EFI
Binary file not shown.
6
Makefile
6
Makefile
@@ -38,8 +38,8 @@ clean:
|
||||
rm -f limine-deploy limine-deploy.exe
|
||||
rm -f limine-version limine-version.exe
|
||||
|
||||
limine-deploy: limine-deploy.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-deploy.c -o $@
|
||||
limine-deploy: limine-deploy.c limine-hdd.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-deploy.c $(LIBS) -o $@
|
||||
|
||||
limine-version: limine-version.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-version.c -o $@
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-version.c $(LIBS) -o $@
|
||||
|
||||
Binary file not shown.
BIN
limine-cd.bin
BIN
limine-cd.bin
Binary file not shown.
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "limine-hdd.h"
|
||||
|
||||
static bool quiet = false;
|
||||
|
||||
static int set_pos(FILE *stream, uint64_t pos) {
|
||||
if (sizeof(long) >= 8) {
|
||||
return fseek(stream, (long)pos, SEEK_SET);
|
||||
@@ -202,7 +204,9 @@ static bool device_init(void) {
|
||||
|
||||
block_size = guesses[i];
|
||||
|
||||
fprintf(stderr, "Physical block size of %zu bytes.\n", block_size);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Physical block size of %zu bytes.\n", block_size);
|
||||
}
|
||||
|
||||
cache_state = CACHE_CLEAN;
|
||||
cached_block = 0;
|
||||
@@ -286,7 +290,9 @@ static void free_undeploy_data(void) {
|
||||
}
|
||||
|
||||
static bool store_undeploy_data(const char *filename) {
|
||||
fprintf(stderr, "Storing undeploy data to file: `%s`...\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Storing undeploy data to file: `%s`...\n", filename);
|
||||
}
|
||||
|
||||
FILE *udfile = fopen(filename, "wb");
|
||||
if (udfile == NULL) {
|
||||
@@ -321,7 +327,9 @@ error:
|
||||
}
|
||||
|
||||
static bool load_undeploy_data(const char *filename) {
|
||||
fprintf(stderr, "Loading undeploy data from file: `%s`...\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Loading undeploy data from file: `%s`...\n", filename);
|
||||
}
|
||||
|
||||
FILE *udfile = fopen(filename, "rb");
|
||||
if (udfile == NULL) {
|
||||
@@ -449,7 +457,9 @@ static void undeploy(void) {
|
||||
fprintf(stderr, "ERROR: Undeploy data index %zu failed to write. Undeploy may be incomplete!\n", i);
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Warning: Undeploy data index %zu failed to write, retrying...\n", i);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Warning: Undeploy data index %zu failed to write, retrying...\n", i);
|
||||
}
|
||||
if (!device_flush_cache()) {
|
||||
fprintf(stderr, "ERROR: Device cache flush failure. Undeploy may be incomplete!\n");
|
||||
}
|
||||
@@ -463,7 +473,9 @@ static void undeploy(void) {
|
||||
fprintf(stderr, "ERROR: Device cache flush failure. Undeploy may be incomplete!\n");
|
||||
}
|
||||
|
||||
fprintf(stderr, "Undeploy data restored successfully. Limine undeployed!\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Undeploy data restored successfully. Limine undeployed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
#define device_read(BUFFER, LOC, COUNT) \
|
||||
@@ -490,6 +502,8 @@ static void usage(const char *name) {
|
||||
printf(" Set the input (for --undeploy) or output file\n");
|
||||
printf(" name of the file which contains undeploy data\n");
|
||||
printf("\n");
|
||||
printf(" --quiet Do not print verbose diagnostic messages\n");
|
||||
printf("\n");
|
||||
printf(" --help | -h Display this help message\n");
|
||||
printf("\n");
|
||||
#ifdef IS_WINDOWS
|
||||
@@ -519,18 +533,20 @@ int main(int argc, char *argv[]) {
|
||||
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
|
||||
usage(argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
} else if (strcmp(argv[i], "--quiet") == 0) {
|
||||
quiet = true;
|
||||
} else if (strcmp(argv[i], "--force-mbr") == 0) {
|
||||
if (force_mbr) {
|
||||
if (force_mbr && !quiet) {
|
||||
fprintf(stderr, "Warning: --force-mbr already set.\n");
|
||||
}
|
||||
force_mbr = 1;
|
||||
} else if (strcmp(argv[i], "--undeploy") == 0) {
|
||||
if (undeploy_mode) {
|
||||
if (undeploy_mode && !quiet) {
|
||||
fprintf(stderr, "Warning: --undeploy already set.\n");
|
||||
}
|
||||
undeploy_mode = true;
|
||||
} else if (memcmp(argv[i], "--undeploy-data-file=", 21) == 0) {
|
||||
if (undeploy_file != NULL) {
|
||||
if (undeploy_file != NULL && !quiet) {
|
||||
fprintf(stderr, "Warning: --undeploy-data-file already set. Overriding...\n");
|
||||
}
|
||||
undeploy_file = argv[i] + 21;
|
||||
@@ -554,8 +570,9 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!device_init())
|
||||
goto cleanup;
|
||||
if (!device_init()) {
|
||||
goto undeploy_mode_cleanup;
|
||||
}
|
||||
|
||||
if (undeploy_mode) {
|
||||
if (undeploy_file == NULL) {
|
||||
@@ -584,10 +601,12 @@ int main(int argc, char *argv[]) {
|
||||
lb_size = lb_guesses[i];
|
||||
if (!force_mbr) {
|
||||
gpt = 1;
|
||||
fprintf(stderr, "Deploying to GPT. Logical block size of %" PRIu64 " bytes.\n",
|
||||
lb_guesses[i]);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Deploying to GPT. Logical block size of %" PRIu64 " bytes.\n",
|
||||
lb_guesses[i]);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Device has a valid GPT, refusing to force MBR.\n");
|
||||
fprintf(stderr, "ERROR: Device has a valid GPT, refusing to force MBR.\n");
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
@@ -596,14 +615,18 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
struct gpt_table_header secondary_gpt_header;
|
||||
if (gpt) {
|
||||
fprintf(stderr, "Secondary header at LBA 0x%" PRIx64 ".\n",
|
||||
ENDSWAP(gpt_header.alternate_lba));
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Secondary header at LBA 0x%" PRIx64 ".\n",
|
||||
ENDSWAP(gpt_header.alternate_lba));
|
||||
}
|
||||
device_read(&secondary_gpt_header, lb_size * ENDSWAP(gpt_header.alternate_lba),
|
||||
sizeof(struct gpt_table_header));
|
||||
if (!strncmp(secondary_gpt_header.signature, "EFI PART", 8)) {
|
||||
fprintf(stderr, "Secondary header valid.\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Secondary header valid.\n");
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Secondary header not valid, aborting.\n");
|
||||
fprintf(stderr, "ERROR: Secondary header not valid, aborting.\n");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@@ -718,8 +741,10 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (mbr && !any_active) {
|
||||
fprintf(stderr, "No active partition found, some systems may not boot.\n");
|
||||
fprintf(stderr, "Setting partition 1 as active to work around the issue...\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "No active partition found, some systems may not boot.\n");
|
||||
fprintf(stderr, "Setting partition 1 as active to work around the issue...\n");
|
||||
}
|
||||
hint8 = 0x80;
|
||||
device_write(&hint8, 446, sizeof(uint8_t));
|
||||
}
|
||||
@@ -766,14 +791,18 @@ int main(int argc, char *argv[]) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fprintf(stderr, "GPT partition specified. Deploying there instead of embedding.\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "GPT partition specified. Deploying there instead of embedding.\n");
|
||||
}
|
||||
|
||||
stage2_loc_a = ENDSWAP(gpt_entry.starting_lba) * lb_size;
|
||||
stage2_loc_b = stage2_loc_a + stage2_size_a;
|
||||
if (stage2_loc_b & (lb_size - 1))
|
||||
stage2_loc_b = (stage2_loc_b + lb_size) & ~(lb_size - 1);
|
||||
} else {
|
||||
fprintf(stderr, "GPT partition NOT specified. Attempting GPT embedding.\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "GPT partition NOT specified. Attempting GPT embedding.\n");
|
||||
}
|
||||
|
||||
int64_t max_partition_entry_used = -1;
|
||||
for (int64_t i = 0; i < (int64_t)ENDSWAP(gpt_header.number_of_partition_entries); i++) {
|
||||
@@ -809,7 +838,9 @@ int main(int argc, char *argv[]) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fprintf(stderr, "New maximum count of partition entries: %zu.\n", new_partition_entry_count);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "New maximum count of partition entries: %zu.\n", new_partition_entry_count);
|
||||
}
|
||||
|
||||
// Zero out unused partitions
|
||||
void *empty = calloc(1, ENDSWAP(gpt_header.size_of_partition_entry));
|
||||
@@ -862,11 +893,15 @@ int main(int argc, char *argv[]) {
|
||||
sizeof(struct gpt_table_header));
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Deploying to MBR.\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Deploying to MBR.\n");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Stage 2 to be located at 0x%" PRIx64 " and 0x%" PRIx64 ".\n",
|
||||
stage2_loc_a, stage2_loc_b);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Stage 2 to be located at 0x%" PRIx64 " and 0x%" PRIx64 ".\n",
|
||||
stage2_loc_a, stage2_loc_b);
|
||||
}
|
||||
|
||||
// Save original timestamp
|
||||
device_read(timestamp, 218, 6);
|
||||
@@ -901,11 +936,13 @@ int main(int argc, char *argv[]) {
|
||||
if (!device_flush_cache())
|
||||
goto cleanup;
|
||||
|
||||
fprintf(stderr, "Reminder: Remember to copy the limine.sys file in either\n"
|
||||
" the root or /boot directories of one of the partitions\n"
|
||||
" on the device, or boot will fail!\n");
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Reminder: Remember to copy the limine.sys file in either\n"
|
||||
" the root, /boot, /limine, or /boot/limine directories of\n"
|
||||
" one of the partitions on the device, or boot will fail!\n");
|
||||
|
||||
fprintf(stderr, "Limine deployed successfully!\n");
|
||||
fprintf(stderr, "Limine deployed successfully!\n");
|
||||
}
|
||||
|
||||
ok = EXIT_SUCCESS;
|
||||
|
||||
|
||||
Binary file not shown.
3082
limine-hdd.h
3082
limine-hdd.h
File diff suppressed because it is too large
Load Diff
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define LIMINE_VERSION "3.17.3"
|
||||
#define LIMINE_VERSION "3.20221230.0"
|
||||
|
||||
int main(void) {
|
||||
puts(LIMINE_VERSION);
|
||||
|
||||
33
limine.h
33
limine.h
@@ -1,3 +1,19 @@
|
||||
/* BSD Zero Clause License */
|
||||
|
||||
/* Copyright (C) 2022 mintsuki and contributors.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _LIMINE_H
|
||||
#define _LIMINE_H 1
|
||||
|
||||
@@ -97,6 +113,20 @@ struct limine_hhdm_request {
|
||||
|
||||
#define LIMINE_FRAMEBUFFER_RGB 1
|
||||
|
||||
struct limine_video_mode {
|
||||
uint64_t pitch;
|
||||
uint64_t width;
|
||||
uint64_t height;
|
||||
uint16_t bpp;
|
||||
uint8_t memory_model;
|
||||
uint8_t red_mask_size;
|
||||
uint8_t red_mask_shift;
|
||||
uint8_t green_mask_size;
|
||||
uint8_t green_mask_shift;
|
||||
uint8_t blue_mask_size;
|
||||
uint8_t blue_mask_shift;
|
||||
};
|
||||
|
||||
struct limine_framebuffer {
|
||||
LIMINE_PTR(void *) address;
|
||||
uint64_t width;
|
||||
@@ -113,6 +143,9 @@ struct limine_framebuffer {
|
||||
uint8_t unused[7];
|
||||
uint64_t edid_size;
|
||||
LIMINE_PTR(void *) edid;
|
||||
/* Revision 1 */
|
||||
uint64_t mode_count;
|
||||
LIMINE_PTR(struct limine_video_mode **) modes;
|
||||
};
|
||||
|
||||
struct limine_framebuffer_response {
|
||||
|
||||
BIN
limine.sys
BIN
limine.sys
Binary file not shown.
Reference in New Issue
Block a user