arc-modules/.github/workflows/compile.yml
AuxXxilium 6995083455 Initial commit
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-05-06 21:59:43 +02:00

219 lines
7.9 KiB
YAML

#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# version: [ 7.1, 7.2 ]
# platform: [ apollolake, broadwell, broadwellnk, bromolow, denverton, epyc7002, geminilake, purley, r1000, v1000 ]
# exclude:
# - version: 7.1
# platform: broadwell
# include:
# - version: "7.2"
# platform: "broadwell"
name: Compile Modules
on:
workflow_dispatch:
inputs:
version:
description: 'format %y.%-m.$i or auto'
required: false
type: string
module:
description: 'CONFIG_MODULE=m'
reguired: false
type: string
jobs:
build:
strategy:
matrix:
include:
- version: 7.1
platform: apollolake
parm: "4.4.180"
- version: 7.1
platform: broadwell
parm: "4.4.180"
- version: 7.1
platform: broadwellnk
parm: "4.4.180"
- version: 7.1
platform: broadwellnkv2
parm: "4.4.180"
- version: 7.1
platform: denverton
parm: "4.4.180"
- version: 7.1
platform: epyc7002
parm: "5.10.55"
- version: 7.1
platform: geminilake
parm: "4.4.180"
- version: 7.1
platform: purley
parm: "4.4.180"
- version: 7.1
platform: r1000
parm: "4.4.180"
- version: 7.1
platform: v1000
parm: "4.4.180"
- version: 7.2
platform: apollolake
parm: "4.4.302"
- version: 7.2
platform: broadwell
parm: "4.4.302"
- version: 7.2
platform: broadwellnk
parm: "4.4.302"
- version: 7.2
platform: broadwellnkv2
parm: "4.4.302"
- version: 7.2
platform: denverton
parm: "4.4.302"
- version: 7.2
platform: epyc7002
parm: "5.10.55"
- version: 7.2
platform: geminilake
parm: "4.4.302"
- version: 7.2
platform: purley
parm: "4.4.302"
- version: 7.2
platform: r1000
parm: "4.4.302"
- version: 7.2
platform: v1000
parm: "4.4.302"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Init Env
run: |
git config --global user.email "info@auxxxilium.tech"
git config --global user.name "AuxXxilium"
sudo timedatectl set-timezone "Europe/Berlin"
- name: Get EnvDeploy
run: |
ROOT_PATH=${{ github.workspace }}
git clone https://github.com/SynologyOpenSource/pkgscripts-ng.git ${ROOT_PATH}/pkgscripts-ng
cd ${ROOT_PATH}/pkgscripts-ng
git checkout DSM${{ matrix.version }}
sudo ./EnvDeploy -v ${{ matrix.version }} -l # Get Available platforms
sudo ./EnvDeploy -q -v ${{ matrix.version }} -p ${{ matrix.platform }}
#ENV
mkdir -p ${ROOT_PATH}/source
ENV_PATH=${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}
sudo cp -al ${ROOT_PATH}/pkgscripts-ng ${ENV_PATH}/
sudo chroot ${ENV_PATH} << "EOF"
cd pkgscripts
version=${{ matrix.version }}; [ ${version:0:1} -gt 6 ] && sed -i 's/print(" ".join(kernels))/pass #&/' ProjectDepends.py
sed -i '/PLATFORM_FAMILY/a\\techo "PRODUCT=$PRODUCT" >> $file\n\techo "KSRC=$KERNEL_SEARCH_PATH" >> $file\n\techo "LINUX_SRC=$KERNEL_SEARCH_PATH" >> $file' include/build
./SynoBuild -c -p ${{ matrix.platform }}
while read line; do if [ ${line:0:1} != "#" ]; then export ${line%%=*}="${line#*=}"; fi; done < /env${BUILD_ARCH}.mak
if [ -f "${KSRC}/Makefile" ]; then
# gcc issue "unrecognized command-line option '--param=allow-store-data-races=0'".
[ "${{ matrix.version }}" == "7.2" ] && sed -i 's/--param=allow-store-data-races=0/--allow-store-data-races/g' ${KSRC}/Makefile
VERSION=`cat ${KSRC}/Makefile | grep ^VERSION | awk -F' ' '{print $3}'`
PATCHLEVEL=`cat ${KSRC}/Makefile | grep ^PATCHLEVEL | awk -F' ' '{print $3}'`
SUBLEVEL=`cat ${KSRC}/Makefile | grep ^SUBLEVEL | awk -F' ' '{print $3}'`
[ -f "/env32.mak" ] && echo "KVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" >> /env32.mak
[ -f "/env64.mak" ] && echo "KVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" >> /env64.mak
CCVER=`$CC --version | head -n 1 | awk -F' ' '{print $3}'`
[ -f "/env32.mak" ] && echo "CCVER=${CCVER}" >> /env32.mak
[ -f "/env64.mak" ] && echo "CCVER=${CCVER}" >> /env64.mak
fi
EOF
[ -f ${ENV_PATH}/env64.mak ] && ENV_FILE=${ENV_PATH}/env64.mak || ([ -f ${ENV_PATH}/env32.mak ] && ENV_FILE=${ENV_PATH}/env32.mak)
if [ -n "${ENV_FILE}" ]; then
KVER=`grep 'KVER=' ${ENV_FILE} | awk -F'=' '{print $2}'`
CCVER=`grep 'CCVER=' ${ENV_FILE} | awk -F'=' '{print $2}'`
[ -n "${KVER}" ] && echo "KVER=${KVER}" >> $GITHUB_ENV
[ -n "${CCVER}" ] && echo "CCVER=${CCVER}" >> $GITHUB_ENV
fi
- name: Get Src
run: |
ROOT_PATH=${{ github.workspace }}
mkdir -p ${ROOT_PATH}/source/output
repo=${{ env.repo }}
KVER=${{ env.KVER }}
sudo cp -a ${ROOT_PATH}/src/${KVER:0:1}.x ${ROOT_PATH}/source/input
sudo cp -a ${ROOT_PATH}/source ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/
- name: Make
run: |
ROOT_PATH=${{ github.workspace }}
sudo chroot build_env/ds.${{ matrix.platform }}-${{ matrix.version }} << "EOF"
sed -i 's/^CFLAGS=/#CFLAGS=/g; s/^CXXFLAGS=/#CXXFLAGS=/g' /env${BUILD_ARCH}.mak
while read line; do if [ ${line:0:1} != "#" ]; then export ${line%%=*}="${line#*=}"; fi; done < /env${BUILD_ARCH}.mak
cd /source/input
[ -z "`grep 'env.mak' Makefile`" ] && sed -i '1 i include /env.mak' Makefile
if [ -n "${{ inputs.module }}" ]; then
PARMS+="${{ inputs.module }}"
elif [ -f "defines.${{ matrix.platform }}" ]; then
PARMS+=" `cat "defines.${{ matrix.platform }}" | xargs`"
else
echo "[E] ${{ matrix.platform }}-${{ matrix.version }}"
fi
make -j`nproc` -C "${KSRC}" M="${PWD}" ${PARMS} modules
while read F; do
strip -g "${F}"
echo "Copying `basename ${F}`"
cp "${F}" "/source/output"
done < <(find ${PWD} -name \*.ko)
EOF
sudo cp -a ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/output ${ROOT_PATH}/source/
sudo chmod a+rw -R ${ROOT_PATH}/source/output
- name: Tar to Artifacts
run: |
if [ ! -d "${{ github.workspace }}/source/output" ]; then
mkdir -p "${{ github.workspace }}/source/output"
chmod a+rw -R "${{ github.workspace }}/source/output"
fi
if [ "${{ matrix.platform }}" = "epyc7002" ]; then
tar caf ${{ github.workspace }}/source/${{ matrix.platform }}-${{ matrix.version }}-${{ matrix.parm }}.tgz -C ${{ github.workspace }}/source/output .
else
tar caf ${{ github.workspace }}/source/${{ matrix.platform }}-${{ matrix.parm }}.tgz -C ${{ github.workspace }}/source/output .
fi
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: modules
path: |
${{ github.workspace }}/source/*.tgz
- name: clean
run: |
sudo rm -rf ${{ github.workspace }}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/*