build: De-symlink tinf

This commit is contained in:
mintsuki 2021-10-22 20:08:11 +02:00
parent 87ced72dde
commit e215f77411
9 changed files with 43 additions and 26 deletions

View File

@ -57,6 +57,7 @@ bin/limine-install:
.PHONY: clean .PHONY: clean
clean: limine-bios-clean limine-uefi-clean limine-uefi32-clean clean: limine-bios-clean limine-uefi-clean limine-uefi32-clean
$(MAKE) -C limine-install clean $(MAKE) -C limine-install clean
rm -rf bin build
.PHONY: install .PHONY: install
install: all install: all
@ -122,7 +123,7 @@ limine-uefi32-clean: stage23-uefi32-clean
.PHONY: distclean2 .PHONY: distclean2
distclean2: clean test-clean distclean2: clean test-clean
rm -rf bin build toolchain ovmf* gnu-efi rm -rf toolchain ovmf* gnu-efi
.PHONY: distclean .PHONY: distclean
distclean: distclean2 distclean: distclean2

View File

@ -45,7 +45,8 @@ INTERNAL_CFLAGS = \
-mno-sse \ -mno-sse \
-mno-sse2 \ -mno-sse2 \
-MMD \ -MMD \
-I. -I. \
-I$(BUILDDIR)/tinf
LDFLAGS ?= LDFLAGS ?=
@ -70,13 +71,21 @@ all:
builddir: builddir:
for i in $(OBJ); do mkdir -p `dirname $$i`; done for i in $(OBJ); do mkdir -p `dirname $$i`; done
$(BUILDDIR)/decompressor.bin: $(OBJ) $(BUILDDIR)/decompressor.bin: $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o
$(TOOLCHAIN_LD) $(OBJ) $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $(BUILDDIR)/decompressor.elf $(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $(BUILDDIR)/decompressor.elf
$(TOOLCHAIN_OBJCOPY) -O binary $(BUILDDIR)/decompressor.elf $@ $(TOOLCHAIN_OBJCOPY) -O binary $(BUILDDIR)/decompressor.elf $@
$(BUILDDIR)/tinf-copied: ../tinf/*
rm -rf $(BUILDDIR)/tinf
cp -r ../tinf $(BUILDDIR)/
touch $(BUILDDIR)/tinf-copied
$(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o: $(BUILDDIR)/tinf-copied
$(TOOLCHAIN_CC) $(CFLAGS) -Os $(INTERNAL_CFLAGS) -c $(@:.o=.c) -o $@
-include $(HEADER_DEPS) -include $(HEADER_DEPS)
$(BUILDDIR)/%.o: %.c $(BUILDDIR)/%.o: %.c $(BUILDDIR)/tinf-copied
$(TOOLCHAIN_CC) $(CFLAGS) -Os $(INTERNAL_CFLAGS) -c $< -o $@ $(TOOLCHAIN_CC) $(CFLAGS) -Os $(INTERNAL_CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.asm $(BUILDDIR)/%.o: %.asm

View File

@ -1,6 +1,6 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <tinf/tinf.h> #include <tinf.h>
__attribute__((noreturn)) __attribute__((noreturn))
void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) { void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) {

View File

@ -1 +0,0 @@
../tinf/

View File

@ -79,7 +79,8 @@ INTERNAL_CFLAGS := \
-DCOM_OUTPUT=$(COM_OUTPUT) \ -DCOM_OUTPUT=$(COM_OUTPUT) \
-DE9_OUTPUT=$(E9_OUTPUT) \ -DE9_OUTPUT=$(E9_OUTPUT) \
-I. \ -I. \
-I.. -I../stivale \
-I$(BUILDDIR)/tinf
ifeq ($(TARGET), bios) ifeq ($(TARGET), bios)
INTERNAL_CFLAGS += \ INTERNAL_CFLAGS += \
@ -113,8 +114,8 @@ ifeq ($(TARGET), uefi)
-mtune=generic \ -mtune=generic \
-mabi=sysv \ -mabi=sysv \
-DGNU_EFI_USE_MS_ABI \ -DGNU_EFI_USE_MS_ABI \
-I../gnu-efi/inc \ -I$(BUILDDIR)/gnu-efi/inc \
-I../gnu-efi/inc/x86_64 \ -I$(BUILDDIR)/gnu-efi/inc/x86_64 \
-fpie \ -fpie \
-mno-red-zone -mno-red-zone
endif endif
@ -128,8 +129,8 @@ ifeq ($(TARGET), uefi32)
-mtune=generic \ -mtune=generic \
-mabi=sysv \ -mabi=sysv \
-DGNU_EFI_USE_MS_ABI \ -DGNU_EFI_USE_MS_ABI \
-I../gnu-efi/inc \ -I$(BUILDDIR)/gnu-efi/inc \
-I../gnu-efi/inc/ia32 \ -I$(BUILDDIR)/gnu-efi/inc/ia32 \
-fpie -fpie
endif endif
@ -214,6 +215,14 @@ $(BUILDDIR)/font.o: font.bin
cd "`dirname $<`" && \ cd "`dirname $<`" && \
$(TOOLCHAIN_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) "`basename $<`" $@ $(TOOLCHAIN_OBJCOPY) -B i8086 -I binary -O $(OBJCOPY_ARCH) "`basename $<`" $@
$(BUILDDIR)/tinf-copied: ../tinf/*
rm -rf $(BUILDDIR)/tinf
cp -r ../tinf $(BUILDDIR)/
touch $(BUILDDIR)/tinf-copied
$(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o: $(BUILDDIR)/tinf-copied
$(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $(@:.o=.c) -o $@
ifeq ($(TARGET), bios) ifeq ($(TARGET), bios)
$(BUILDDIR)/stage2.bin.gz: $(BUILDDIR)/stage2.bin $(BUILDDIR)/stage2.bin.gz: $(BUILDDIR)/stage2.bin
@ -240,13 +249,13 @@ $(BUILDDIR)/limine_stage2only.elf: $(OBJ)
( echo "This error may mean that stage 2 was trying to use stage 3 symbols before loading stage 3" && \ ( echo "This error may mean that stage 2 was trying to use stage 3 symbols before loading stage 3" && \
false ) false )
$(BUILDDIR)/limine_nomap.elf: $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/stage2.map.o $(BUILDDIR)/limine_nomap.elf: $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/stage2.map.o
$(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker_nomap.ld -o $@ $(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker_nomap.ld -o $@
$(BUILDDIR)/limine.elf: $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/stage2.map.o $(BUILDDIR)/full.map.o $(BUILDDIR)/limine.elf: $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/stage2.map.o $(BUILDDIR)/full.map.o
$(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker.ld -o $@ $(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker.ld -o $@
$(BUILDDIR)/limine_dbg.elf: $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/stage2.map.o $(BUILDDIR)/full.map.o $(BUILDDIR)/limine_dbg.elf: $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/stage2.map.o $(BUILDDIR)/full.map.o
$(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker_dbg.ld -o $@ $(TOOLCHAIN_LD) $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker_dbg.ld -o $@
endif endif
@ -271,12 +280,12 @@ $(BUILDDIR)/BOOTX64.EFI: $(BUILDDIR)/limine_efi.elf
$(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-x86_64.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a: $(BUILDDIR)/gnu-efi $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-x86_64.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a: $(BUILDDIR)/gnu-efi
$(MAKE) -C $(BUILDDIR)/gnu-efi/gnuefi CC="$(TOOLCHAIN_CC) -m64 -march=x86-64 -mtune=generic" AR="$(TOOLCHAIN_AR)" ARCH=x86_64 $(MAKE) -C $(BUILDDIR)/gnu-efi/gnuefi CC="$(TOOLCHAIN_CC) -m64 -march=x86-64 -mtune=generic" AR="$(TOOLCHAIN_AR)" ARCH=x86_64
$(BUILDDIR)/limine_efi_nomap.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-x86_64.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/limine_efi_nomap.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-x86_64.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o
$(TOOLCHAIN_LD) \ $(TOOLCHAIN_LD) \
-Tlinker_uefi_nomap.ld \ -Tlinker_uefi_nomap.ld \
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@ $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
$(BUILDDIR)/limine_efi.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-x86_64.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/full.map.o $(BUILDDIR)/limine_efi.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-x86_64.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/full.map.o
$(TOOLCHAIN_LD) \ $(TOOLCHAIN_LD) \
-Tlinker_uefi.ld \ -Tlinker_uefi.ld \
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@ $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
@ -296,12 +305,12 @@ $(BUILDDIR)/BOOTIA32.EFI: $(BUILDDIR)/limine_efi.elf
$(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-ia32.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a: $(BUILDDIR)/gnu-efi $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-ia32.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a: $(BUILDDIR)/gnu-efi
$(MAKE) -C $(BUILDDIR)/gnu-efi/gnuefi CC="$(TOOLCHAIN_CC) -m32 -march=i386 -mtune=generic" AR="$(TOOLCHAIN_AR)" ARCH=ia32 $(MAKE) -C $(BUILDDIR)/gnu-efi/gnuefi CC="$(TOOLCHAIN_CC) -m32 -march=i386 -mtune=generic" AR="$(TOOLCHAIN_AR)" ARCH=ia32
$(BUILDDIR)/limine_efi_nomap.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-ia32.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/limine_efi_nomap.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-ia32.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o
$(TOOLCHAIN_LD) \ $(TOOLCHAIN_LD) \
-Tlinker_uefi32_nomap.ld \ -Tlinker_uefi32_nomap.ld \
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@ $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
$(BUILDDIR)/limine_efi.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-ia32.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/full.map.o $(BUILDDIR)/limine_efi.elf: $(BUILDDIR)/gnu-efi/gnuefi/crt0-efi-ia32.o $(BUILDDIR)/gnu-efi/gnuefi/libgnuefi.a $(OBJ) $(BUILDDIR)/tinf/tinfgzip.o $(BUILDDIR)/tinf/tinflate.o $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/full.map.o
$(TOOLCHAIN_LD) \ $(TOOLCHAIN_LD) \
-Tlinker_uefi32.ld \ -Tlinker_uefi32.ld \
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@ $^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
@ -311,17 +320,17 @@ endif
-include $(HEADER_DEPS) -include $(HEADER_DEPS)
ifeq ($(TARGET), uefi) ifeq ($(TARGET), uefi)
$(BUILDDIR)/%.o: %.c $(BUILDDIR)/gnu-efi $(BUILDDIR)/%.o: %.c $(BUILDDIR)/tinf-copied $(BUILDDIR)/gnu-efi
$(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@ $(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
endif endif
ifeq ($(TARGET), uefi32) ifeq ($(TARGET), uefi32)
$(BUILDDIR)/%.o: %.c $(BUILDDIR)/gnu-efi $(BUILDDIR)/%.o: %.c $(BUILDDIR)/tinf-copied $(BUILDDIR)/gnu-efi
$(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@ $(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
endif endif
ifeq ($(TARGET), bios) ifeq ($(TARGET), bios)
$(BUILDDIR)/%.o: %.c $(BUILDDIR)/%.o: %.c $(BUILDDIR)/tinf-copied
$(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@ $(TOOLCHAIN_CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
endif endif

View File

@ -8,7 +8,7 @@
#include <mm/pmm.h> #include <mm/pmm.h>
#include <lib/print.h> #include <lib/print.h>
#include <pxe/tftp.h> #include <pxe/tftp.h>
#include <tinf/tinf.h> #include <tinf.h>
// A URI takes the form of: resource://root/path // A URI takes the form of: resource://root/path
// The following function splits up a URI into its componenets // The following function splits up a URI into its componenets

View File

@ -21,7 +21,7 @@
#include <fs/file.h> #include <fs/file.h>
#include <mm/vmm.h> #include <mm/vmm.h>
#include <mm/pmm.h> #include <mm/pmm.h>
#include <stivale/stivale.h> #include <stivale.h>
#include <drivers/vga_textmode.h> #include <drivers/vga_textmode.h>
#define REPORTED_ADDR(PTR) \ #define REPORTED_ADDR(PTR) \

View File

@ -21,7 +21,7 @@
#include <sys/lapic.h> #include <sys/lapic.h>
#include <fs/file.h> #include <fs/file.h>
#include <mm/pmm.h> #include <mm/pmm.h>
#include <stivale/stivale2.h> #include <stivale2.h>
#include <pxe/tftp.h> #include <pxe/tftp.h>
#include <drivers/edid.h> #include <drivers/edid.h>
#include <drivers/vga_textmode.h> #include <drivers/vga_textmode.h>

View File

@ -1 +0,0 @@
../tinf/