2022-12-16 19:34:30 +07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-05-19 15:12:00 +07:00
|
|
|
TOOLKIT_VER="${TOOLKIT_VER:-7.2}"
|
|
|
|
|
2022-12-16 19:34:30 +07:00
|
|
|
TMP_PATH="/tmp"
|
|
|
|
DEST_PATH="output"
|
|
|
|
|
|
|
|
mkdir -p "${DEST_PATH}"
|
|
|
|
|
2022-12-28 23:30:45 +07:00
|
|
|
#if [ -f ../arpl/PLATFORMS ]; then
|
|
|
|
# cp ../arpl/PLATFORMS PLATFORMS
|
|
|
|
#else
|
|
|
|
# curl -sLO "https://github.com/fbelavenuto/arpl/raw/main/PLATFORMS"
|
|
|
|
#fi
|
2022-12-16 19:34:30 +07:00
|
|
|
|
|
|
|
function compileLkm() {
|
|
|
|
PLATFORM=$1
|
|
|
|
KVER=$2
|
|
|
|
OUT_PATH="${TMP_PATH}/${PLATFORM}"
|
|
|
|
mkdir -p "${OUT_PATH}"
|
|
|
|
# Compile using docker
|
2023-05-19 15:12:00 +07:00
|
|
|
docker run --rm -t --entrypoint=/usr/bin/compile.sh \
|
|
|
|
-v "${PWD}"/tools/compile.sh:/usr/bin/compile.sh \
|
|
|
|
-v "${PWD}":/input \
|
|
|
|
-v "${OUT_PATH}":/output \
|
|
|
|
ghcr.io/jim3ma/docker-syno-toolkit:${PLATFORM}-${TOOLKIT_VER} compile-lkm
|
2022-12-16 19:34:30 +07:00
|
|
|
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
|
|
|
|
while read PLATFORM KVER; do
|
|
|
|
compileLkm "${PLATFORM}" "${KVER}" &
|
|
|
|
done < PLATFORMS
|
2023-05-19 15:12:00 +07:00
|
|
|
wait
|