Make kernel bs patch for 7.2.2-72806 formal using fb kpatch #16
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
name: Make kernel bs patch for 7.2.2-72803-0 formal using fb kpatch | |
on: | |
workflow_dispatch: | |
inputs: | |
toolchain: | |
description: 'DSM toolchain URL for repack zImage' | |
required: true | |
default: 'https://sourceforge.net/projects/toolchain-me/files/toolchain%207.2%20beta/broadwellnk-gcc1220_glibc236_x86_64-GPL.txz/download' | |
linux-src: | |
description: 'Linux kernel source URL for repack zImage' | |
required: true | |
default: 'https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.302.tar.xz' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
#- uses: actions/checkout@v2 | |
- name: Bulid | |
id: bulid-config | |
env: | |
ACTIONS_STEP_DEBUG: true | |
run: | | |
# install bsdiff | |
DSMVER="7.2.2" | |
REV="72803" | |
PLATFORMS="apollolake geminilake r1000 v1000 epyc7002" | |
DT_PLATFORMS="geminilake r1000 v1000 epyc7002" | |
sudo apt-get install -y bsdiff cpio xz-utils | |
#ls -al $GITHUB_WORKSPACE/ | |
mkdir /opt/build | |
mkdir /opt/dist | |
cd /opt/build | |
# download old pat for syno_extract_system_patch # thanks for jumkey's idea. | |
curl -kL https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3622xs%2B_42218.pat --output oldpat.tar.gz | |
curl -kLO https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/models.72 | |
curl -kLO https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/temp-dt-config.json | |
curl -kLO https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/temp-nondt-config.json | |
curl -kLO https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/temp-apollolake-config.json | |
curl -kLO https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/temp-denverton-config.json | |
curl -kLO https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/temp-epyc7002-config.json | |
curl -kL https://github.com/PeterSuh-Q3/redpill-load/raw/master/config/custom_config.json -o /opt/dist/custom_config.json | |
for file in `cat models.72` | |
do | |
dsmid=$(echo "$file" | sed 's/DS/ds/' | sed 's/RS/rs/' | sed 's/+/p/' | sed 's/DVA/dva/' | sed 's/FS/fs/' | sed 's/SA/sa/' ) | |
cd /opt/build | |
[ ! -d synoesp ] && mkdir synoesp | |
echo "Working on $file" | |
URL="https://global.synologydownload.com/download/DSM/release/${DSMVER}/${REV}/DSM_${file}_${REV}.pat" | |
URL="$(echo ${URL} | sed 's/+/%2B/g')" | |
echo ${URL} | |
curl -kL ${URL} -o ds.pat | |
tar -C./synoesp/ -xf oldpat.tar.gz rd.gz | |
cd synoesp | |
xz -dc < rd.gz >rd 2>/dev/null || echo "extract rd.gz" | |
echo "finish" | |
cpio -idm <rd 2>&1 || echo "extract rd" | |
[ ! -d extract ] && mkdir extract && cd extract | |
cp ../usr/lib/libcurl.so.4 ../usr/lib/libmbedcrypto.so.5 ../usr/lib/libmbedtls.so.13 ../usr/lib/libmbedx509.so.1 ../usr/lib/libmsgpackc.so.2 ../usr/lib/libsodium.so ../usr/lib/libsynocodesign-ng-virtual-junior-wins.so.7 ../usr/syno/bin/scemd ./ | |
ln -s scemd syno_extract_system_patch | |
cd ../.. | |
[ ! -d pat ] && mkdir pat | |
ls -lh ./ | |
sudo LD_LIBRARY_PATH=synoesp/extract synoesp/extract/syno_extract_system_patch ds.pat pat || echo "extract latest pat" | |
echo "test4" | |
# is update_pack | |
if [ ! -f "pat/zImage" ]; then | |
cd pat | |
ar x $(ls flashupdate*) | |
tar xf data.tar.xz | |
cd .. | |
fi | |
. /opt/build/pat/VERSION | |
#unique="synology_broadwellnk_3622xs+" | |
platform_name=$(echo "$unique" | awk -F "_" '{print $2}') | |
echo $platform_name | |
# make config.json | |
mkdir -p /opt/dist/${file}/${DSMVER}-${REV} | |
workfile=/opt/dist/${file}/${DSMVER}-${REV}/config.json | |
if [ $(echo ${DT_PLATFORMS} | grep ${platform_name} | wc -l ) -eq 0 ]; then | |
if [ ${platform_name} == "apollolake" ]; then | |
cp -fv temp-apollolake-config.json ${workfile} | |
elif [ ${platform_name} == "denverton" ]; then | |
cp -fv temp-denverton-config.json ${workfile} | |
else | |
cp -fv temp-nondt-config.json ${workfile} | |
fi | |
else | |
if [ ${platform_name} == "epyc7002" ]; then | |
cp -fv temp-epyc7002-config.json ${workfile} | |
else | |
cp -fv temp-dt-config.json ${workfile} | |
fi | |
fi | |
jsonfile=$(jq ".os.id=\"${dsmid}_${REV}\"" ${workfile}) && echo $jsonfile | jq . > ${workfile} | |
jsonfile=$(jq ".os.pat_url=\"${URL}\"" ${workfile}) && echo $jsonfile | jq . > ${workfile} | |
ossha256=$(sha256sum /opt/build/ds.pat | awk '{print $1}') | |
jsonfile=$(jq ".os.sha256=\"${ossha256}\"" ${workfile}) && echo $jsonfile | jq . > ${workfile} | |
value=$(sha256sum /opt/build/pat/zImage | awk '{print $1}') | |
jsonfile=$(jq ".files.zlinux.sha256=\"${value}\"" ${workfile}) && echo $jsonfile | jq . > ${workfile} | |
value=$(sha256sum /opt/build/pat/rd.gz | awk '{print $1}') | |
jsonfile=$(jq ".files.ramdisk.sha256=\"${value}\"" ${workfile}) && echo $jsonfile | jq . > ${workfile} | |
sed -i "s/DSM_MODEL/${file}/" ${workfile} | |
sed -i "s/v0.0.0/v${DSMVER}/" ${workfile} | |
sed -i "s/00000/${REV}/" ${workfile} | |
# sha256 | |
sha256sum /opt/build/ds.pat | awk '{print $1}' | awk '{print $1 " '${file}' os.sha256"}' >> /opt/dist/files-chksum | |
sha256sum /opt/build/pat/zImage | awk '{print $1}' | awk '{print $1 " '${file}' files.zlinux.sha256"}' >> /opt/dist/files-chksum | |
sha256sum /opt/build/pat/rd.gz | awk '{print $1}' | awk '{print $1 " '${file}' files.ramdisk.sha256"}' >> /opt/dist/files-chksum | |
echo "" >> /opt/dist/files-chksum | |
echo "" >> /opt/dist/files-chksum | |
# md5 | |
md5sum /opt/build/ds.pat | awk '{print $1}' | awk '{print $1 " '${file}' os.md5"}' >> /opt/dist/md5-chksum | |
echo "" >> /opt/dist/md5-chksum | |
if [ $(echo ${PLATFORMS} | grep ${platform_name} | wc -l ) -eq 0 ]; then | |
jsonfile=$(jq '.build_configs += [ | |
{ | |
"id": "'$dsmid'-'$DSMVER'-'$REV'", | |
"platform_name": "'$platform_name'", | |
"downloads": { | |
"os": { | |
"sha256": "'$ossha256'" | |
} | |
}, | |
"add_extensions": [ | |
{ | |
"all-modules": "https://raw.githubusercontent.com/PeterSuh-Q3/tcrp-modules/master/all-modules/rpext-index.json", | |
"storagepanel": "https://raw.githubusercontent.com/PeterSuh-Q3/tcrp-addons/master/storagepanel/rpext-index.json" | |
}] | |
} | |
]' /opt/dist/custom_config.json) | |
else | |
jsonfile=$(jq '.build_configs += [ | |
{ | |
"id": "'$dsmid'-'$DSMVER'-'$REV'", | |
"platform_name": "'$platform_name'", | |
"downloads": { | |
"os": { | |
"sha256": "'$ossha256'" | |
} | |
}, | |
"add_extensions": [ | |
{ | |
"all-modules": "https://raw.githubusercontent.com/PeterSuh-Q3/tcrp-modules/master/all-modules/rpext-index.json", | |
"powersched": "https://raw.githubusercontent.com/PeterSuh-Q3/tcrp-addons/master/powersched/rpext-index.json", | |
"storagepanel": "https://raw.githubusercontent.com/PeterSuh-Q3/tcrp-addons/master/storagepanel/rpext-index.json" | |
}] | |
} | |
]' /opt/dist/custom_config.json) | |
fi | |
echo $jsonfile | jq . > /opt/dist/custom_config.json | |
ls -l | |
echo 'Clean Directory!!!!!!!!!!!!!' | |
sudo find /opt/build/pat -delete | |
sudo find /opt/build/synoesp -delete | |
ls -l | |
done | |
- name: Upload | |
uses: actions/upload-artifact@v2 | |
with: | |
name: kernel-bs-fb-patch-for-all | |
path: /opt/dist |