Compare commits

...

44 Commits

Author SHA1 Message Date
mintsuki
f5cfd6710d Binary release v2.33 2021-07-11 00:21:40 +00:00
mintsuki
a4be378fad Binary release v2.32 2021-07-10 12:31:57 +00:00
mintsuki
f024767359 Binary release v2.31 2021-07-10 00:57:01 +00:00
mintsuki
7deacc5dc4 Binary release v2.30 2021-07-08 16:22:31 +00:00
mintsuki
df3429aeb4 Binary release v2.29 2021-07-07 08:22:01 +00:00
mintsuki
f3df8c34ca Binary release v2.28 2021-07-07 04:18:19 +00:00
mintsuki
4a250dd367 Binary release v2.27 2021-07-03 00:08:24 +00:00
mintsuki
239a9cad62 Binary release v2.26 2021-06-30 21:35:07 +00:00
mintsuki
97be83460a Binary release v2.25 2021-06-30 17:07:45 +00:00
mintsuki
2862a26145 Binary release v2.24 2021-06-24 23:36:35 +00:00
mintsuki
57f875ff80 Binary release v2.23 2021-06-22 12:07:02 +00:00
mintsuki
00bbd375d9 Binary release v2.22 2021-06-15 01:28:01 +00:00
mintsuki
9249b5058e Binary release v2.21 2021-06-12 13:57:07 +00:00
mintsuki
8aeca4502a Binary release v2.20 2021-06-07 22:23:08 +00:00
mintsuki
3ac3c7acba Binary release v2.19 2021-06-02 14:49:27 +00:00
mintsuki
e076a3a94f Binary release v2.18 2021-06-01 20:16:24 +00:00
mintsuki
9f837d47f2 Binary release v2.17 2021-06-01 18:19:25 +00:00
mintsuki
ef6e9305fb Binary release v2.16 2021-05-23 03:28:46 +00:00
mintsuki
e9312ed0d6 Binary release v2.15 2021-05-22 08:52:08 +00:00
mintsuki
463c2658dd Binary release v2.14 2021-05-20 21:44:23 +00:00
mintsuki
33c5b0d1fc Binary release v2.13 2021-05-19 23:33:33 +00:00
mintsuki
2d5b927e9e Binary release v2.12 2021-05-19 07:10:17 +00:00
mintsuki
fe885fdf97 Binary release v2.11 2021-05-19 06:49:06 +00:00
mintsuki
7efd20e4db Binary release v2.10 2021-05-13 01:11:47 +00:00
mintsuki
d0c389d185 Binary release v2.9 2021-05-12 11:27:19 +00:00
mintsuki
22afa3656b Binary release v2.8 2021-05-11 05:10:02 +00:00
mintsuki
fb56f9d681 Binary release v2.7 2021-05-06 22:46:04 +00:00
mintsuki
ab4119ce7d Binary release v2.6 2021-05-06 03:38:45 +00:00
mintsuki
9357e39c0e Binary release v2.5 2021-05-04 23:12:53 +00:00
mintsuki
436ab302d8 Binary release v2.4 2021-05-02 23:24:18 +00:00
mintsuki
278a5be490 Binary release v2.3.9 2021-04-30 00:25:06 +00:00
mintsuki
3b3198b5d5 Binary release v2.3.8 2021-04-28 22:59:49 +00:00
mintsuki
9702acab01 Binary release v2.3.7 2021-04-28 18:33:59 +00:00
mintsuki
50a6c0228e Binary release v2.3.6 2021-04-24 21:11:59 +00:00
mintsuki
d7e1cccd49 Binary release v2.3.5 2021-04-20 12:47:39 +00:00
mintsuki
38a17c5653 Binary release v2.3.4 2021-04-20 09:02:46 +00:00
mintsuki
1648873a11 Binary release v2.3.3 2021-04-20 08:32:29 +00:00
mintsuki
6a5c7fb13a Binary release v2.3.2 2021-04-20 05:05:37 +00:00
mintsuki
c934aa50bb Binary release v2.3.1 2021-04-16 11:03:16 +00:00
mintsuki
e1c6ab55e6 Binary release v2.3 2021-04-15 02:54:38 +00:00
mintsuki
ed690885b9 Binary release v2.2.6 2021-04-11 08:33:26 +00:00
mintsuki
11414ed6e3 Binary release v2.2.5 2021-04-11 00:49:33 +00:00
mintsuki
8423a5007f Binary release v2.2.4 2021-04-10 23:53:29 +00:00
mintsuki
0c98d680e8 Binary release v2.2.3 2021-04-10 21:31:58 +00:00
12 changed files with 147 additions and 54 deletions

Binary file not shown.

View File

@@ -4,7 +4,6 @@ OBJCOPY = objcopy
PREFIX = /usr/local
DESTDIR =
OBJCOPY_ARCH = default
LIMINE_HDD_BIN = limine-hdd.bin
BUILD_DIR = $(shell realpath .)
@@ -15,22 +14,18 @@ CFLAGS = -O2 -pipe -Wall -Wextra
all: limine-install
install: all
install -d $(DESTDIR)$(PREFIX)/bin
install -s limine-install $(DESTDIR)$(PREFIX)/bin/
install -d $(DESTDIR)$(PREFIX)/share
install -d $(DESTDIR)$(PREFIX)/share/limine
install -m 644 limine.sys $(DESTDIR)$(PREFIX)/share/limine/
install -m 644 limine-cd.bin $(DESTDIR)$(PREFIX)/share/limine/
install -m 644 limine-eltorito-efi.bin $(DESTDIR)$(PREFIX)/share/limine/
install -m 644 limine-pxe.bin $(DESTDIR)$(PREFIX)/share/limine/
install -m 644 BOOTX64.EFI $(DESTDIR)$(PREFIX)/share/limine/
install -d "$(DESTDIR)$(PREFIX)/bin"
install -s limine-install "$(DESTDIR)$(PREFIX)/bin/"
install -d "$(DESTDIR)$(PREFIX)/share"
install -d "$(DESTDIR)$(PREFIX)/share/limine"
install -m 644 limine.sys "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 limine-cd.bin "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 limine-eltorito-efi.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
install -m 644 limine-pxe.bin "$(DESTDIR)$(PREFIX)/share/limine/"
install -m 644 BOOTX64.EFI "$(DESTDIR)$(PREFIX)/share/limine/"
clean:
rm -f limine-hdd.o limine-install limine-install.exe
rm -f limine-install limine-install.exe
limine-install: limine-install.c limine-hdd.o
$(CC) $(CFLAGS) -std=c11 $^ -o $@
limine-hdd.o: $(LIMINE_HDD_BIN)
cd `dirname $^` && \
$(OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) `basename $^` $(BUILD_DIR)/$@
limine-install: limine-install.c inc.S $(LIMINE_HDD_BIN)
$(CC) $(CFLAGS) -std=c11 -DLIMINE_HDD_BIN='"$(LIMINE_HDD_BIN)"' limine-install.c inc.S -o $@

33
inc.S Normal file
View File

@@ -0,0 +1,33 @@
#if defined (__APPLE__)
.data
.global __binary_limine_hdd_bin_start
__binary_limine_hdd_bin_start:
.incbin LIMINE_HDD_BIN
.global __binary_limine_hdd_bin_end
__binary_limine_hdd_bin_end:
#elif defined (__MINGW32__)
.section .data
.global __binary_limine_hdd_bin_start
__binary_limine_hdd_bin_start:
.incbin LIMINE_HDD_BIN
.global __binary_limine_hdd_bin_end
__binary_limine_hdd_bin_end:
#elif defined (__linux__) || defined (__unix__)
#if defined (__ELF__)
.section .note.GNU-stack, "", %progbits
#endif
.section .data
.global _binary_limine_hdd_bin_start
_binary_limine_hdd_bin_start:
.incbin LIMINE_HDD_BIN
.global _binary_limine_hdd_bin_end
_binary_limine_hdd_bin_end:
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -261,23 +261,14 @@ static bool _device_write(const void *buffer, uint64_t loc, size_t count) {
goto cleanup; \
} while (0)
#ifdef __MINGW32__
extern uint8_t binary_limine_hdd_bin_start[], binary_limine_hdd_bin_end[];
#else
extern uint8_t _binary_limine_hdd_bin_start[], _binary_limine_hdd_bin_end[];
#endif
int main(int argc, char *argv[]) {
int ok = 1;
#ifdef __MINGW32__
uint8_t *bootloader_img = binary_limine_hdd_bin_start;
size_t bootloader_file_size =
(size_t)binary_limine_hdd_bin_end - (size_t)binary_limine_hdd_bin_start;
#else
int force_mbr = 0;
uint8_t *bootloader_img = _binary_limine_hdd_bin_start;
size_t bootloader_file_size =
(size_t)_binary_limine_hdd_bin_end - (size_t)_binary_limine_hdd_bin_start;
#endif
uint8_t orig_mbr[70], timestamp[6];
if (sizeof(off_t) != 8) {
@@ -290,6 +281,12 @@ int main(int argc, char *argv[]) {
goto cleanup;
}
if (argc >= 3) {
if (strcmp(argv[2], "--force-mbr") == 0) {
force_mbr = 1;
}
}
device = open(argv[1], O_RDWR);
if (device == -1) {
perror("ERROR");
@@ -307,10 +304,15 @@ int main(int argc, char *argv[]) {
for (size_t i = 0; i < sizeof(lb_guesses) / sizeof(uint64_t); i++) {
device_read(&gpt_header, lb_guesses[i], sizeof(struct gpt_table_header));
if (!strncmp(gpt_header.signature, "EFI PART", 8)) {
gpt = 1;
lb_size = lb_guesses[i];
fprintf(stderr, "Installing to GPT. Logical block size of %" PRIu64 " bytes.\n",
lb_guesses[i]);
if (!force_mbr) {
gpt = 1;
fprintf(stderr, "Installing to GPT. Logical block size of %" PRIu64 " bytes.\n",
lb_guesses[i]);
} else {
memset(&gpt_header, 0, sizeof(struct gpt_table_header));
device_write(&gpt_header, lb_guesses[i], sizeof(struct gpt_table_header));
}
break;
}
}
@@ -336,45 +338,108 @@ int main(int argc, char *argv[]) {
uint16_t hint = 0;
device_read(&hint, 218, sizeof(uint16_t));
if (hint != 0)
mbr = 0;
if (hint != 0) {
if (!force_mbr) {
mbr = 0;
} else {
hint = 0;
device_write(&hint, 218, sizeof(uint16_t));
}
}
device_read(&hint, 444, sizeof(uint16_t));
if (hint != 0 && hint != 0x5a5a)
mbr = 0;
if (hint != 0 && hint != 0x5a5a) {
if (!force_mbr) {
mbr = 0;
} else {
hint = 0;
device_write(&hint, 444, sizeof(uint16_t));
}
}
device_read(&hint, 510, sizeof(uint16_t));
if (hint != 0xaa55)
mbr = 0;
if (hint != 0xaa55) {
if (!force_mbr) {
mbr = 0;
} else {
hint = 0xaa55;
device_write(&hint, 510, sizeof(uint16_t));
}
}
device_read(&hint, 446, sizeof(uint8_t));
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80)
mbr = 0;
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80) {
if (!force_mbr) {
mbr = 0;
} else {
hint = (uint8_t)hint & 0x80 ? 0x80 : 0x00;
device_write(&hint, 446, sizeof(uint8_t));
}
}
device_read(&hint, 462, sizeof(uint8_t));
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80)
mbr = 0;
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80) {
if (!force_mbr) {
mbr = 0;
} else {
hint = (uint8_t)hint & 0x80 ? 0x80 : 0x00;
device_write(&hint, 462, sizeof(uint8_t));
}
}
device_read(&hint, 478, sizeof(uint8_t));
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80)
mbr = 0;
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80) {
if (!force_mbr) {
mbr = 0;
} else {
hint = (uint8_t)hint & 0x80 ? 0x80 : 0x00;
device_write(&hint, 478, sizeof(uint8_t));
}
}
device_read(&hint, 494, sizeof(uint8_t));
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80)
mbr = 0;
if ((uint8_t)hint != 0x00 && (uint8_t)hint != 0x80) {
if (!force_mbr) {
mbr = 0;
} else {
hint = (uint8_t)hint & 0x80 ? 0x80 : 0x00;
device_write(&hint, 494, sizeof(uint8_t));
}
}
char hintc[64];
device_read(hintc, 4, 8);
if (memcmp(hintc, "_ECH_FS_", 8) == 0)
mbr = 0;
if (memcmp(hintc, "_ECH_FS_", 8) == 0) {
if (!force_mbr) {
mbr = 0;
} else {
memset(hintc, 0, 8);
device_write(hintc, 4, 8);
}
}
device_read(hintc, 54, 3);
if (memcmp(hintc, "FAT", 3) == 0)
mbr = 0;
if (memcmp(hintc, "FAT", 3) == 0) {
if (!force_mbr) {
mbr = 0;
} else {
memset(hintc, 0, 5);
device_write(hintc, 54, 5);
}
}
device_read(&hint, 1080, sizeof(uint16_t));
if (hint == 0xef53)
mbr = 0;
if (hint == 0xef53) {
if (!force_mbr) {
mbr = 0;
} else {
hint = 0;
device_write(&hint, 1080, sizeof(uint16_t));
}
}
}
if (gpt == 0 && mbr == 0) {
fprintf(stderr, "ERROR: Could not determine if the device has a valid partition table.\n");
fprintf(stderr, " Please ensure the device has a valid MBR or GPT.\n");
fprintf(stderr, " Alternatively, pass `--force-mbr` at the end of the command to\n");
fprintf(stderr, " override these checks. ONLY DO THIS AT YOUR OWN RISK, DATA LOSS\n");
fprintf(stderr, " MAY OCCUR!\n");
goto cleanup;
}
@@ -421,7 +486,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "GPT partition NOT specified. Attempting GPT embedding.\n");
ssize_t max_partition_entry_used = -1;
for (ssize_t i = 0; i < gpt_header.number_of_partition_entries; i++) {
for (ssize_t i = 0; i < (ssize_t)gpt_header.number_of_partition_entries; i++) {
struct gpt_entry gpt_entry;
device_read(&gpt_entry,
(gpt_header.partition_entry_lba * lb_size)
@@ -541,9 +606,9 @@ int main(int argc, char *argv[]) {
if (!device_flush_cache())
goto cleanup;
fprintf(stderr, "WARNING: 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");
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");
fprintf(stderr, "Limine installed successfully!\n");

Binary file not shown.

Binary file not shown.