misc: Better integration of aarch64 port and test mechanism

This commit is contained in:
mintsuki 2022-09-05 02:17:53 +02:00
parent 86ebf0b453
commit ebbf8d7bed
6 changed files with 45 additions and 38 deletions

View File

@ -93,7 +93,6 @@ jobs:
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
prerelease: true
body_path: rel_notes.txt body_path: rel_notes.txt
files: | files: |
limine-*.tar.* limine-*.tar.*

View File

@ -152,7 +152,7 @@ ifneq ($(BUILD_LIMINE_DEPLOY),no)
$(MAKE) limine-deploy $(MAKE) limine-deploy
endif endif
$(call MKESCAPE,$(BINDIR))/limine-cd-efi.bin: $(if @BUILD_UEFI_IA32@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if @BUILD_UEFI_X86_64@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI) $(call MKESCAPE,$(BINDIR))/limine-cd-efi.bin: $(if @BUILD_UEFI_IA32@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if @BUILD_UEFI_X86_64@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI) $(if @BUILD_UEFI_AARCH64@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI)
ifneq ($(BUILD_CD_EFI),no) ifneq ($(BUILD_CD_EFI),no)
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
rm -f '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' rm -f '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
@ -160,6 +160,8 @@ ifneq ($(BUILD_CD_EFI),no)
( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' -f 1440 :: && \ ( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' -f 1440 :: && \
mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' ::/EFI && \ mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' ::/EFI && \
mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' ::/EFI/BOOT && \ mmd -D s -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' ::/EFI/BOOT && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' ::/EFI/BOOT ) || true ) && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ] && \ ( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ::/EFI/BOOT ) || true ) && \ mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' ::/EFI/BOOT ) || true ) && \
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' ] && \ ( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' ] && \
@ -499,13 +501,13 @@ pxe-test:
sudo cp -rv test/* test_image/boot/ sudo cp -rv test/* test_image/boot/
qemu-system-x86_64 -smp 4 -netdev user,id=n0,tftp=./test_image,bootfile=boot/limine-pxe.bin -device rtl8139,netdev=n0,mac=00:00:00:11:11:11 -debugcon stdio qemu-system-x86_64 -smp 4 -netdev user,id=n0,tftp=./test_image,bootfile=boot/limine-pxe.bin -device rtl8139,netdev=n0,mac=00:00:00:11:11:11 -debugcon stdio
.PHONY: uefi-test .PHONY: uefi-x86-64-test
uefi-test: uefi-x86-64-test:
$(MAKE) ovmf-x64 $(MAKE) ovmf-x64
$(MAKE) test-clean $(MAKE) test-clean
$(MAKE) test.hdd $(MAKE) test.hdd
$(MAKE) limine-uefi-x86-64 $(MAKE) limine-uefi-x86-64
$(MAKE) -C test $(MAKE) -C test CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/x86_64-toolchain.mk'
rm -rf test_image/ rm -rf test_image/
mkdir test_image mkdir test_image
sudo losetup -Pf --show test.hdd > loopback_dev sudo losetup -Pf --show test.hdd > loopback_dev
@ -529,7 +531,7 @@ uefi-aa64-test:
$(MAKE) test-clean $(MAKE) test-clean
$(MAKE) test.hdd $(MAKE) test.hdd
$(MAKE) limine-uefi-aarch64 $(MAKE) limine-uefi-aarch64
$(MAKE) -C test $(MAKE) -C test CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/aarch64-toolchain.mk'
rm -rf test_image/ rm -rf test_image/
mkdir test_image mkdir test_image
sudo losetup -Pf --show test.hdd > loopback_dev sudo losetup -Pf --show test.hdd > loopback_dev
@ -553,7 +555,7 @@ uefi-ia32-test:
$(MAKE) test-clean $(MAKE) test-clean
$(MAKE) test.hdd $(MAKE) test.hdd
$(MAKE) limine-uefi-ia32 $(MAKE) limine-uefi-ia32
$(MAKE) -C test $(MAKE) -C test CROSS_FILE='$(call SHESCAPE,$(BUILDDIR))/cross-files/x86_64-toolchain.mk'
rm -rf test_image/ rm -rf test_image/
mkdir test_image mkdir test_image
sudo losetup -Pf --show test.hdd > loopback_dev sudo losetup -Pf --show test.hdd > loopback_dev

View File

@ -1,11 +1,13 @@
CC = cc include $(CROSS_FILE)
CFLAGS = -O2 -g -Wall -Wextra -Wpedantic
override CC := $(CROSS_CC)
CFLAGS = -O2 -g -Wall -Wextra
LDFLAGS = LDFLAGS =
LD = ld override LD := $(CROSS_LD)
QEMU = qemu-system-x86_64 override QEMU := qemu-system-x86_64
QEMUFLAGS = -m 1G -enable-kvm -cpu host QEMUFLAGS = -m 1G -enable-kvm -cpu host
INTERNALLDFLAGS := \ override INTERNALLDFLAGS := \
-Tlinker.ld \ -Tlinker.ld \
-nostdlib \ -nostdlib \
-zmax-page-size=0x1000 \ -zmax-page-size=0x1000 \
@ -14,51 +16,53 @@ INTERNALLDFLAGS := \
--no-dynamic-linker \ --no-dynamic-linker \
-ztext -ztext
INTERNAL_LD_FLAGS_MULTIBOOT2 := \ override INTERNAL_LD_FLAGS_MULTIBOOT2 := \
-m elf_i386 \
-Tmultiboot2.ld \ -Tmultiboot2.ld \
-nostdlib \ -nostdlib \
-zmax-page-size=0x1000 \ -zmax-page-size=0x1000 \
-static -static
INTERNAL_LD_FLAGS_MULTIBOOT1 := \ override INTERNAL_LD_FLAGS_MULTIBOOT1 := \
-m elf_i386 \
-Tmultiboot.ld \ -Tmultiboot.ld \
-nostdlib \ -nostdlib \
-zmax-page-size=0x1000 \ -zmax-page-size=0x1000 \
-static -static
INTERNALCFLAGS := \ override INTERNALCFLAGS := \
-I. \
-I.. \
-std=c11 \ -std=c11 \
-g \
-ffreestanding \ -ffreestanding \
-fno-stack-protector \ -fno-stack-protector \
-fno-stack-check \
-fno-lto \
-fpie \ -fpie \
-mabi=sysv \ -mgeneral-regs-only \
-mno-80387 \ -mno-red-zone \
-mno-mmx \
-mno-sse \
-mno-sse2 \
-mno-red-zone
INTERNALCFLAGS_MB := \
-I. \ -I. \
-I.. \ -I..
-I../common/protos \
override INTERNALCFLAGS_MB := \
-std=c11 \ -std=c11 \
-m32 \
-g \
-ffreestanding \ -ffreestanding \
-fno-stack-protector \ -fno-stack-protector \
-fno-stack-check \
-fno-lto \
-fno-pie \ -fno-pie \
-fno-pic \ -fno-pic \
-m32 \
-march=i686 \
-mabi=sysv \ -mabi=sysv \
-mno-80387 \ -mno-80387 \
-mno-mmx \ -I. \
-mno-sse \ -I.. \
-mno-sse2 -I../common/protos
ifneq ($(findstring 86,$(CROSS_CC)),)
all: test.elf multiboot2.elf multiboot.elf all: test.elf multiboot2.elf multiboot.elf
else
all: test.elf
endif
test.elf: limine.o e9print.o memory.o test.elf: limine.o e9print.o memory.o
$(LD) $^ $(LDFLAGS) $(INTERNALLDFLAGS) -o $@ $(LD) $^ $(LDFLAGS) $(INTERNALLDFLAGS) -o $@

View File

@ -9,7 +9,9 @@ static const char CONVERSION_TABLE[] = "0123456789abcdef";
void e9_putc(char c) { void e9_putc(char c) {
if (limine_print != NULL) if (limine_print != NULL)
limine_print(&c, 1); limine_print(&c, 1);
#if defined (__x86_64__) || defined (__i386__)
__asm__ __volatile__ ("outb %0, %1" :: "a" (c), "Nd" (0xe9) : "memory"); __asm__ __volatile__ ("outb %0, %1" :: "a" (c), "Nd" (0xe9) : "memory");
#endif
} }
void e9_print(const char *msg) { void e9_print(const char *msg) {

View File

@ -1,7 +1,7 @@
ENTRY(_start) ENTRY(_start)
SECTIONS { SECTIONS {
. = 0x10000; . = 1M;
.boot : .boot :
{ {
@ -18,7 +18,7 @@ SECTIONS {
. = ALIGN(4K); . = ALIGN(4K);
.rodata : .rodata :
{ {
*(.rodata.*) *(.rodata .rodata.*)
} }
. = ALIGN(4K); . = ALIGN(4K);

View File

@ -18,7 +18,7 @@ SECTIONS {
. = ALIGN(4K); . = ALIGN(4K);
.rodata : .rodata :
{ {
*(.rodata.*) *(.rodata .rodata.*)
} }
. = ALIGN(4K); . = ALIGN(4K);