-
Notifications
You must be signed in to change notification settings - Fork 18
152 lines (137 loc) · 5.12 KB
/
Copy pathlinux-gcc.yml
File metadata and controls
152 lines (137 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Linux, gcc
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ia32, x64, aa64, arm, riscv64, loongarch64]
include:
- arch: ia32
dir: ia32
gcc: multilib
cross_compile:
- arch: x64
dir: x86_64
gcc: multilib
cross_compile:
- arch: aa64
dir: aarch64
gcc: aarch64-linux-gnu
cross_compile: aarch64-linux-gnu-
- arch: arm
dir: arm
gcc: arm-linux-gnueabihf
cross_compile: arm-linux-gnueabihf-
- arch: riscv64
dir: riscv64
gcc: riscv64-linux-gnu
cross_compile: riscv64-linux-gnu-
# See https://github.com/ncroxon/gnu-efi/issues/29
# - arch: mips64
# dir: mips64el
# gcc: mips64el-linux-gnuabi64
# cross_compile: mips64el-linux-gnuabi64-
- arch: loongarch64
dir: loongarch64
gcc: multilib
cross_compile: loongarch64-unknown-linux-gnu-
steps:
# Must happens first or else the LoongArch toolchain gets deleted
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install gcc-${{ matrix.gcc }}
if [[ "${{ matrix.arch }}" == "loongarch64" ]]; then
curl -L -O https://github.com/loongson/build-tools/releases/download/2024.11.01/x86_64-cross-tools-loongarch64-binutils_2.43.1-gcc_14.2.0-glibc_2.40.tar.xz
tar -xJf x86_64-cross-tools-loongarch64-binutils_2.43.1-gcc_14.2.0-glibc_2.40.tar.xz
echo "$PWD/cross-tools/bin" >> "$GITHUB_PATH"
fi
- name: Build
run: make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }}
- name: Generate binary information
run: readelf -a ./${{ matrix.dir }}/apps/ctors_dtors_priority_test.so > ./${{ matrix.dir }}/apps/readelf.txt
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.arch }}
path: |
./${{ matrix.dir }}/apps/*
tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
arch: [x64, ia32, aa64, arm, riscv64, loongarch64]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
- arch: aa64
pkg: qemu-system-arm
qemu_arch: aarch64
qemu_opts: -M virt -cpu cortex-a57
fw_base: AAVMF
- arch: arm
pkg: qemu-system-arm
qemu_arch: arm
qemu_opts: -M virt -cpu cortex-a15
fw_base: AAVMF
- arch: riscv64
pkg: qemu-system-riscv64
qemu_arch: riscv64
qemu_opts: -M virt,pflash0=pflash0
fw_base: QEMU_EFI
- arch: loongarch64
pkg: qemu-system-loongarch64
qemu_arch: loongarch64
qemu_opts: -M virt -cpu la464
fw_base: QEMU_EFI
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
mkdir -p ./image/efi/boot
curl -L https://github.com/pbatard/UEFI-Shell/releases/download/24H2/shell${{ matrix.arch }}.efi -o ./image/efi/boot/boot${{ matrix.arch }}.efi
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
if [ "$UEFI_ARCH" = "riscv64" ]; then
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -blockdev node-name=pflash0,driver=file,read-only=on,filename=${{ matrix.fw_base }}.fd -drive format=raw,file=fat:rw:image,id=drv1 -device virtio-blk-device,drive=drv1"
elif [ "$UEFI_ARCH" = "loongarch64" ]; then
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -bios ${{ matrix.fw_base }}.fd -drive format=raw,file=fat:rw:image"
else
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image"
fi
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh