Skip to content

Commit

Permalink
Add LInux musl-libc toolchain
Browse files Browse the repository at this point in the history
* Use gcc as compiler and binutils ld as linker
* Use musl toolchain prefixes

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
  • Loading branch information
gmbr3 committed Jun 10, 2024
1 parent 49ff896 commit 7a96193
Showing 1 changed file with 147 additions and 0 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/linux-gcc-musl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Linux, gcc+musl-libc

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
arch: [ia32, x64, aa64, arm, riscv64, mips64]
include:
- arch: ia32
dir: ia32
musl: musl-dev
toolchain: i586-linux-musl
cross_compile: i586-linux-musl-
- arch: x64
dir: x86_64
musl: musl-dev
toolchain: x86_64-linux-musl
cross_compile: x86_64-linux-musl-
- arch: aa64
dir: aarch64
musl: musl-dev
toolchain: aarch64-linux-musl
cross_compile: aarch64-linux-musl-
- arch: arm
dir: arm
musl: musl-dev
toolchain: arm-linux-musl
cross_compile: arm-linux-musl-
- arch: riscv64
dir: riscv64
musl: musl-dev
toolchain: riscv64-linux-musl
cross_compile: riscv64-linux-musl-
- arch: mips64
dir: mips64el
musl: musl-dev
toolchain: mips64el-linux-musl
cross_compile: mips64el-linux-musl-
# - arch: loongarch64
# dir: loongarch64
# gcc: loongarch64-linux-gnu
# cross_compile: loongarch64-linux-gnu-

steps:
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.musl }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build
run: |
for i in as ld as ar ranlib objcopy; do
ln -s $HOME/.local/bin/${{ matrix.toolchain }} /usr/bin/${i};
done
make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }} V=1
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: ./${{ matrix.dir }}/apps/*.efi

tests:
runs-on: ubuntu-24.04
needs: build

strategy:
matrix:
arch: [x64, ia32, aa64, arm, riscv64]
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

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@v4
with:
fetch-depth: 0

- name: Download artifacts
uses: actions/download-artifact@v4
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: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- 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 -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"
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

0 comments on commit 7a96193

Please sign in to comment.