forked from RedPill-TTG/redpill-lkm
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from wjz304/master
Pull latest commits
- Loading branch information
Showing
28 changed files
with
951 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,296 @@ | ||
# | ||
# Copyright (C) 2022 Ing <https://github.com/wjz304> | ||
# | ||
# This is free software, licensed under the MIT License. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
# # 注意:所有 include 组合会在 exclude 之后处理。 这允许你使用 include 添加回以前排除的组合。 | ||
# version: [ 6.2, 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: Build lkms | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# When a release is published | ||
on: | ||
release: | ||
types: [published] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'format %y.%-m.$i or auto' | ||
required: false | ||
type: string | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
strategy: | ||
matrix: | ||
include: | ||
- version: 6.2 | ||
platform: apollolake | ||
parm: 'dev-v6 prod-v6 test-v6' | ||
- version: 6.2 | ||
platform: braswell | ||
parm: 'dev-v6 prod-v6 test-v6' | ||
- version: 6.2 | ||
platform: broadwell | ||
parm: 'dev-v6 prod-v6 test-v6' | ||
- version: 6.2 | ||
platform: broadwellnk | ||
parm: 'dev-v6 prod-v6 test-v6' | ||
- version: 6.2 | ||
platform: bromolow | ||
parm: 'dev-v6 prod-v6 test-v6' | ||
- version: 6.2 | ||
platform: denverton | ||
parm: 'dev-v6 prod-v6 test-v6' | ||
|
||
- version: 7.1 | ||
platform: apollolake | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: braswell | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: broadwell | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: broadwellnk | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: bromolow | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: denverton | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
#- version: 7.1 | ||
# platform: epyc7002 | ||
# parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: geminilake | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: purley | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: r1000 | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.1 | ||
platform: v1000 | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
|
||
- version: 7.2 | ||
platform: apollolake | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: braswell | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: broadwell | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: broadwellnk | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
#- version: 7.2 | ||
# platform: bromolow | ||
# parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: denverton | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: epyc7002 | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: geminilake | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: purley | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: r1000 | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
- version: 7.2 | ||
platform: v1000 | ||
parm: 'dev-v7 prod-v7 test-v7' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Checkout | ||
uses: actions/checkout@main | ||
|
||
- name: Init Env | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
sudo timedatectl set-timezone "Asia/Shanghai" | ||
# - name: Cache EnvDeploy | ||
# id: cache-env | ||
# uses: actions/cache@v3 | ||
# env: | ||
# cache-name: cache-env | ||
# with: | ||
# path: | | ||
# ${{ github.workspace }}/pkgscripts-ng | ||
# ${{ github.workspace }}/build_env | ||
# key: ds.${{ matrix.platform }}-${{ matrix.version }} | ||
|
||
- 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 | ||
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=${{ github.server_url }}/${{ github.repository }} | ||
git clone ${repo} ${ROOT_PATH}/source/input | ||
# Runs a set of commands using the runners shell | ||
- name: Build lkms | ||
id: build | ||
sudo cp -a ${ROOT_PATH}/source ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/ | ||
- name: Make lkms | ||
run: | | ||
./compile-lkms.sh | ||
zip -9 rp-lkms.zip -j output/* | ||
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 | ||
array=(${{ matrix.parm }}) | ||
for a in ${array[@]} | ||
do | ||
make ${a} | ||
if [ -f redpill.ko ]; then | ||
strip -g redpill.ko # Discard symbols from object files. | ||
RPKOVER=$(modinfo --field=vermagic redpill.ko | awk '{print $1}') | ||
gzip redpill.ko | ||
mv -f ./redpill.ko.gz /source/output/rp-${{ matrix.platform }}-${RPKOVER/+/}-`echo ${a} | awk -F'-' '{print $1}'`.ko.gz | ||
else | ||
echo "error" | ||
fi | ||
make clean | ||
done | ||
ls -al /source/output | ||
EOF | ||
sudo cp -a ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/output ${ROOT_PATH}/source/ | ||
# Upload img | ||
- name: Upload lkms | ||
- name: Upload to Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Redpill LKM for all platforms | ||
path: output | ||
retention-days: 1 | ||
name: rp-lkms | ||
path: | | ||
${{ github.workspace }}/source/output/* | ||
- name: clean | ||
# if: ${{ steps.cache-env.outputs.cache-hit == 'true' }} | ||
run: | | ||
sudo rm -rf ${{ github.workspace }}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/* | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@main | ||
|
||
- name: Calculate version | ||
run: | | ||
# Calculate version | ||
VERSION="" | ||
if [ ${{ github.event_name }} == 'release' -a ${{ github.ref_type }} == 'tag' ]; then | ||
VERSION="${{ github.ref_name }}" | ||
elif [ -n "${{ inputs.version }}" ]; then | ||
if [ "`echo ${{ inputs.version }} | cut -d '.' -f 1,2`" = "`date +'%y.%-m'`" ]; then | ||
VERSION="${{ inputs.version }}" | ||
else | ||
LATEST_TAG="`curl -skL "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r ".[0].tag_name" 2>/dev/null`" | ||
if [ -n "${LATEST_TAG}" -a "`echo ${LATEST_TAG} | cut -d '.' -f 1,2`" = "`date +'%y.%-m'`" ]; then # format %y.%-m.$i | ||
VERSION="`echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.'`" | ||
else | ||
VERSION="`date +'%y.%-m'`.0" | ||
fi | ||
fi | ||
else | ||
VERSION="" | ||
fi | ||
echo "VERSION: ${VERSION}" | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
- name: download to artifacts | ||
if: env.VERSION != '' | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: rp-lkms | ||
path: ./rp-lkms | ||
|
||
- name: Zip lkms | ||
if: env.VERSION != '' | ||
run: | | ||
echo "${{ env.VERSION }}" > "rp-lkms/VERSION" | ||
zip -9 rp-lkms.zip -j rp-lkms/* | ||
# Publish a release if is a tag | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
if: env.VERSION != '' | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
files: rp-lkms.zip | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ denverton 4.4.180 | |
geminilake 4.4.180 | ||
v1000 4.4.180 | ||
r1000 4.4.180 | ||
epyc7002 5.10.55 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.