actions: setup build test actions

This commit is contained in:
Mark Poliakov 2024-03-04 16:31:24 +02:00
parent 4312a097da
commit 6329e1f102
5 changed files with 199 additions and 0 deletions

View File

@ -0,0 +1,51 @@
name: Kernel tests
run_name: Kernel tests
on: [pull_request]
jobs:
Test-x86_64-Build:
runs-on: ubuntu-latest
steps:
- name: Checkout kernel sources
uses: actions/checkout@v3
- name: Install build dependencies
run: |
apt update && apt install -y nasm gcc
- name: Install nightly Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly
source "$HOME/.cargo/env"
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Update dependencies
run: |
source "$HOME/.cargo/env"
cd ${{ gitea.workspace }}
cargo update yggdrasil-abi elf
- name: Build x86-64
run: |
source "$HOME/.cargo/env"
cd ${{ gitea.workspace }}
cargo build -Z build-std=core,alloc,compiler_builtins --target=etc/x86_64-unknown-none.json
Test-aarch64-Build:
runs-on: ubuntu-latest
steps:
- name: Checkout kernel sources
uses: actions/checkout@v3
- name: Install build dependencies
run: |
apt update && apt install -y nasm gcc
- name: Install nightly Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly
source "$HOME/.cargo/env"
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Update dependencies
run: |
source "$HOME/.cargo/env"
cd ${{ gitea.workspace }}
cargo update yggdrasil-abi elf
- name: Build aarch64
run: |
source "$HOME/.cargo/env"
cd ${{ gitea.workspace }}
cargo build -Z build-std=core,alloc,compiler_builtins --target=etc/aarch64-unknown-qemu.json

View File

@ -0,0 +1,18 @@
{
"arch": "aarch64",
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
"disable-redzone": true,
"features": "+v8a,+strict-align,+neon,+fp-armv8",
"is-builtin": false,
"linker": "rust-lld",
"linker-flavor": "ld.lld",
"llvm-target": "aarch64-unknown-none",
"max-atomic-width": 128,
"panic-strategy": "abort",
"relocation-model": "static",
"target-pointer-width": "64",
"eh-frame-header": false,
"post-link-args": {
"ld.lld": ["-Tetc/aarch64-unknown-qemu.ld"]
}
}

View File

@ -0,0 +1,53 @@
ENTRY(__aarch64_entry);
KERNEL_PHYS_BASE = 0x40080000;
KERNEL_VIRT_OFFSET = 0xFFFFFF8000000000;
SECTIONS {
. = KERNEL_PHYS_BASE;
PROVIDE(__kernel_phys_start = .);
.text.entry : {
*(.text.entry)
}
. = ALIGN(16);
. = . + KERNEL_VIRT_OFFSET;
.text : AT(. - KERNEL_VIRT_OFFSET) {
KEEP(*(.text.vectors));
*(.text*)
}
. = ALIGN(4K);
.rodata : AT(. - KERNEL_VIRT_OFFSET) {
*(.eh_frame*)
. = ALIGN(16);
PROVIDE(__dt_probes_start = .);
KEEP(*(.dt_probes));
PROVIDE(__dt_probes_end = .);
*(.rodata*)
}
. = ALIGN(4K);
.data.tables : AT (. - KERNEL_VIRT_OFFSET) {
KEEP(*(.data.tables))
}
. = ALIGN(4K);
.data : AT(. - KERNEL_VIRT_OFFSET) {
*(.data*)
/* *(.got*) */
}
. = ALIGN(4K);
PROVIDE(__bss_start_phys = . - KERNEL_VIRT_OFFSET);
.bss : AT(. - KERNEL_VIRT_OFFSET) {
*(COMMON)
*(.bss*)
}
. = ALIGN(4K);
PROVIDE(__bss_end_phys = . - KERNEL_VIRT_OFFSET);
PROVIDE(__kernel_size = . - KERNEL_VIRT_OFFSET - KERNEL_PHYS_BASE);
};

View File

@ -0,0 +1,26 @@
{
"is-builtin": false,
"arch": "x86_64",
"cpu": "x86-64",
"os": "none",
"llvm-target": "x86_64-unknown-linux-gnu",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
"max-atomic-width": 64,
"target-pointer-width": "64",
"disable-redzone": true,
"executables": true,
"panic-strategy": "abort",
"features": "-avx,-sse,+soft-float",
"has-thread-local": false,
"linker": "rust-lld",
"linker-flavor": "ld.lld",
"pre-link-args": {
"ld.lld": [
"-Tetc/x86_64-unknown-none.ld"
]
}
}

View File

@ -0,0 +1,51 @@
ENTRY(__x86_64_entry);
KERNEL_PHYS_BASE = 0x200000;
KERNEL_VIRT_OFFSET = 0xFFFFFF8000000000;
SECTIONS {
. = KERNEL_PHYS_BASE;
PROVIDE(__kernel_phys_start = .);
PROVIDE(__kernel_start = . + KERNEL_VIRT_OFFSET);
.text.entry : {
*(.multiboot)
*(.text.entry)
}
. = ALIGN(16);
. = . + KERNEL_VIRT_OFFSET;
.text : AT(. - KERNEL_VIRT_OFFSET) {
*(.text*)
}
. = ALIGN(4K);
.rodata : AT(. - KERNEL_VIRT_OFFSET) {
*(.eh_frame*)
*(.rodata*)
}
. = ALIGN(4K);
.data.tables : AT (. - KERNEL_VIRT_OFFSET) {
KEEP(*(.data.tables))
}
.data : AT(. - KERNEL_VIRT_OFFSET) {
KEEP(*(.data.yboot))
*(.data*)
*(.got*)
}
. = ALIGN(4K);
PROVIDE(__bss_start_phys = . - KERNEL_VIRT_OFFSET);
.bss : AT(. - KERNEL_VIRT_OFFSET) {
*(COMMON)
*(.bss*)
}
. = ALIGN(4K);
PROVIDE(__bss_end_phys = . - KERNEL_VIRT_OFFSET);
PROVIDE(__kernel_end = .);
PROVIDE(__kernel_size = . - KERNEL_VIRT_OFFSET - KERNEL_PHYS_BASE);
};