Compare commits
47 Commits
v4.2023020
...
v4.2023092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc916536a1 | ||
|
|
95b8ea432f | ||
|
|
7d1933affb | ||
|
|
dccfa323a9 | ||
|
|
75215a5d51 | ||
|
|
024565f6a7 | ||
|
|
32e718ab88 | ||
|
|
a199a01df6 | ||
|
|
5890becdea | ||
|
|
4b868cf9c8 | ||
|
|
9372a637fe | ||
|
|
6dfc837655 | ||
|
|
d5709e3255 | ||
|
|
2d3d7b2633 | ||
|
|
9967375d35 | ||
|
|
cc737752d3 | ||
|
|
5aaba3bcd9 | ||
|
|
9272485dd0 | ||
|
|
0659bb3dca | ||
|
|
da6efcf9f3 | ||
|
|
475b34ce67 | ||
|
|
ef3450b8bd | ||
|
|
1a17d8964c | ||
|
|
9b889d7410 | ||
|
|
698e928353 | ||
|
|
6d63b151bb | ||
|
|
21f065109a | ||
|
|
8a58818e95 | ||
|
|
1c8e3296ec | ||
|
|
a58fe2ec6e | ||
|
|
e505dfcabf | ||
|
|
3da926189f | ||
|
|
f1eaadf349 | ||
|
|
d822b197d6 | ||
|
|
38e4586448 | ||
|
|
4a2d6f786e | ||
|
|
71b0ba929a | ||
|
|
e8489a4054 | ||
|
|
dca512c90b | ||
|
|
10ca0a235b | ||
|
|
329ef0f41f | ||
|
|
c6a0f5aa85 | ||
|
|
ff8ec24818 | ||
|
|
cce6b0af6a | ||
|
|
36e53cc5dd | ||
|
|
432352635f | ||
|
|
2b4736b8bb |
BIN
BOOTAA64.EFI
Executable file → Normal file
BIN
BOOTAA64.EFI
Executable file → Normal file
Binary file not shown.
BIN
BOOTIA32.EFI
Executable file → Normal file
BIN
BOOTIA32.EFI
Executable file → Normal file
Binary file not shown.
BIN
BOOTX64.EFI
Executable file → Normal file
BIN
BOOTX64.EFI
Executable file → Normal file
Binary file not shown.
26
Makefile
26
Makefile
@@ -1,15 +1,16 @@
|
||||
CC ?= cc
|
||||
STRIP ?= strip
|
||||
INSTALL ?= ./install-sh
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
|
||||
CFLAGS ?= -g -O2 -pipe -Wall -Wextra
|
||||
CFLAGS ?= -g -O2 -pipe
|
||||
|
||||
.PHONY: all
|
||||
all: limine-deploy limine-version limine-enroll-config
|
||||
|
||||
.PHONY: install-data
|
||||
install-data: all
|
||||
.PHONY: install
|
||||
install: all
|
||||
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/share'
|
||||
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/share/limine'
|
||||
$(INSTALL) -m 644 limine.sys '$(DESTDIR)$(PREFIX)/share/limine/'
|
||||
@@ -18,22 +19,19 @@ install-data: all
|
||||
$(INSTALL) -m 644 limine-pxe.bin '$(DESTDIR)$(PREFIX)/share/limine/'
|
||||
$(INSTALL) -m 644 BOOTX64.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
|
||||
$(INSTALL) -m 644 BOOTIA32.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
|
||||
$(INSTALL) -m 644 BOOTAA64.EFI '$(DESTDIR)$(PREFIX)/share/limine/'
|
||||
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/include'
|
||||
$(INSTALL) -m 644 limine.h '$(DESTDIR)$(PREFIX)/include/'
|
||||
|
||||
.PHONY: install
|
||||
install: install-data
|
||||
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/bin'
|
||||
$(INSTALL) limine-deploy '$(DESTDIR)$(PREFIX)/bin/'
|
||||
$(INSTALL) limine-version '$(DESTDIR)$(PREFIX)/bin/'
|
||||
$(INSTALL) limine-enroll-config '$(DESTDIR)$(PREFIX)/bin/'
|
||||
|
||||
.PHONY: install-strip
|
||||
install-strip: install-data
|
||||
$(INSTALL) -d '$(DESTDIR)$(PREFIX)/bin'
|
||||
$(INSTALL) -s limine-deploy '$(DESTDIR)$(PREFIX)/bin/'
|
||||
$(INSTALL) -s limine-version '$(DESTDIR)$(PREFIX)/bin/'
|
||||
$(INSTALL) -s limine-enroll-config '$(DESTDIR)$(PREFIX)/bin/'
|
||||
install-strip: install
|
||||
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine-deploy'
|
||||
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine-version'
|
||||
$(STRIP) '$(DESTDIR)$(PREFIX)/bin/limine-enroll-config'
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@@ -42,10 +40,10 @@ clean:
|
||||
rm -f limine-enroll-config limine-enroll-config.exe
|
||||
|
||||
limine-deploy: limine-deploy.c limine-hdd.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-deploy.c $(LIBS) -o $@
|
||||
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine-deploy.c $(LIBS) -o $@
|
||||
|
||||
limine-version: limine-version.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-version.c $(LIBS) -o $@
|
||||
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine-version.c $(LIBS) -o $@
|
||||
|
||||
limine-enroll-config: limine-enroll-config.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -std=c99 -D__USE_MINGW_ANSI_STDIO limine-enroll-config.c $(LIBS) -o $@
|
||||
$(CC) $(CFLAGS) -Wall -Wextra $(WERROR_FLAG) $(CPPFLAGS) $(LDFLAGS) -std=c99 limine-enroll-config.c $(LIBS) -o $@
|
||||
|
||||
Binary file not shown.
BIN
limine-cd.bin
BIN
limine-cd.bin
Binary file not shown.
@@ -137,8 +137,6 @@ static uint32_t crc32(void *_stream, size_t len) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool bigendian = false;
|
||||
|
||||
static uint16_t endswap16(uint16_t value) {
|
||||
uint16_t ret = 0;
|
||||
ret |= (value >> 8) & 0x00ff;
|
||||
@@ -168,6 +166,20 @@ static uint64_t endswap64(uint64_t value) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __BYTE_ORDER__
|
||||
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define bigendian true
|
||||
#else
|
||||
#define bigendian false
|
||||
#endif
|
||||
|
||||
#else /* !__BYTE_ORDER__ */
|
||||
|
||||
static bool bigendian = false;
|
||||
|
||||
#endif /* !__BYTE_ORDER__ */
|
||||
|
||||
#define ENDSWAP(VALUE) (bigendian ? ( \
|
||||
sizeof(VALUE) == 1 ? (VALUE) : \
|
||||
sizeof(VALUE) == 2 ? endswap16(VALUE) : \
|
||||
@@ -228,7 +240,9 @@ static bool device_flush_cache(void) {
|
||||
|
||||
size_t ret = fwrite(cache, block_size, 1, device);
|
||||
if (ret != 1) {
|
||||
perror("ERROR");
|
||||
if (ferror(device)) {
|
||||
perror("ERROR");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -252,7 +266,9 @@ static bool device_cache_block(uint64_t block) {
|
||||
|
||||
size_t ret = fread(cache, block_size, 1, device);
|
||||
if (ret != 1) {
|
||||
perror("ERROR");
|
||||
if (ferror(device)) {
|
||||
perror("ERROR");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -506,9 +522,6 @@ static void usage(const char *name) {
|
||||
printf("\n");
|
||||
printf(" --help | -h Display this help message\n");
|
||||
printf("\n");
|
||||
#ifdef IS_WINDOWS
|
||||
system("pause");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@@ -520,12 +533,17 @@ int main(int argc, char *argv[]) {
|
||||
uint8_t orig_mbr[70], timestamp[6];
|
||||
const char *part_ndx = NULL;
|
||||
|
||||
#ifndef __BYTE_ORDER__
|
||||
uint32_t endcheck = 0x12345678;
|
||||
uint8_t endbyte = *((uint8_t *)&endcheck);
|
||||
bigendian = endbyte == 0x12;
|
||||
#endif
|
||||
|
||||
if (argc < 2) {
|
||||
usage(argv[0]);
|
||||
#ifdef IS_WINDOWS
|
||||
system("pause");
|
||||
#endif
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,22 +1,67 @@
|
||||
#undef IS_WINDOWS
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
#define IS_WINDOWS 1
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CONFIG_B2SUM_SIGNATURE "++CONFIG_B2SUM_SIGNATURE++"
|
||||
|
||||
static void usage(const char *name) {
|
||||
printf("Usage: %s <Limine executable> <BLAKE2B of config file>\n", name);
|
||||
printf("\n");
|
||||
printf(" --reset Remove enrolled BLAKE2B, will not check config integrity\n");
|
||||
printf("\n");
|
||||
printf(" --quiet Do not print verbose diagnostic messages\n");
|
||||
printf("\n");
|
||||
printf(" --help | -h Display this help message\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void remove_arg(int *argc, char *argv[], int index) {
|
||||
for (int i = index; i < *argc - 1; i++) {
|
||||
argv[i] = argv[i + 1];
|
||||
}
|
||||
|
||||
(*argc)--;
|
||||
|
||||
argv[*argc] = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret = 1;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
char *bootloader = NULL;
|
||||
FILE *bootloader_file = NULL;
|
||||
bool quiet = false;
|
||||
bool reset = false;
|
||||
|
||||
if (argc <= 2) {
|
||||
fprintf(stderr, "usage: %s <Limine bootloader executable> <128-byte BLAKE2B of config file>\n", argv[0]);
|
||||
goto cleanup;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
|
||||
usage(argv[0]);
|
||||
return EXIT_SUCCESS;
|
||||
} else if (strcmp(argv[i], "--quiet") == 0) {
|
||||
remove_arg(&argc, argv, i);
|
||||
quiet = true;
|
||||
} else if (strcmp(argv[i], "--reset") == 0) {
|
||||
remove_arg(&argc, argv, i);
|
||||
reset = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(argv[2]) != 128) {
|
||||
if (argc <= (reset ? 1 : 2)) {
|
||||
usage(argv[0]);
|
||||
#ifdef IS_WINDOWS
|
||||
system("pause");
|
||||
#endif
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!reset && strlen(argv[2]) != 128) {
|
||||
fprintf(stderr, "ERROR: BLAKE2B specified is not 128 characters long\n");
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -48,7 +93,7 @@ int main(int argc, char *argv[]) {
|
||||
char *checksum_loc = NULL;
|
||||
size_t checked_count = 0;
|
||||
const char *config_b2sum_sign = CONFIG_B2SUM_SIGNATURE;
|
||||
for (size_t i = 0; i < bootloader_size; i++) {
|
||||
for (size_t i = 0; i < bootloader_size - ((sizeof(CONFIG_B2SUM_SIGNATURE) - 1) + 128) + 1; i++) {
|
||||
if (bootloader[i] != config_b2sum_sign[checked_count]) {
|
||||
checked_count = 0;
|
||||
continue;
|
||||
@@ -67,7 +112,11 @@ int main(int argc, char *argv[]) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
memcpy(checksum_loc, argv[2], 128);
|
||||
if (!reset) {
|
||||
memcpy(checksum_loc, argv[2], 128);
|
||||
} else {
|
||||
memset(checksum_loc, '0', 128);
|
||||
}
|
||||
|
||||
if (fseek(bootloader_file, 0, SEEK_SET) != 0) {
|
||||
perror("ERROR");
|
||||
@@ -78,8 +127,10 @@ int main(int argc, char *argv[]) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Config file BLAKE2B successfully enrolled!\n");
|
||||
ret = 0;
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Config file BLAKE2B successfully %s!\n", reset ? "reset" : "enrolled");
|
||||
}
|
||||
ret = EXIT_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
if (bootloader != NULL) {
|
||||
|
||||
Binary file not shown.
2639
limine-hdd.h
2639
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 "4.20230207.0"
|
||||
#define LIMINE_VERSION "4.20230928.2"
|
||||
|
||||
int main(void) {
|
||||
puts(LIMINE_VERSION);
|
||||
|
||||
103
limine.h
103
limine.h
@@ -31,6 +31,19 @@ extern "C" {
|
||||
# define LIMINE_PTR(TYPE) TYPE
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define LIMINE_DEPRECATED __attribute__((__deprecated__))
|
||||
# define LIMINE_DEPRECATED_IGNORE_START \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
# define LIMINE_DEPRECATED_IGNORE_END \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
# define LIMINE_DEPRECATED
|
||||
# define LIMINE_DEPRECATED_IGNORE_START
|
||||
# define LIMINE_DEPRECATED_IGNORE_END
|
||||
#endif
|
||||
|
||||
#define LIMINE_COMMON_MAGIC 0xc7b1dd30df4c8b88, 0x0a82e883a194f07b
|
||||
|
||||
struct limine_uuid {
|
||||
@@ -191,45 +204,91 @@ struct limine_framebuffer_request {
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_ONOCR (1 << 6)
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_OPOST (1 << 7)
|
||||
|
||||
struct limine_terminal;
|
||||
LIMINE_DEPRECATED_IGNORE_START
|
||||
|
||||
struct LIMINE_DEPRECATED limine_terminal;
|
||||
|
||||
typedef void (*limine_terminal_write)(struct limine_terminal *, const char *, uint64_t);
|
||||
typedef void (*limine_terminal_callback)(struct limine_terminal *, uint64_t, uint64_t, uint64_t, uint64_t);
|
||||
|
||||
struct limine_terminal {
|
||||
struct LIMINE_DEPRECATED limine_terminal {
|
||||
uint64_t columns;
|
||||
uint64_t rows;
|
||||
LIMINE_PTR(struct limine_framebuffer *) framebuffer;
|
||||
};
|
||||
|
||||
struct limine_terminal_response {
|
||||
struct LIMINE_DEPRECATED limine_terminal_response {
|
||||
uint64_t revision;
|
||||
uint64_t terminal_count;
|
||||
LIMINE_PTR(struct limine_terminal **) terminals;
|
||||
LIMINE_PTR(limine_terminal_write) write;
|
||||
};
|
||||
|
||||
struct limine_terminal_request {
|
||||
struct LIMINE_DEPRECATED limine_terminal_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_terminal_response *) response;
|
||||
LIMINE_PTR(limine_terminal_callback) callback;
|
||||
};
|
||||
|
||||
LIMINE_DEPRECATED_IGNORE_END
|
||||
|
||||
/* Paging mode */
|
||||
|
||||
#define LIMINE_PAGING_MODE_REQUEST { LIMINE_COMMON_MAGIC, 0x95c1a0edab0944cb, 0xa4e5cb3842f7488a }
|
||||
|
||||
#if defined (__x86_64__) || defined (__i386__)
|
||||
#define LIMINE_PAGING_MODE_X86_64_4LVL 0
|
||||
#define LIMINE_PAGING_MODE_X86_64_5LVL 1
|
||||
#define LIMINE_PAGING_MODE_MAX LIMINE_PAGING_MODE_X86_64_5LVL
|
||||
#define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_X86_64_4LVL
|
||||
#elif defined (__aarch64__)
|
||||
#define LIMINE_PAGING_MODE_AARCH64_4LVL 0
|
||||
#define LIMINE_PAGING_MODE_AARCH64_5LVL 1
|
||||
#define LIMINE_PAGING_MODE_MAX LIMINE_PAGING_MODE_AARCH64_5LVL
|
||||
#define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_AARCH64_4LVL
|
||||
#elif defined (__riscv) && (__riscv_xlen == 64)
|
||||
#define LIMINE_PAGING_MODE_RISCV_SV39 0
|
||||
#define LIMINE_PAGING_MODE_RISCV_SV48 1
|
||||
#define LIMINE_PAGING_MODE_RISCV_SV57 2
|
||||
#define LIMINE_PAGING_MODE_MAX LIMINE_PAGING_MODE_RISCV_SV57
|
||||
#define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_RISCV_SV48
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
|
||||
struct limine_paging_mode_response {
|
||||
uint64_t revision;
|
||||
uint64_t mode;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
struct limine_paging_mode_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_paging_mode_response *) response;
|
||||
uint64_t mode;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
/* 5-level paging */
|
||||
|
||||
#define LIMINE_5_LEVEL_PAGING_REQUEST { LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888 }
|
||||
|
||||
struct limine_5_level_paging_response {
|
||||
LIMINE_DEPRECATED_IGNORE_START
|
||||
|
||||
struct LIMINE_DEPRECATED limine_5_level_paging_response {
|
||||
uint64_t revision;
|
||||
};
|
||||
|
||||
struct limine_5_level_paging_request {
|
||||
struct LIMINE_DEPRECATED limine_5_level_paging_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_5_level_paging_response *) response;
|
||||
};
|
||||
|
||||
LIMINE_DEPRECATED_IGNORE_END
|
||||
|
||||
/* SMP */
|
||||
|
||||
#define LIMINE_SMP_REQUEST { LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 }
|
||||
@@ -271,12 +330,30 @@ struct limine_smp_info {
|
||||
|
||||
struct limine_smp_response {
|
||||
uint64_t revision;
|
||||
uint32_t flags;
|
||||
uint64_t flags;
|
||||
uint64_t bsp_mpidr;
|
||||
uint64_t cpu_count;
|
||||
LIMINE_PTR(struct limine_smp_info **) cpus;
|
||||
};
|
||||
|
||||
#elif defined (__riscv) && (__riscv_xlen == 64)
|
||||
|
||||
struct limine_smp_info {
|
||||
uint64_t processor_id;
|
||||
uint64_t hartid;
|
||||
uint64_t reserved;
|
||||
LIMINE_PTR(limine_goto_address) goto_address;
|
||||
uint64_t extra_argument;
|
||||
};
|
||||
|
||||
struct limine_smp_response {
|
||||
uint64_t revision;
|
||||
uint64_t flags;
|
||||
uint64_t bsp_hartid;
|
||||
uint64_t cpu_count;
|
||||
LIMINE_PTR(struct limine_smp_info **) cpus;
|
||||
};
|
||||
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
@@ -355,6 +432,14 @@ struct limine_kernel_file_request {
|
||||
|
||||
#define LIMINE_MODULE_REQUEST { LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee }
|
||||
|
||||
#define LIMINE_INTERNAL_MODULE_REQUIRED (1 << 0)
|
||||
|
||||
struct limine_internal_module {
|
||||
LIMINE_PTR(const char *) path;
|
||||
LIMINE_PTR(const char *) cmdline;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
struct limine_module_response {
|
||||
uint64_t revision;
|
||||
uint64_t module_count;
|
||||
@@ -365,6 +450,10 @@ struct limine_module_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_module_response *) response;
|
||||
|
||||
/* Request revision 1 */
|
||||
uint64_t internal_module_count;
|
||||
LIMINE_PTR(struct limine_internal_module **) internal_modules;
|
||||
};
|
||||
|
||||
/* RSDP */
|
||||
|
||||
BIN
limine.sys
Executable file → Normal file
BIN
limine.sys
Executable file → Normal file
Binary file not shown.
Reference in New Issue
Block a user