forked from RedPill-TTG/redpill-lkm
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcompile-lkms.sh
executable file
·45 lines (39 loc) · 1.3 KB
/
compile-lkms.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -e
TMP_PATH="/tmp"
DEST_PATH="output"
TOOLKIT_VER="7.1"
mkdir -p "${DEST_PATH}"
if [ -f ./PLATFORMS ]; then
#cp ./PLATFORMS PLATFORMS
#cat ./PLATFROMS
ls
else
curl -sLO "https://github.com/fbelavenuto/arpl/raw/main/PLATFORMS"
fi
function compileLkm() {
PLATFORM=$1
KVER=$2
OUT_PATH="${TMP_PATH}/${PLATFORM}"
mkdir -p "${OUT_PATH}"
sudo chmod 1777 "${OUT_PATH}"
# Compile using docker
# docker run --rm -t -v "${OUT_PATH}":/output -v "${PWD}":/input \
# fbelavenuto/syno-toolkit:${PLATFORM}-${TOOLKIT_VER} compile-lkm
docker run -u 1000 --rm -t -v "${OUT_PATH}":/output -v "${PWD}":/input \
fbelavenuto/syno-compiler:${TOOLKIT_VER} compile-lkm ${PLATFORM}
mv "${OUT_PATH}/redpill-dev.ko" "${DEST_PATH}/rp-${PLATFORM}-${KVER}-dev.ko"
rm -f "${DEST_PATH}/rp-${PLATFORM}-${KVER}-dev.ko.gz"
gzip "${DEST_PATH}/rp-${PLATFORM}-${KVER}-dev.ko"
mv "${OUT_PATH}/redpill-prod.ko" "${DEST_PATH}/rp-${PLATFORM}-${KVER}-prod.ko"
rm -f "${DEST_PATH}/rp-${PLATFORM}-${KVER}-prod.ko.gz"
gzip "${DEST_PATH}/rp-${PLATFORM}-${KVER}-prod.ko"
rm -rf "${OUT_PATH}"
}
# Main
docker pull fbelavenuto/syno-compiler:${TOOLKIT_VER}
while read PLATFORM KVER; do
# docker pull fbelavenuto/syno-toolkit:${PLATFORM}-${TOOLKIT_VER}
compileLkm "${PLATFORM}" "${KVER}" &
done < PLATFORMS
wait