build: BIOS stage2only build improvements

This commit is contained in:
mintsuki 2022-07-18 21:02:44 +02:00
parent 22d45a5428
commit 6eafb4fc03
5 changed files with 37 additions and 36 deletions

View File

@ -148,6 +148,7 @@ override ASM32_FILES := $(shell find ./ -type f -name '*.asm_ia32')
override ASMB_FILES := $(shell find ./ -type f -name '*.asm_bios_ia32')
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM32_FILES:.asm_ia32=.o) $(ASMB_FILES:.asm_bios_ia32=.o) $(ASMX86_FILES:.asm_x86=.o))
override OBJ_S2 := $(filter %.s2.o,$(OBJ))
endif
ifeq ($(TARGET), uefi-x86-64)
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
@ -227,7 +228,7 @@ $(call MKESCAPE,$(BUILDDIR))/linker_stage2only.ld: linker_bios.ld.in
mkdir -p '$(call SHESCAPE,$(BUILDDIR))'
$(CROSS_CC) -x c -E -P -undef -DLINKER_STAGE2ONLY linker_bios.ld.in -o '$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld'
$(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf: $(OBJ) ../libgcc-binaries/libgcc-i686.a $(call MKESCAPE,$(BUILDDIR))/tinf/tinfgzip.o $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o $(call MKESCAPE,$(BUILDDIR))/font.o $(call MKESCAPE,$(BUILDDIR))/sys/smp_trampoline.o
$(call MKESCAPE,$(BUILDDIR))/limine_stage2only.elf: $(OBJ_S2) ../libgcc-binaries/libgcc-i686.a
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld'
$(CROSS_LD) '$(call OBJESCAPE,$^)' $(CROSS_LDFLAGS) $(INTERNAL_LDFLAGS) -T'$(call SHESCAPE,$(BUILDDIR))/linker_stage2only.ld' -o '$(call SHESCAPE,$@)' || \
( echo "This error may mean that stage 2 was trying to use stage 3 symbols before loading stage 3" && \

View File

@ -13,8 +13,6 @@
extern void reset_term(void);
extern void set_cursor_pos_helper(size_t x, size_t y);
bool early_term = false;
void term_deinit(void) {
switch (term_backend) {
case VBE:
@ -82,39 +80,6 @@ void term_vbe(size_t width, size_t height) {
// Tries to implement this standard for terminfo
// https://man7.org/linux/man-pages/man4/console_codes.4.html
no_unwind int current_video_mode = -1;
int term_backend = NOT_READY;
size_t term_rows, term_cols;
bool term_runtime = false;
void (*raw_putchar)(uint8_t c);
void (*clear)(bool move);
void (*enable_cursor)(void);
bool (*disable_cursor)(void);
void (*set_cursor_pos)(size_t x, size_t y);
void (*get_cursor_pos)(size_t *x, size_t *y);
void (*set_text_fg)(size_t fg);
void (*set_text_bg)(size_t bg);
void (*set_text_fg_bright)(size_t fg);
void (*set_text_bg_bright)(size_t bg);
void (*set_text_fg_default)(void);
void (*set_text_bg_default)(void);
bool (*scroll_disable)(void);
void (*scroll_enable)(void);
void (*term_move_character)(size_t new_x, size_t new_y, size_t old_x, size_t old_y);
void (*term_scroll)(void);
void (*term_revscroll)(void);
void (*term_swap_palette)(void);
void (*term_save_state)(void);
void (*term_restore_state)(void);
void (*term_double_buffer_flush)(void);
uint64_t (*term_context_size)(void);
void (*term_context_save)(uint64_t ptr);
void (*term_context_restore)(uint64_t ptr);
void (*term_full_refresh)(void);
uint64_t term_arg = 0;
void (*term_callback)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t) = NULL;

View File

@ -5,6 +5,41 @@
#include <lib/blib.h>
#include <lib/real.h>
bool early_term = false;
no_unwind int current_video_mode = -1;
int term_backend = NOT_READY;
size_t term_rows, term_cols;
bool term_runtime = false;
void (*raw_putchar)(uint8_t c);
void (*clear)(bool move);
void (*enable_cursor)(void);
bool (*disable_cursor)(void);
void (*set_cursor_pos)(size_t x, size_t y);
void (*get_cursor_pos)(size_t *x, size_t *y);
void (*set_text_fg)(size_t fg);
void (*set_text_bg)(size_t bg);
void (*set_text_fg_bright)(size_t fg);
void (*set_text_bg_bright)(size_t bg);
void (*set_text_fg_default)(void);
void (*set_text_bg_default)(void);
bool (*scroll_disable)(void);
void (*scroll_enable)(void);
void (*term_move_character)(size_t new_x, size_t new_y, size_t old_x, size_t old_y);
void (*term_scroll)(void);
void (*term_revscroll)(void);
void (*term_swap_palette)(void);
void (*term_save_state)(void);
void (*term_restore_state)(void);
void (*term_double_buffer_flush)(void);
uint64_t (*term_context_size)(void);
void (*term_context_save)(uint64_t ptr);
void (*term_context_restore)(uint64_t ptr);
void (*term_full_refresh)(void);
// --- fallback ---
#if bios == 1