Update Eudev #3
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
# | |
# 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 Eudev | |
on: | |
workflow_dispatch: | |
inputs: | |
push: | |
description: 'push' | |
default: false | |
type: boolean | |
eudev: | |
description: 'update eudev' | |
default: true | |
type: boolean | |
jobs: | |
eudev: | |
strategy: | |
matrix: | |
include: | |
- version: 7.1 | |
platform: apollolake | |
- version: 7.2 | |
platform: apollolake | |
if: inputs.eudev == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Init Env | |
run: | | |
git config --global user.email "[email protected]" | |
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 }} | |
# 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 -v 2>&1 | tail -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: 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 | |
git clone -c http.sslVerify=false --single-branch https://github.com/kmod-project/kmod.git /tmp/kmod | |
cd /tmp/kmod | |
git checkout master | |
patch -p1 < /source/input/kmod.patch | |
./autogen.sh | |
./configure CC=${CC} CFLAGS='-O2' --host=${HOST} --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --enable-tools --disable-manpages --disable-python --without-zstd --without-xz --without-zlib --without-openssl | |
[ -z "`grep 'env.mak' Makefile`" ] && sed -i '1 i include /env.mak' Makefile | |
make all | |
make install | |
make DESTDIR=/source/output install | |
git clone -c http.sslVerify=false --single-branch https://github.com/eudev-project/eudev.git /tmp/eudev | |
cd /tmp/eudev | |
git checkout master | |
./autogen.sh | |
./configure CC=${CC} --host=${HOST} --prefix=/usr --sysconfdir=/etc --disable-manpages --disable-selinux --disable-mtd_probe --enable-kmod | |
[ -z "$(grep 'env.mak' Makefile)" ] && sed -i '1 i include /env.mak' Makefile | |
make -i CFLAGS="-DSG_FLAG_LUN_INHIBIT=2" all | |
make -i CFLAGS="-DSG_FLAG_LUN_INHIBIT=2" DESTDIR=/source/output install | |
# ldd /source/output/usr/bin/kmod | awk '{if (match($3,"/")){ printf("%s "),$3 } }' | |
# ldd /source/output/usr/bin/udevadm | awk '{if (match($3,"/")){ printf("%s "),$3 } }' | |
rm -Rf /source/output/usr/share /source/output/usr/include /source/output/usr/lib/pkgconfig /source/output/usr/lib/libudev.* | |
cp -f ${ToolChainSysRoot}/usr/lib/libblkid.so.1 /source/output/usr/lib/libblkid.so.1 | |
ln -sf /usr/bin/kmod /source/output/usr/sbin/depmod | |
cp -f /source/input/99-usb-realtek-net.rules /source/output/usr/lib/udev/rules.d/99-usb-realtek-net.rules | |
rm -f /source/output/usr/lib/udev/rules.d/60-persistent-storage.rules | |
rm -f /source/output/usr/lib/udev/rules.d/60-persistent-storage-tape.rules | |
rm -f /source/output/usr/lib/udev/rules.d/80-net-name-slot.rules | |
chown 1000.1000 -R /source/output | |
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: | | |
tar caf ${{ github.workspace }}/source/eudev-${{ matrix.version }}.tgz -C ${{ github.workspace }}/source/output . | |
- name: Upload to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: addons | |
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: eudev | |
if: inputs.push == true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Init Env | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "AuxXxilium" | |
sudo timedatectl set-timezone "Europe/Berlin" | |
- name: download to artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: addons | |
path: ./artifacts | |
- name: Check and Push | |
run: | | |
if [ $(ls artifacts/*.tgz 2> /dev/null | wc -l) -gt 0 ]; then | |
echo "Copy eudev ..." | |
rm -rf eudev/all/addons/* | |
mv -f artifacts/*.tgz eudev/all/addons/ | |
echo "Git push ..." | |
git pull | |
status=$(git status -s | grep -E 'eudev/all/addons/' | awk '{printf " %s", $2}') | |
if [ -n "${status}" ]; then | |
git add ${status} | |
git commit -m "addons: eudev: update $(date +%Y-%m-%d" "%H:%M:%S)" | |
git push -f | |
fi | |
else | |
echo "No change ..." | |
fi |