limine-install: More macOS friendliness
This commit is contained in:
parent
c3db6d0c41
commit
8c28d8ff3d
|
@ -47,7 +47,7 @@ jobs:
|
|||
run: make -C limine-install clean
|
||||
|
||||
- name: Build limine-install-linux-x86_32
|
||||
run: make OBJCOPY_ARCH="elf32-i386" CC="gcc -m32" CFLAGS="-O2 -pipe -static" bin/limine-install
|
||||
run: make CC="gcc -m32" CFLAGS="-O2 -pipe -static" bin/limine-install
|
||||
|
||||
- name: Strip limine-install-linux-x86_32
|
||||
run: strip bin/limine-install
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
run: make -C limine-install clean
|
||||
|
||||
- name: Build limine-install-win32
|
||||
run: make CC="i686-w64-mingw32-gcc" OBJCOPY="i686-w64-mingw32-objcopy" CFLAGS="-O2 -pipe" bin/limine-install
|
||||
run: make CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" bin/limine-install
|
||||
|
||||
- name: Strip limine-install-win32
|
||||
run: i686-w64-mingw32-strip bin/limine-install.exe
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
/**/*.o
|
||||
/**/*.d
|
||||
/**/*.a
|
||||
/**/*.exe
|
||||
/**/*.EFI
|
||||
/**/*.bin
|
||||
/**/*.bin.gz
|
||||
|
|
|
@ -4,7 +4,6 @@ OBJCOPY = objcopy
|
|||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
|
||||
OBJCOPY_ARCH = default
|
||||
LIMINE_HDD_BIN = limine-hdd.bin
|
||||
BUILD_DIR = $(shell realpath .)
|
||||
|
||||
|
@ -26,11 +25,7 @@ install: all
|
|||
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: $(shell echo "$(LIMINE_HDD_BIN)" | sed 's/ /\\ /g')
|
||||
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 $@
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
#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__)
|
||||
|
||||
.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
|
|
@ -261,23 +261,13 @@ 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
|
||||
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) {
|
||||
|
@ -421,7 +411,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)
|
||||
|
|
Loading…
Reference in New Issue