misc: Move limine-install to own directory and provide source and Makefile for it in binary releases

This commit is contained in:
mintsuki 2021-03-17 18:38:47 +01:00
parent f6aab27f23
commit 0a1dfa766e
5 changed files with 40 additions and 22 deletions

View File

@ -34,8 +34,8 @@ jobs:
- name: Build the bootloader - name: Build the bootloader
run: make run: make
- name: Remove limine-hdd.o - name: Clean limine-install
run: rm limine-hdd.o run: make -C limine-install clean
- name: Build limine-install-linux-x86_64 - name: Build limine-install-linux-x86_64
run: make CFLAGS="-O2 -pipe -static" bin/limine-install run: make CFLAGS="-O2 -pipe -static" bin/limine-install
@ -46,8 +46,8 @@ jobs:
- name: Rename limine-install-linux-x86_64 - name: Rename limine-install-linux-x86_64
run: mv bin/limine-install bin/limine-install-linux-x86_64 run: mv bin/limine-install bin/limine-install-linux-x86_64
- name: Remove limine-hdd.o - name: Clean limine-install
run: rm limine-hdd.o run: make -C limine-install clean
- name: Build limine-install-linux-x86_32 - 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 OBJCOPY_ARCH="elf32-i386" CC="gcc -m32" CFLAGS="-O2 -pipe -static" bin/limine-install
@ -58,8 +58,8 @@ jobs:
- name: Rename limine-install-linux-x86_32 - name: Rename limine-install-linux-x86_32
run: mv bin/limine-install bin/limine-install-linux-x86_32 run: mv bin/limine-install bin/limine-install-linux-x86_32
- name: Remove limine-hdd.o - name: Clean limine-install
run: rm limine-hdd.o run: make -C limine-install clean
- name: Build limine-install-win32 - 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" OBJCOPY="i686-w64-mingw32-objcopy" CFLAGS="-O2 -pipe" bin/limine-install
@ -70,8 +70,11 @@ jobs:
- name: Rename limine-install-win32 - name: Rename limine-install-win32
run: mv bin/limine-install.exe bin/limine-install-win32.exe run: mv bin/limine-install.exe bin/limine-install-win32.exe
- name: Remove bin/limine-hdd.bin - name: Clean limine-install
run: rm bin/limine-hdd.bin run: make -C limine-install clean
- name: Copy limine-install to bin
run: cp limine-install/* bin/
- name: Push binaries to binary branch - name: Push binaries to binary branch
run: | run: |

View File

@ -1,27 +1,22 @@
CC = cc CC = cc
OBJCOPY = objcopy
OBJCOPY_ARCH = default
CFLAGS = -O2 -pipe -Wall -Wextra
PREFIX = /usr/local PREFIX = /usr/local
DESTDIR = DESTDIR =
PATH := $(shell pwd)/toolchain/bin:$(PATH) PATH := $(shell pwd)/toolchain/bin:$(PATH)
.PHONY: all clean install distclean limine-bios limine-uefi limine-bios-clean limine-uefi-clean stage23-bios stage23-bios-clean stage23-uefi stage23-uefi-clean decompressor decompressor-clean toolchain test.hdd echfs-test ext2-test fat16-test fat32-test iso9660-test pxe-test uefi-test hybrid-iso9660-test .PHONY: all bin/limine-install clean install distclean limine-bios limine-uefi limine-bios-clean limine-uefi-clean stage23-bios stage23-bios-clean stage23-uefi stage23-uefi-clean decompressor decompressor-clean toolchain test.hdd echfs-test ext2-test fat16-test fat32-test iso9660-test pxe-test uefi-test hybrid-iso9660-test
all: all:
$(MAKE) limine-uefi $(MAKE) limine-uefi
$(MAKE) limine-bios $(MAKE) limine-bios
$(MAKE) bin/limine-install $(MAKE) bin/limine-install
bin/limine-install: limine-install.c limine-hdd.o bin/limine-install:
$(CC) $(CFLAGS) -std=c11 limine-hdd.o limine-install.c -o $@ $(MAKE) -C limine-install LIMINE_HDD_BIN=`realpath bin`/limine-hdd.bin
cp limine-install/limine-install bin/
limine-hdd.o: bin/limine-hdd.bin
$(OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) bin/limine-hdd.bin $@
clean: limine-bios-clean limine-uefi-clean clean: limine-bios-clean limine-uefi-clean
rm -f limine-hdd.o $(MAKE) -C limine-install clean
install: all install: all
install -d $(DESTDIR)$(PREFIX)/bin install -d $(DESTDIR)$(PREFIX)/bin

20
limine-install/Makefile Normal file
View File

@ -0,0 +1,20 @@
OBJCOPY = objcopy
OBJCOPY_ARCH = default
LIMINE_HDD_BIN = limine-hdd.bin
BUILD_DIR = $(shell realpath .)
CFLAGS = -O2 -pipe -Wall -Wextra
.PHONY: all clean
all: limine-install
clean:
rm -f limine-hdd.o limine-install
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)/$@

BIN
limine-install/limine-install Executable file

Binary file not shown.

View File

@ -262,9 +262,9 @@ static bool _device_write(const void *buffer, uint64_t loc, size_t count) {
} while (0) } while (0)
#ifdef __MINGW32__ #ifdef __MINGW32__
extern uint8_t binary_bin_limine_hdd_bin_start[], binary_bin_limine_hdd_bin_end[]; extern uint8_t binary_limine_hdd_bin_start[], binary_limine_hdd_bin_end[];
#else #else
extern uint8_t _binary_bin_limine_hdd_bin_start[], _binary_bin_limine_hdd_bin_end[]; extern uint8_t _binary_limine_hdd_bin_start[], _binary_limine_hdd_bin_end[];
#endif #endif
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
@ -274,9 +274,9 @@ int main(int argc, char *argv[]) {
size_t bootloader_file_size = size_t bootloader_file_size =
(size_t)binary_bin_limine_hdd_bin_end - (size_t)binary_bin_limine_hdd_bin_start; (size_t)binary_bin_limine_hdd_bin_end - (size_t)binary_bin_limine_hdd_bin_start;
#else #else
uint8_t *bootloader_img = _binary_bin_limine_hdd_bin_start; uint8_t *bootloader_img = _binary_limine_hdd_bin_start;
size_t bootloader_file_size = size_t bootloader_file_size =
(size_t)_binary_bin_limine_hdd_bin_end - (size_t)_binary_bin_limine_hdd_bin_start; (size_t)_binary_limine_hdd_bin_end - (size_t)_binary_limine_hdd_bin_start;
#endif #endif
uint8_t orig_mbr[70], timestamp[6]; uint8_t orig_mbr[70], timestamp[6];