diff --git a/Makefile b/Makefile index 353fd3a8..39498d6a 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,14 @@ CC = cc OBJCOPY = objcopy CFLAGS = -O2 -pipe -Wall -Wextra -.PHONY: all install clean echfs-test ext2-test test.img +.PHONY: all limine install clean echfs-test ext2-test test.img all: limine-install +limine: + $(MAKE) -C src all + cp src/limine.bin ./ + install: all install -s limine-install $(DESTDIR)$(PREFIX)/bin/ @@ -17,11 +21,8 @@ clean: rm -f limine-install $(MAKE) -C src clean -src/limine.bin: - $(MAKE) -C src all - -limine-install: src/limine.bin limine-install.c - $(OBJCOPY) -I binary -O default src/limine.bin limine.o +limine-install: limine.bin limine-install.c + $(OBJCOPY) -I binary -O default limine.bin limine.o $(CC) $(CFLAGS) limine.o limine-install.c -o limine-install test.img: diff --git a/limine-install.c b/limine-install.c index 4441373a..a7e59b30 100644 --- a/limine-install.c +++ b/limine-install.c @@ -4,7 +4,7 @@ #include #include -extern char _binary_src_limine_bin_start[]; +extern char _binary_limine_bin_start[]; int main(int argc, char *argv[]) { if (argc < 2) { @@ -34,11 +34,11 @@ int main(int argc, char *argv[]) { // Write the bootsector from the bootloader to the device fseek(device, 0, SEEK_SET); - fwrite(&_binary_src_limine_bin_start[0], 1, 512, device); + fwrite(&_binary_limine_bin_start[0], 1, 512, device); // Write the rest of stage 2 to the device fseek(device, stage2_sect * 512, SEEK_SET); - fwrite(&_binary_src_limine_bin_start[512], 63, 512, device); + fwrite(&_binary_limine_bin_start[512], 63, 512, device); // Hardcode in the bootsector the location of stage 2 fseek(device, 0x1b0, SEEK_SET); diff --git a/limine.bin b/limine.bin new file mode 100644 index 00000000..52db9c0f Binary files /dev/null and b/limine.bin differ diff --git a/src/Makefile b/src/Makefile index efba6e88..3f04c413 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,6 @@ CC = ../toolchain/bin/i386-elf-gcc LD = ../toolchain/bin/i386-elf-gcc +OBJCOPY = ../toolchain/bin/i386-elf-objcopy CFLAGS = -flto -Os -pipe -Wall -Wextra @@ -35,8 +36,8 @@ all: limine.bin limine.bin: $(OBJ) $(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o stage2.elf - objcopy -O binary stage2.elf stage2.bin - gzip -9 < stage2.bin > stage2.bin.gz + $(OBJCOPY) -O binary stage2.elf stage2.bin + gzip -n -9 < stage2.bin > stage2.bin.gz $(MAKE) -C decompressor cd bootsect && nasm bootsect.asm -fbin -o ../limine.bin diff --git a/src/decompressor/Makefile b/src/decompressor/Makefile index f5f0f3a4..602d4457 100644 --- a/src/decompressor/Makefile +++ b/src/decompressor/Makefile @@ -1,5 +1,6 @@ CC = ../../toolchain/bin/i386-elf-gcc LD = ../../toolchain/bin/i386-elf-gcc +OBJCOPY = ../../toolchain/bin/i386-elf-objcopy CFLAGS = -flto -Os -pipe -Wall -Wextra @@ -34,7 +35,7 @@ all: decompressor.bin decompressor.bin: $(OBJ) $(LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o decompressor.elf - objcopy -O binary decompressor.elf decompressor.bin + $(OBJCOPY) -O binary decompressor.elf decompressor.bin %.o: %.c $(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@