mirror of
https://github.com/AuxXxilium/arc-modules.git
synced 2024-11-23 23:01:01 +07:00
240 lines
9.5 KiB
YAML
240 lines
9.5 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.
|
||
|
#
|
||
|
|
||
|
name: Update kvm
|
||
|
|
||
|
on:
|
||
|
workflow_dispatch:
|
||
|
inputs:
|
||
|
push:
|
||
|
description: 'push'
|
||
|
default: false
|
||
|
type: boolean
|
||
|
|
||
|
jobs:
|
||
|
kvm:
|
||
|
strategy:
|
||
|
matrix:
|
||
|
include:
|
||
|
# - version: 7.1
|
||
|
# platform: apollolake
|
||
|
# - version: 7.1
|
||
|
# platform: broadwell
|
||
|
# - version: 7.1
|
||
|
# platform: broadwellnk
|
||
|
# - version: 7.1
|
||
|
# platform: broadwellnkv2
|
||
|
# - version: 7.1
|
||
|
# platform: broadwellntbap
|
||
|
# - version: 7.1
|
||
|
# platform: denverton
|
||
|
# - version: 7.1
|
||
|
# platform: geminilake
|
||
|
# #- version: 7.1
|
||
|
# # platform: grantley
|
||
|
# - version: 7.1
|
||
|
# platform: purley
|
||
|
# - version: 7.1
|
||
|
# platform: r1000
|
||
|
# - version: 7.1
|
||
|
# platform: v1000
|
||
|
|
||
|
- version: 7.2
|
||
|
platform: apollolake
|
||
|
- version: 7.2
|
||
|
platform: broadwell
|
||
|
- version: 7.2
|
||
|
platform: broadwellnk
|
||
|
- version: 7.2
|
||
|
platform: broadwellnkv2
|
||
|
- version: 7.2
|
||
|
platform: broadwellntbap
|
||
|
- version: 7.2
|
||
|
platform: denverton
|
||
|
- version: 7.2
|
||
|
platform: geminilake
|
||
|
#- version: 7.2
|
||
|
# platform: grantley
|
||
|
- version: 7.2
|
||
|
platform: purley
|
||
|
- version: 7.2
|
||
|
platform: r1000
|
||
|
- version: 7.2
|
||
|
platform: v1000
|
||
|
|
||
|
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
|
||
|
# if: ${{ steps.cache-env.outputs.cache-hit != 'true' }}
|
||
|
run: |
|
||
|
ROOT_PATH=${{ github.workspace }}
|
||
|
|
||
|
git clone https://github.com/SynologyOpenSource/pkgscripts-ng.git ${ROOT_PATH}/pkgscripts-ng
|
||
|
cd ${ROOT_PATH}/pkgscripts-ng
|
||
|
# if version == 6.2, checkout 6.2.4
|
||
|
git checkout DSM${{ matrix.version }}`[ "${{ matrix.version }}" = "6.2" ] && echo ".4"`
|
||
|
sudo ./EnvDeploy -v ${{ matrix.version }}`[ "${{ matrix.version }}" = "6.2" ] && echo ".4"` -l # Get Available platforms
|
||
|
sudo ./EnvDeploy -q -v ${{ matrix.version }} -p ${{ matrix.platform }}
|
||
|
|
||
|
# Fault tolerance of pkgscripts-ng
|
||
|
if [ "${{ matrix.platform }}" == "broadwellntbap" -a "${{ matrix.version }}" == "7.1" ]; then
|
||
|
sed -i '/ broadwellnk BROADWELLNK/a\ broadwellntbap BROADWELLNTBAP linux-4.4.x Intel Broadwell with ntb kernel config in AP mode' ${ROOT_PATH}/pkgscripts-ng/include/platforms
|
||
|
fi
|
||
|
|
||
|
#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
|
||
|
sed -i '1 i include /env.mak' arch/x86/kvm/Makefile
|
||
|
sed -i "s|boot_cpu_data.x86_vendor != X86_VENDOR_AMD|false|" ${KSRC}/arch/x86/include/asm/virtext.h
|
||
|
# Modify TRACE_INCLUDE_PATH of *trace.h
|
||
|
for F in `find ./ -type f -name *trace.h`; do
|
||
|
FILE_PATH=`realpath $(dirname ${F})`
|
||
|
sed -i "s|#define TRACE_INCLUDE_PATH.*$|#define TRACE_INCLUDE_PATH ${FILE_PATH}|" ${F}
|
||
|
done
|
||
|
PARMS+="CONFIG_KVM=m CONFIG_KVM_INTEL=m CONFIG_KVM_AMD=m CONFIG_IRQ_BYPASS_MANAGER=m"
|
||
|
make -j`nproc` -C "${KSRC}" M="${PWD}/arch/x86/kvm" ${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 [ "${{ matrix.platform }}" = "epyc7002" ]; then
|
||
|
tar caf ${{ github.workspace }}/source/${{ matrix.platform }}-${{ matrix.version }}-${{ env.KVER }}.tgz -C ${{ github.workspace }}/source/output .
|
||
|
else
|
||
|
tar caf ${{ github.workspace }}/source/${{ matrix.platform }}-${{ env.KVER }}.tgz -C ${{ github.workspace }}/source/output .
|
||
|
fi
|
||
|
|
||
|
- name: Upload to Artifacts
|
||
|
uses: actions/upload-artifact@v3
|
||
|
with:
|
||
|
name: kvm
|
||
|
path: |
|
||
|
${{ github.workspace }}/source/*.tgz
|
||
|
|
||
|
- name: clean
|
||
|
run: |
|
||
|
sudo rm -rf ${{ github.workspace }}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/*
|
||
|
|
||
|
release:
|
||
|
runs-on: ubuntu-latest
|
||
|
needs: kvm
|
||
|
if: inputs.push == true
|
||
|
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: download to artifacts
|
||
|
uses: actions/download-artifact@v3
|
||
|
with:
|
||
|
name: kvm
|
||
|
path: ./artifacts
|
||
|
|
||
|
- name: Check and Push
|
||
|
run: |
|
||
|
ls artifacts
|
||
|
for F in `ls artifacts/*.tgz`; do
|
||
|
if echo ${F} | grep -qE "apollolake|broadwell|broadwellnk|denverton|geminilake"; then
|
||
|
KVM="kvm-amd.ko"
|
||
|
else # "epyc7002|r1000|v1000"
|
||
|
KVM="kvm-intel.ko"
|
||
|
fi
|
||
|
echo "Copy ${F}/${KVM}"
|
||
|
mkdir -p "thirdparty/`basename "$F" .tgz`/"
|
||
|
if tar -tf "${F}" | grep "${KVM}"; then
|
||
|
cp official/hda1/`basename "$F" .tgz`/irqbypass.ko official/hda1/`basename "$F" .tgz`/kvm* thirdparty/`basename "$F" .tgz`/
|
||
|
tar -xzvf "${F}" -C "thirdparty/`basename "$F" .tgz`/" ./${KVM}
|
||
|
else
|
||
|
echo "[W] Not ${KVM} in ${F}"
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
echo "Git push ..."
|
||
|
git pull
|
||
|
status=$(git status -s | grep -E 'thirdparty/' | awk '{printf " %s", $2}')
|
||
|
if [ -n "${status}" ]; then
|
||
|
git add ${status}
|
||
|
git commit -m "modules: update kvm $(date +%Y-%m-%d" "%H:%M:%S)"
|
||
|
git push -f
|
||
|
fi
|