mirror of
https://ghproxy.com/https://github.com/tossp/redpill-tool-chain.git
synced 2025-04-17 04:23:39 +00:00
chore(all): update to v0.10.6
This commit is contained in:
parent
54507520ec
commit
c1a3f0fae6
|
@ -23,8 +23,10 @@
|
|||
|
||||
# 如何使用?
|
||||
|
||||
1. 复制`sample_user_config.json`为`bromolow_user_config.json`或者`apollolake_user_config.json`
|
||||
1. 编辑`<platform>_user_config.json`比如 918+ 就编辑 `apollolake_user_config.json` 文件
|
||||
1. 编辑`global_config.json`中的`docker.use_custom_bind_mounts`和`docker.custom_bind_mounts.host_path`两个字段,并放入扩展驱动
|
||||
1. 添加扩展驱动:
|
||||
比如 `redpill_tool_chain.sh add https://raw.githubusercontent.com/tossp/rp-ext/master/mpt3sas/rpext-index.json`
|
||||
1. 为你想要的平台和版本构建编译镜像:
|
||||
比如 `redpill_tool_chain.sh build apollolake-7.0-41890`
|
||||
1. 为你想要的平台和版本构建引导:
|
||||
|
@ -32,10 +34,15 @@
|
|||
|
||||
`redpill_tool_chain.sh auto`运行结束之后,将会在宿主机的`./image`文件夹中生成 RedPill引导镜像。
|
||||
|
||||
`<platform>_user_config.json`文件中的`extensions`字段保持为空,会自动打包所有已安装的自定义驱动。
|
||||
自定义驱动请按需添加,尽量不要加载无关驱动,否则会因为扩展驱动太大导致打包失败。
|
||||
|
||||
依赖: `docker`
|
||||
|
||||
# 其他说明
|
||||
为了方便我自己
|
||||
- `docker/Dockerfile` 中补入了阿里云镜像
|
||||
- `redpill_tool_chain.sh add <URL>`添加扩展驱动
|
||||
- `redpill_tool_chain.sh del <ID>`删除扩展驱动
|
||||
- `redpill_tool_chain.sh run <platform_version>`自定义引导构建过程
|
||||
- `dd if=$(ls -lt ./images/redpill-* | awk 'NR==1{print $9}') of=/dev/synoboot bs=4M && sync`写入引导
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"extra_cmdline": {
|
||||
"pid": "0x0001",
|
||||
"vid": "0x46f4",
|
||||
"sn": "1234XXX123",
|
||||
"mac1": "XXYYXXYYXXYY"
|
||||
},
|
||||
"synoinfo": {},
|
||||
"ramdisk_copy": {}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"extra_cmdline": {
|
||||
"pid": "0x0001",
|
||||
"vid": "0x46f4",
|
||||
"sn": "1234XXX123",
|
||||
"mac1": "XXYYXXYYXXYY"
|
||||
},
|
||||
"synoinfo": {},
|
||||
"ramdisk_copy": {}
|
||||
}
|
|
@ -8,10 +8,10 @@
|
|||
"auto_clean": "false",
|
||||
"use_build_cache": "true",
|
||||
"clean_images": "all",
|
||||
"use_custom_bind_mounts": "false",
|
||||
"use_custom_bind_mounts": "true",
|
||||
"custom_bind_mounts": [
|
||||
{
|
||||
"host_path": "change_me",
|
||||
"host_path": "./custom",
|
||||
"container_path": "/opt/redpill-load/custom"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
cd $(dirname $(readlink -f "$0"))
|
||||
|
||||
function checkPreconditon(){
|
||||
missing_tools=""
|
||||
|
@ -110,6 +111,50 @@ function runContainer(){
|
|||
${DOCKER_IMAGE_NAME}:${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} $( [ "${CMD}" == "run" ] && echo "/bin/bash")
|
||||
}
|
||||
|
||||
function __ext_add(){
|
||||
if [ -z ${EXT_PATH} ]; then
|
||||
echo "Custom extension directory is not enabled"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d ${EXT_PATH} ];then
|
||||
mkdir ${EXT_PATH}
|
||||
fi
|
||||
readonly URL="${1}"
|
||||
local MRP_TMP_IDX="${EXT_PATH}/_new_ext_index.tmp_json"
|
||||
|
||||
if [ -f ${MRP_TMP_IDX} ];then
|
||||
rm ${MRP_TMP_IDX}
|
||||
fi
|
||||
|
||||
echo "Downloading"
|
||||
curl --progress-bar --location ${URL} --output ${MRP_TMP_IDX}
|
||||
|
||||
ext_json=$(cat ${MRP_TMP_IDX})
|
||||
ext_id=$(getValueByJsonPath ".id" "${ext_json}")
|
||||
ext_name=$(getValueByJsonPath ".info.name" "${ext_json}")
|
||||
ext_releases="$(getValueByJsonPath ".releases|keys|join(\" \")" "${ext_json}")"
|
||||
echo -e "${ext_id}\nName:\t\t\t${ext_id}\nDescription:\t\t$(getValueByJsonPath ".info.description" "${ext_json}")\nSupport platform:\t${ext_releases}\nInstallation is complete!"
|
||||
if [ ! -d "${EXT_PATH}/${ext_id}/${ext_id}" ];then
|
||||
mkdir -p ${EXT_PATH}/${ext_id}
|
||||
fi
|
||||
echo ${ext_json} > "${EXT_PATH}/${ext_id}/${ext_id}.json"
|
||||
rm ${MRP_TMP_IDX}
|
||||
}
|
||||
|
||||
function __ext_del(){
|
||||
if [ -z ${EXT_PATH} ]; then
|
||||
echo "Custom extension directory is not enabled"
|
||||
exit 1
|
||||
fi
|
||||
for i in ${EXTENSION_IDS}
|
||||
do
|
||||
if [ "${i}" == "${1}" ]; then
|
||||
rm -rf "${EXT_PATH}/${1}"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function downloadFromUrlIfNotExists(){
|
||||
local DOWNLOAD_URL="${1}"
|
||||
local OUT_FILE="${2}"
|
||||
|
@ -150,10 +195,20 @@ Actions: build, auto, run, clean
|
|||
- clean: Removes old (=dangling) images and the build cache for a platform version.
|
||||
Use ‘all’ as platform version to remove images and build caches for all platform versions.
|
||||
|
||||
- add: To install extension you need to know its index file location and nothing more.
|
||||
eg: add 'https://example.com/some-extension/rpext-index.json'
|
||||
|
||||
- del: To remove an already installed extension you need to know its ID.
|
||||
eg: del 'example_dev.some_extension'
|
||||
|
||||
Available platform versions:
|
||||
---------------------
|
||||
${AVAILABLE_IDS}
|
||||
|
||||
Custom Extensions:
|
||||
---------------------
|
||||
${EXTENSION_IDS}
|
||||
|
||||
Check global_settings.json for settings.
|
||||
EOF
|
||||
}
|
||||
|
@ -181,6 +236,25 @@ 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}")
|
||||
|
||||
EXT_PATH=""
|
||||
EXTENSION_IDS="[Nothing]"
|
||||
|
||||
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
|
||||
EXT_PATH="${HOST_PATH}/extensions"
|
||||
fi
|
||||
|
||||
if [[ "${CONTAINER_PATH}" == "/opt/redpill-load/custom" && -d "${EXT_PATH}" ]];then
|
||||
EXTENSION_IDS=$(ls ${EXT_PATH})
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
showHelp
|
||||
exit 1
|
||||
|
@ -189,7 +263,7 @@ fi
|
|||
ACTION=${1}
|
||||
ID=${2}
|
||||
|
||||
if [ "${ID}" != "all" ]; then
|
||||
if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${ID}" != "all" ]]; then
|
||||
BUILD_CONFIG=$(getValueByJsonPath ".build_configs[] | select(.id==\"${ID}\")" "${CONFIG}")
|
||||
if [ -z "${BUILD_CONFIG}" ];then
|
||||
echo "Error: Platform version ${ID} not specified in global_config.json"
|
||||
|
@ -226,13 +300,22 @@ if [ "${ID}" != "all" ]; then
|
|||
EXTRACTED_KSRC="/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${DSM_VERSION}/build/"
|
||||
fi
|
||||
else
|
||||
if [ "${ACTION}" != "clean" ]; then
|
||||
if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${ACTION}" != "clean" ]]; then
|
||||
echo "All is not supported for action \"${ACTION}\""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
case "${ACTION}" in
|
||||
add) __ext_add "${2}"
|
||||
;;
|
||||
del) __ext_del "${2}"
|
||||
echo -e "Extension ID '${2}' not found:\n---------------------\n${EXTENSION_IDS}"
|
||||
exit 1
|
||||
;;
|
||||
build) if [ "${COMPILE_WITH}" == "kernel" ];then
|
||||
downloadFromUrlIfNotExists "${KERNEL_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${KERNEL_FILENAME}" "Kernel"
|
||||
else
|
||||
|
|
11
sample_user_config.json
Normal file
11
sample_user_config.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extra_cmdline": {
|
||||
"pid": "0x0001",
|
||||
"vid": "0x46f4",
|
||||
"sn": "1234XXX123",
|
||||
"mac1": "XXYYXXYYXXYY"
|
||||
},
|
||||
"synoinfo": {},
|
||||
"ramdisk_copy": {},
|
||||
"extensions": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user