-
Notifications
You must be signed in to change notification settings - Fork 80
163 lines (146 loc) · 5.67 KB
/
linux_gcc_edk2.yml
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
153
154
155
156
157
158
159
160
161
162
163
name: Linux, gcc, EDK2
on:
push:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '!set_grub_cpu.cmd'
- '**.md'
- '**.sh'
- '!set_grub_cpu.sh'
- '**.txt'
- '**.vbs'
pull_request:
paths-ignore:
- '.gitignore'
- '.gitattributes'
- '**.cmd'
- '!set_grub_cpu.cmd'
- '**.md'
- '**.sh'
- '!set_grub_cpu.sh'
- '**.txt'
- '**.vbs'
env:
BUILD_TYPE: RELEASE
COMPILER: GCC5
GCC5_ARM_PREFIX: arm-linux-gnueabi-
GCC5_AARCH64_PREFIX: aarch64-linux-gnu-
GCC5_RISCV64_PREFIX: riscv64-linux-gnu-
GCC5_LOONGARCH64_PREFIX: loongarch64-unknown-linux-gnu-
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
arch: [X64, IA32, AARCH64, ARM, RISCV64, LOONGARCH64]
include:
- arch: X64
short: x64
pkgs: nasm python3-setuptools uuid-dev
- arch: IA32
short: ia32
pkgs: gcc-multilib nasm python3-setuptools uuid-dev
- arch: AARCH64
short: aa64
pkgs: gcc-aarch64-linux-gnu python3-setuptools uuid-dev
- arch: ARM
short: arm
pkgs: gcc-arm-linux-gnueabi python3-setuptools uuid-dev
- arch: RISCV64
short: riscv64
pkgs: gcc-riscv64-linux-gnu python3-setuptools uuid-dev
- arch: LOONGARCH64
short: loongarch64
pkgs: gcc-multilib python3-setuptools uuid-dev
steps:
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.pkgs }}
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: Fix missing Risc-V header
if: matrix.arch == 'RISCV64'
run: sudo ln -s /usr/riscv64-linux-gnu/include/gnu/stubs-lp64d.h /usr/riscv64-linux-gnu/include/gnu/stubs-lp64.h
- name: Set up EDK2
run: |
git clone --recursive https://github.com/tianocore/edk2.git
make -C edk2/BaseTools
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
path: edk2/EfiFsPkg
- name: Patch GRUB
run: |
cd edk2/EfiFsPkg/grub
git apply ../0001-GRUB-fixes.patch
- name: Build UEFI drivers
run: |
cd edk2
source edksetup.sh
./EfiFsPkg/set_grub_cpu.sh ${{ matrix.arch }}
build -a ${{ matrix.arch }} -b ${{ env.BUILD_TYPE }} -t ${{ env.COMPILER }} -p EfiFsPkg/EfiFsPkg.dsc
for f in Build/EfiFs/${{ env.BUILD_TYPE }}_${{ env.COMPILER }}/${{ matrix.arch }}/*.efi; do mv "$f" "${f%.efi}_${{ matrix.short }}.efi"; done
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'push' }}
with:
name: gcc_edk2_${{ matrix.short }}
path: edk2/Build/EfiFs/${{ env.BUILD_TYPE }}_${{ env.COMPILER }}/${{ matrix.arch }}/*.efi
- name: Display SHA-256
if: startsWith(github.ref, 'refs/tags/')
run: |
mv edk2/Build/EfiFs/${{ env.BUILD_TYPE }}_${{ env.COMPILER }}/${{ matrix.arch }}/*.efi .
sha256sum *.efi
- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ./*.efi
- name: Create web artifacts
if: startsWith(github.ref, 'refs/tags/')
run: |
GIT_VERSION=$(git --git-dir edk2/EfiFsPkg/.git describe --tags --abbrev=0)
DIR_VERSION=${GIT_VERSION:1}
mkdir -p web/${{ matrix.short }}
curl -L https://raw.githubusercontent.com/pbatard/efifs/gh-pages/downloads/header.html -o web/${{ matrix.short }}/index.html
printf "<pre><img src=\"/icons/blank.png\" alt=\"Icon\" width=\"32\" height=\"32\"> Name Last modified Size Description<hr><a href=\"/downloads/efifs-%s/\"><img src=\"/icons/back.png\" alt=\"[PARENTDIR]\" width=\"32\" height=\"32\"></a> <a href=\"/downloads/efifs-%s/\">Parent Directory</a> -\n" ${DIR_VERSION} ${DIR_VERSION} >> web/${{ matrix.short }}/index.html
for f in *.efi; do
TIMESTAMP=$(date -r $f "+%Y-%m-%d %H:%M");
SIZE=$(du --apparent-size -sh $f | awk '{ print $1 }');
LINK=https://github.com/pbatard/efifs/releases/download/${GIT_VERSION}/$f;
FILE_AND_TAG="$f</a>";
printf "<a href=\"%s\"><img src=\"/icons/uefi.svg\" alt=\"[EFI]\" width=\"32\" height=\"32\"></a> <a href=\"%s\">%-31s%-19s%-5s\n" "${LINK}" "${LINK}" "${FILE_AND_TAG}" "${TIMESTAMP}" "${SIZE}" >> web/${{ matrix.short }}/index.html;
done
printf "<hr></pre>\n </body>\n</html>\n" >> web/${{ matrix.short }}/index.html
- name: Upload web artifacts
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: web_files_${{ matrix.arch }}
path: web/*/index.html
merge-artifacts:
runs-on: ubuntu-24.04
needs: build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
name: gcc_edk2
delete-merged: true
- name: Merge Web Artifacts
uses: actions/upload-artifact/merge@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: web_files
delete-merged: true