mirror of
https://ghproxy.com/https://github.com/tossp/redpill-tool-chain.git
synced 2024-09-20 08:07:43 +00:00
chore(all): update to 0.9.1
This commit is contained in:
parent
0438ac941e
commit
51b56c059d
|
@ -20,7 +20,7 @@ all:
|
|||
|
||||
.PHONY: build_redpill_lkm
|
||||
build_redpill_lkm:
|
||||
@$(MAKE) -C $(REDPILL_LKM_SRC) LINUX_SRC=$(LINUX_SRC) && \
|
||||
@$(MAKE) -C $(REDPILL_LKM_SRC) LINUX_SRC=$(LINUX_SRC) -j dev-v7 && \
|
||||
echo "#############################################" && \
|
||||
modinfo $(REDPILL_LKM_SRC)/redpill.ko
|
||||
|
||||
|
|
|
@ -6,8 +6,15 @@
|
|||
"local_rp_load_use": "false",
|
||||
"local_rp_load_path": "./redpill-load",
|
||||
"auto_clean": "false",
|
||||
"use_build_cache": "false",
|
||||
"clean_images": "all"
|
||||
"use_build_cache": "true",
|
||||
"clean_images": "all",
|
||||
"use_custom_bind_mounts": "false",
|
||||
"custom_bind_mounts": [
|
||||
{
|
||||
"host_path": "change_me",
|
||||
"container_path": "/change_me"
|
||||
}
|
||||
]
|
||||
},
|
||||
"build_configs": [
|
||||
{
|
||||
|
@ -16,9 +23,15 @@
|
|||
"user_config_json": "bromolow_user_config.json",
|
||||
"docker_base_image": "ubuntu:20.04",
|
||||
"compile_with": "kernel",
|
||||
"download_urls": {
|
||||
"kernel": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/bromolow-source/linux-3.10.x.txz/download",
|
||||
"toolkit_dev": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM6.2/ds.bromolow-6.2.dev.txz/download"
|
||||
"downloads": {
|
||||
"kernel": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/bromolow-source/linux-3.10.x.txz/download",
|
||||
"sha256": "18aecead760526d652a731121d5b8eae5d6e45087efede0da057413af0b489ed"
|
||||
},
|
||||
"toolkit_dev": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM6.2/ds.bromolow-6.2.dev.txz/download",
|
||||
"sha256": "7a0f0ec5919cd67b9972a21f234603c0e608d647baff067029bd46d8a5d660de"
|
||||
}
|
||||
},
|
||||
"redpill_lkm": {
|
||||
"source_url": "https://github.com/RedPill-TTG/redpill-lkm.git",
|
||||
|
@ -35,9 +48,15 @@
|
|||
"user_config_json": "bromolow_user_config.json",
|
||||
"docker_base_image": "ubuntu:20.04",
|
||||
"compile_with": "toolkit_dev",
|
||||
"download_urls": {
|
||||
"kernel": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/bromolow-source/linux-3.10.x.txz/download",
|
||||
"toolkit_dev": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.bromolow-7.0.dev.txz/download"
|
||||
"downloads": {
|
||||
"kernel": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/bromolow-source/linux-3.10.x.txz/download",
|
||||
"sha256": "18aecead760526d652a731121d5b8eae5d6e45087efede0da057413af0b489ed"
|
||||
},
|
||||
"toolkit_dev": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.bromolow-7.0.dev.txz/download",
|
||||
"sha256": "a5fbc3019ae8787988c2e64191549bfc665a5a9a4cdddb5ee44c10a48ff96cdd"
|
||||
}
|
||||
},
|
||||
"redpill_lkm": {
|
||||
"source_url": "https://github.com/RedPill-TTG/redpill-lkm.git",
|
||||
|
@ -54,9 +73,15 @@
|
|||
"user_config_json": "apollolake_user_config.json",
|
||||
"docker_base_image": "ubuntu:20.04",
|
||||
"compile_with": "kernel",
|
||||
"download_urls": {
|
||||
"kernel": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/apollolake-source/linux-4.4.x.txz/download",
|
||||
"toolkit_dev": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM6.2/ds.apollolake-6.2.dev.txz/download"
|
||||
"downloads": {
|
||||
"kernel": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/apollolake-source/linux-4.4.x.txz/download",
|
||||
"sha256": "af815ee065775d2e569fd7176e25c8ba7ee17a03361557975c8e5a4b64230c5b"
|
||||
},
|
||||
"toolkit_dev": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM6.2/ds.apollolake-6.2.dev.txz/download",
|
||||
"sha256": "4ed228ed21e4190f1ad77a565616409ea1bfb9d271dbf523c636c62c2e8dcf89"
|
||||
}
|
||||
},
|
||||
"redpill_lkm": {
|
||||
"source_url": "https://github.com/RedPill-TTG/redpill-lkm.git",
|
||||
|
@ -73,9 +98,15 @@
|
|||
"user_config_json": "apollolake_user_config.json",
|
||||
"docker_base_image": "ubuntu:20.04",
|
||||
"compile_with": "toolkit_dev",
|
||||
"download_urls": {
|
||||
"kernel": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/apollolake-source/linux-4.4.x.txz/download",
|
||||
"toolkit_dev": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.apollolake-7.0.dev.txz/download"
|
||||
"downloads": {
|
||||
"kernel": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/apollolake-source/linux-4.4.x.txz/download",
|
||||
"sha256": "af815ee065775d2e569fd7176e25c8ba7ee17a03361557975c8e5a4b64230c5b"
|
||||
},
|
||||
"toolkit_dev": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.apollolake-7.0.dev.txz/download",
|
||||
"sha256": "d349fa644392d4cfab8191243ee38aaa32bd517208c144678e0c855cb5a619ea"
|
||||
}
|
||||
},
|
||||
"redpill_lkm": {
|
||||
"source_url": "https://github.com/RedPill-TTG/redpill-lkm.git",
|
||||
|
@ -92,17 +123,23 @@
|
|||
"user_config_json": "apollolake_user_config.json",
|
||||
"docker_base_image": "ubuntu:20.04",
|
||||
"compile_with": "toolkit_dev",
|
||||
"download_urls": {
|
||||
"kernel": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/apollolake-source/linux-4.4.x.txz/download",
|
||||
"toolkit_dev": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.apollolake-7.0.dev.txz/download"
|
||||
"downloads": {
|
||||
"kernel": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/apollolake-source/linux-4.4.x.txz/download",
|
||||
"sha256": "af815ee065775d2e569fd7176e25c8ba7ee17a03361557975c8e5a4b64230c5b"
|
||||
},
|
||||
"toolkit_dev": {
|
||||
"url": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.apollolake-7.0.dev.txz/download",
|
||||
"sha256": "d349fa644392d4cfab8191243ee38aaa32bd517208c144678e0c855cb5a619ea"
|
||||
}
|
||||
},
|
||||
"redpill_lkm": {
|
||||
"source_url": "https://github.com/RedPill-TTG/redpill-lkm.git",
|
||||
"branch": "master"
|
||||
},
|
||||
"redpill_load": {
|
||||
"source_url": "https://github.com/chchia/redpill-load.git",
|
||||
"branch": "master"
|
||||
"source_url": "https://github.com/jumkey/redpill-load",
|
||||
"branch": "develop"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
function checkPreconditon(){
|
||||
missing_tools=""
|
||||
for tool in jq docker realpath sha256sum; do
|
||||
if [ ! $(which ${tool} ) ];then
|
||||
missing_tools+=" ${tool}"
|
||||
fi
|
||||
done
|
||||
if [ ${#missing_tools} -gt 0 ]; then
|
||||
echo "required tool(s) missing:$missing_tools. Please install them and run the command again!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
checkPreconditon
|
||||
|
||||
function readConfig() {
|
||||
cat global_config.json
|
||||
}
|
||||
|
@ -12,13 +26,17 @@ function getValueByJsonPath(){
|
|||
}
|
||||
|
||||
function buildImage(){
|
||||
local KERNEL_SRC_FILENAME=$( [ "${COMPILE_WITH}" == "kernel" ] && echo "${KERNEL_FILENAME}" || echo "${TOOLKIT_DEV_FILENAME}")
|
||||
local KERNEL_SRC_FILENAME_SHA256=$( [ "${COMPILE_WITH}" == "kernel" ] && echo "${KERNEL_DOWNLOAD_SHA256}" || echo "${TOOLKIT_DEV_DOWNLOAD_SHA256}")
|
||||
checkFileSHA256Checksum "${DOWNLOAD_FOLDER}/${KERNEL_SRC_FILENAME}" "${KERNEL_SRC_FILENAME_SHA256}"
|
||||
|
||||
[ "${USE_BUILDKIT}" == "true" ] && export DOCKER_BUILDKIT=1
|
||||
docker build --file docker/Dockerfile --force-rm --pull \
|
||||
docker build --file docker/Dockerfile --force-rm \
|
||||
$( [ "${USE_BUILD_CACHE}" == "false" ] && echo "--no-cache" ) \
|
||||
--build-arg DOCKER_BASE_IMAGE="${DOCKER_BASE_IMAGE}" \
|
||||
--build-arg COMPILE_WITH="${COMPILE_WITH}" \
|
||||
--build-arg EXTRACTED_KSRC="${EXTRACTED_KSRC}" \
|
||||
--build-arg KERNEL_SRC_FILENAME="$( [ "${COMPILE_WITH}" == "kernel" ] && echo "${KERNEL_FILENAME}" || echo "${TOOLKIT_DEV_FILENAME}")" \
|
||||
--build-arg KERNEL_SRC_FILENAME="${KERNEL_SRC_FILENAME}" \
|
||||
--build-arg REDPILL_LKM_REPO="${REDPILL_LKM_REPO}" \
|
||||
--build-arg REDPILL_LKM_BRANCH="${REDPILL_LKM_BRANCH}" \
|
||||
--build-arg REDPILL_LOAD_REPO="${REDPILL_LOAD_REPO}" \
|
||||
|
@ -61,10 +79,23 @@ function runContainer(){
|
|||
echo "Local redpill-load path does not exist: ${LOCAL_RP_LOAD_PATH}"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${USE_CUSTOM_BIND_MOUNTS}" == "true" ]]; then
|
||||
NUMBER_OF_MOUNTS=$(getValueByJsonPath ". | length" "${CUSTOM_BIND_MOUNTS}")
|
||||
for (( i=0; i<${NUMBER_OF_MOUNTS}; i++ ));do
|
||||
HOST_PATH=$(getValueByJsonPath ".[${i}].host_path" "${CUSTOM_BIND_MOUNTS}")
|
||||
CONTAINER_PATH=$(getValueByJsonPath ".[${i}].container_path" "${CUSTOM_BIND_MOUNTS}")
|
||||
if [ ! -e $(realpath "${HOST_PATH}") ]; then
|
||||
echo "Host path does not exist: ${HOST_PATH}"
|
||||
exit 1
|
||||
fi
|
||||
BINDS+="--volume $(realpath ${HOST_PATH}):${CONTAINER_PATH} "
|
||||
done
|
||||
fi
|
||||
docker run --privileged --rm $( [ "${CMD}" == "run" ] && echo " --interactive") --tty \
|
||||
--name redpill-tool-chain \
|
||||
--hostname redpill-tool-chain \
|
||||
--volume /dev:/dev \
|
||||
$( [ "${USE_CUSTOM_BIND_MOUNTS}" == "true" ] && echo "${BINDS}") \
|
||||
$( [ "${LOCAL_RP_LOAD_USE}" == "true" ] && echo "--volume $(realpath ${LOCAL_RP_LOAD_PATH}):/opt/redpill-load") \
|
||||
$( [ -e "${USER_CONFIG_JSON}" ] && echo "--volume $(realpath ${USER_CONFIG_JSON}):/opt/redpill-load/user_config.json") \
|
||||
--volume ${REDPILL_LOAD_CACHE}:/opt/redpill-load/cache \
|
||||
|
@ -87,6 +118,19 @@ function downloadFromUrlIfNotExists(){
|
|||
fi
|
||||
}
|
||||
|
||||
function checkFileSHA256Checksum(){
|
||||
local FILE="${1}"
|
||||
local EXPECTED_SHA256="${2}"
|
||||
local SHA256_RESULT=$(sha256sum ${FILE})
|
||||
if [ "${SHA256_RESULT%% *}" != "${EXPECTED_SHA256}" ];then
|
||||
echo "The ${FILE} is corrupted, expected sha256 checksum ${EXPECTED_SHA256}, got ${SHA256_RESULT%% *}"
|
||||
#rm -f "${FILE}"
|
||||
#echo "Deleted corrupted file ${FILE}. Please re-run your action!"
|
||||
echo "Please delete the file ${FILE} manualy and re-run your command!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function showHelp(){
|
||||
cat << EOF
|
||||
Usage: ${0} <action> <platform version>
|
||||
|
@ -112,6 +156,8 @@ Check global_settings.json for settings.
|
|||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
# mount-bind host folder with absolute path into redpill-load cache folder
|
||||
# will not work with relativfe path! If single name is used, a docker volume will be created!
|
||||
REDPILL_LOAD_CACHE=${PWD}/cache
|
||||
|
@ -130,6 +176,8 @@ AVAILABLE_IDS=$(getValueByJsonPath ".build_configs[].id" "${CONFIG}")
|
|||
AUTO_CLEAN=$(getValueByJsonPath ".docker.auto_clean" "${CONFIG}")
|
||||
USE_BUILD_CACHE=$(getValueByJsonPath ".docker.use_build_cache" "${CONFIG}")
|
||||
CLEAN_IMAGES=$(getValueByJsonPath ".docker.clean_images" "${CONFIG}")
|
||||
USE_CUSTOM_BIND_MOUNTS=$(getValueByJsonPath ".docker.use_custom_bind_mounts" "${CONFIG}")
|
||||
CUSTOM_BIND_MOUNTS=$(getValueByJsonPath ".docker.custom_bind_mounts" "${CONFIG}")
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
showHelp
|
||||
|
@ -158,11 +206,13 @@ if [ "${ID}" != "all" ]; then
|
|||
TARGET_REVISION=$(getValueByJsonPath ".platform_version | split(\"-\")[2]" "${BUILD_CONFIG}")
|
||||
USER_CONFIG_JSON=$(getValueByJsonPath ".user_config_json" "${BUILD_CONFIG}")
|
||||
DOCKER_BASE_IMAGE=$(getValueByJsonPath ".docker_base_image" "${BUILD_CONFIG}")
|
||||
KERNEL_DOWNLOAD_URL=$(getValueByJsonPath ".download_urls.kernel" "${BUILD_CONFIG}")
|
||||
COMPILE_WITH=$(getValueByJsonPath ".compile_with" "${BUILD_CONFIG}")
|
||||
KERNEL_FILENAME=$(getValueByJsonPath ".download_urls.kernel | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${BUILD_CONFIG}")
|
||||
TOOLKIT_DEV_DOWNLOAD_URL=$(getValueByJsonPath ".download_urls.toolkit_dev" "${BUILD_CONFIG}")
|
||||
TOOLKIT_DEV_FILENAME=$(getValueByJsonPath ".download_urls.toolkit_dev | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${BUILD_CONFIG}")
|
||||
KERNEL_DOWNLOAD_URL=$(getValueByJsonPath ".downloads.kernel.url" "${BUILD_CONFIG}")
|
||||
KERNEL_DOWNLOAD_SHA256=$(getValueByJsonPath ".downloads.kernel.sha256" "${BUILD_CONFIG}")
|
||||
KERNEL_FILENAME=$(getValueByJsonPath ".downloads.kernel.url | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${BUILD_CONFIG}")
|
||||
TOOLKIT_DEV_DOWNLOAD_URL=$(getValueByJsonPath ".downloads.toolkit_dev.url" "${BUILD_CONFIG}")
|
||||
TOOLKIT_DEV_DOWNLOAD_SHA256=$(getValueByJsonPath ".downloads.toolkit_dev.sha256" "${BUILD_CONFIG}")
|
||||
TOOLKIT_DEV_FILENAME=$(getValueByJsonPath ".downloads.toolkit_dev.url | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${BUILD_CONFIG}")
|
||||
REDPILL_LKM_REPO=$(getValueByJsonPath ".redpill_lkm.source_url" "${BUILD_CONFIG}")
|
||||
REDPILL_LKM_BRANCH=$(getValueByJsonPath ".redpill_lkm.branch" "${BUILD_CONFIG}")
|
||||
REDPILL_LOAD_REPO=$(getValueByJsonPath ".redpill_load.source_url" "${BUILD_CONFIG}")
|
||||
|
@ -180,8 +230,11 @@ else
|
|||
fi
|
||||
|
||||
case "${ACTION}" in
|
||||
build) downloadFromUrlIfNotExists "${KERNEL_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${KERNEL_FILENAME}" "Kernel"
|
||||
downloadFromUrlIfNotExists "${TOOLKIT_DEV_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${TOOLKIT_DEV_FILENAME}" "Toolkit Dev"
|
||||
build) if [ "${COMPILE_WITH}" == "kernel" ];then
|
||||
downloadFromUrlIfNotExists "${KERNEL_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${KERNEL_FILENAME}" "Kernel"
|
||||
else
|
||||
downloadFromUrlIfNotExists "${TOOLKIT_DEV_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${TOOLKIT_DEV_FILENAME}" "Toolkit Dev"
|
||||
fi
|
||||
buildImage
|
||||
if [ "${AUTO_CLEAN}" == "true" ]; then
|
||||
clean
|
||||
|
|
Loading…
Reference in New Issue
Block a user