Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wjz304/redpill-lkm
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyGALLAND committed Jun 11, 2023
2 parents 00fee8a + f59bf7c commit 0023f13
Show file tree
Hide file tree
Showing 9 changed files with 984 additions and 778 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
- version: 7.2
platform: v1000
parm: 'dev-v7 prod-v7'
- version: 7.2
platform: epyc7002
parm: 'dev-v7 prod-v7'

runs-on: ubuntu-latest

Expand Down Expand Up @@ -162,7 +165,7 @@ jobs:
# 5.10.55 Temporary use of https://github.com/XPEnology-Community/redpill-lkm5
# And currently only 7.1 USB OK, @jim3ma is adapting to 7.2.
#[ "${KVER:0:1}" = "5" ] && repo=https://github.com/XPEnology-Community/redpill-lkm5
[ "${KVER:0:1}" = "5" ] && repo=https://github.com/XPEnology-Community/redpill-lkm5
git clone ${repo} ${ROOT_PATH}/source/input
Expand Down
171 changes: 171 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
#
# 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 test

on:
release:
types: [published]

workflow_dispatch:
inputs:
version:
description: 'format %y.%-m.$i or auto'
required: false
type: string

jobs:
build:
strategy:
matrix:
include:
- version: 7.1
platform: epyc7002
parm: 'dev-v7 prod-v7 test-v7'

- version: 7.2
platform: epyc7002
parm: 'dev-v7 prod-v7 test-v7'

runs-on: ubuntu-latest

steps:
- 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
# 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 }}
#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 }}
# 5.10.55 Temporary use of https://github.com/XPEnology-Community/redpill-lkm5
# And currently only 7.1 USB OK, @jim3ma is adapting to 7.2.
[ "${KVER:0:1}" = "5" ] && repo=https://github.com/XPEnology-Community/redpill-lkm5
git clone ${repo} ${ROOT_PATH}/source/input
sudo cp -a ${ROOT_PATH}/source ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/
- name: Make lkms
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
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 }}-${{ matrix.version }}-${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/
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
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/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ dkms.conf
email.patch
linux-*/
.idea/
.vscode/
_compile.sh
Loading

0 comments on commit 0023f13

Please sign in to comment.