chore(all): update to 0.7.2

This commit is contained in:
砼砼 2021-09-08 20:38:08 +08:00
parent 0236e07346
commit c428c8e029
No known key found for this signature in database
GPG Key ID: 3FDE30A50EA2CCEA
5 changed files with 105 additions and 56 deletions

View File

@ -7,14 +7,13 @@ THX @haydibe
- Takes care of downloading (and caching) the required sources to compile redpill.ko and the required os packages that the build process depends on. - Takes care of downloading (and caching) the required sources to compile redpill.ko and the required os packages that the build process depends on.
- Caches .pat downloads inside the container on the host. - Caches .pat downloads inside the container on the host.
- Configuration is done in the JSON file `global_config.json`; custom <platform_version> entries can be added underneath the `building_configs` block. Make sure the id is unique per block! - Configuration is done in the JSON file `global_config.json`; custom <platform_version> entries can be added underneath the `building_configs` block. Make sure the id is unique per block!
- Support a `user_config.json` per <platform_version> - Supports a `user_config.json` per <platform_version>
- ALlow to bind a local redpill-load folder into the container (set `"docker.local_rp_load_use": "true"` and set `"docker.local_rp_load_path": "path/to/rp-load"`) - Supports to bind a local redpill-load folder into the container (set `"docker.local_rp_load_use": "true"` and set `"docker.local_rp_load_path": "path/to/rp-load"`)
- Supports to clean old image versions and the build cache per <platform_version> or for `all` of them at once.
- Supports to auto clean old image versions and the build cache for the current build image, set `"docker.auto_clean":`to `"true"`.
## Changes ## Changes
- removed `user_config.json.template`, as it was orphaned and people started to use it in an unintended way. - `clean` now cleans the build cache as well
- new parameters in `global_config.json`: - added `auto_clean` to clean old images and build cache after building the image.
-- `docker.local_rp_load_use`: wether to mount a local folder with redpill-load into the build container (true/false)
-- `docker.local_rp_load_path`: path to the local copy of redpill-load to mount into the build container (absolute or relative path)
-- `build_configs[].user_config_json`: allows to defina a user_config.json per <platform_version>.
## Usage ## Usage
@ -41,7 +40,7 @@ Examples:
./redpill_tool_chain.sh ./redpill_tool_chain.sh
Usage: ./redpill_tool_chain.sh <action> <platform version> Usage: ./redpill_tool_chain.sh <action> <platform version>
Actions: build, auto, run Actions: build, auto, run, clean
- build: Build the toolchain image for the specified platform version. - build: Build the toolchain image for the specified platform version.
@ -51,24 +50,43 @@ Actions: build, auto, run
- run: Starts the toolchain container using the previously built toolchain image for the specified platform. - run: Starts the toolchain container using the previously built toolchain image for the specified platform.
Interactive Bash terminal. Interactive Bash terminal.
- 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.
Available platform versions: Available platform versions:
--------------------- ---------------------
bromolow-6.2.4-25556 bromolow-6.2.4-25556
bromolow-7.0-41222 bromolow-7.0-41222
bromolow-7.0.1-42214
apollolake-6.2.4-25556 apollolake-6.2.4-25556
apollolake-7.0-41890 apollolake-7.0-41890
apollolake-7.0.1-42214
``` ```
### Build toolchain image ### Build toolchain image
For Bromolow 6.2.4 : `./redpill_tool_chain.sh build bromolow-6.2.4-25556` For Bromolow 6.2.4 : `./redpill_tool_chain.sh build bromolow-6.2.4-25556`
For Bromolow 7.0 : `./redpill_tool_chain.sh build bromolow-7.0-41222` For Bromolow 7.0 : `./redpill_tool_chain.sh build bromolow-7.0-41222`
For Bromolow 7.0.1 : `./redpill_tool_chain.sh build bromolow-7.0.1-42214`
For Apollolake 6.2.4 : `./redpill_tool_chain.sh build apollolake-6.2.4-25556` For Apollolake 6.2.4 : `./redpill_tool_chain.sh build apollolake-6.2.4-25556`
For Apollolake 7.0 : `./redpill_tool_chain.sh build apollolake-7.0-41890` For Apollolake 7.0 : `./redpill_tool_chain.sh build apollolake-7.0-41890`
For Apollolake 7.0.1 : `./redpill_tool_chain.sh build apollolake-7.0.1-42214`
### Create redpill bootloader image ### Create redpill bootloader image
For Bromolow 6.2.4 : `./redpill_tool_chain.sh auto bromolow-6.2.4-25556` For Bromolow 6.2.4 : `./redpill_tool_chain.sh auto bromolow-6.2.4-25556`
For Bromolow 7.0 : `./redpill_tool_chain.sh auto bromolow-7.0-41222` For Bromolow 7.0 : `./redpill_tool_chain.sh auto bromolow-7.0-41222`
For Bromolow 7.0.1 : `./redpill_tool_chain.sh auto bromolow-7.0.1-42214`
For Apollolake 6.2.4 : `./redpill_tool_chain.sh auto apollolake-6.2.4-25556` For Apollolake 6.2.4 : `./redpill_tool_chain.sh auto apollolake-6.2.4-25556`
For Apollolake 7.0 : `./redpill_tool_chain.sh auto apollolake-7.0-41890` For Apollolake 7.0 : `./redpill_tool_chain.sh auto apollolake-7.0-41890`
For Apollolake 7.0.1 : `./redpill_tool_chain.sh auto apollolake-7.0.1-42214`
### Clean old redpill bootloader images and build cache
For Bromolow 6.2.4 : `./redpill_tool_chain.sh clean bromolow-6.2.4-25556`
For Bromolow 7.0 : `./redpill_tool_chain.sh clean bromolow-7.0-41222`
For Bromolow 7.0.1 : `./redpill_tool_chain.sh clean bromolow-7.0.1-42214`
For Apollolake 6.2.4 : `./redpill_tool_chain.sh clean apollolake-6.2.4-25556`
For Apollolake 7.0 : `./redpill_tool_chain.sh clean apollolake-7.0-41890`
For Apollolake 7.0.1 : `./redpill_tool_chain.sh clean apollolake-7.0.1-42214`
For all : `./redpill_tool_chain.sh clean all`

View File

@ -8,6 +8,8 @@ ADD downloads/${KERNEL_SRC_FILENAME} /
# tool chain image # tool chain image
FROM ${DOCKER_BASE_IMAGE} FROM ${DOCKER_BASE_IMAGE}
LABEL redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION}
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \ RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sed -i "s/archive.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list && \ sed -i "s/archive.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list && \

View File

@ -4,7 +4,8 @@
"image_name": "redpill-tool-chain", "image_name": "redpill-tool-chain",
"download_folder": "docker/downloads", "download_folder": "docker/downloads",
"local_rp_load_use": "false", "local_rp_load_use": "false",
"local_rp_load_path": "./redpill-load" "local_rp_load_path": "./redpill-load",
"auto_clean": "false"
}, },
"build_configs": [ "build_configs": [
{ {

View File

@ -13,7 +13,7 @@ function getValueByJsonPath(){
function buildImage(){ function buildImage(){
[ "${USE_BUILDKIT}" == "true" ] && export DOCKER_BUILDKIT=1 [ "${USE_BUILDKIT}" == "true" ] && export DOCKER_BUILDKIT=1
docker build --file docker/Dockerfile --no-cache --force-rm --pull \ docker build --file docker/Dockerfile --force-rm --pull \
--build-arg DOCKER_BASE_IMAGE="${DOCKER_BASE_IMAGE}" \ --build-arg DOCKER_BASE_IMAGE="${DOCKER_BASE_IMAGE}" \
--build-arg COMPILE_WITH="${COMPILE_WITH}" \ --build-arg COMPILE_WITH="${COMPILE_WITH}" \
--build-arg EXTRACTED_KSRC="${EXTRACTED_KSRC}" \ --build-arg EXTRACTED_KSRC="${EXTRACTED_KSRC}" \
@ -27,7 +27,29 @@ function buildImage(){
--build-arg DSM_VERSION="${DSM_VERSION}" \ --build-arg DSM_VERSION="${DSM_VERSION}" \
--build-arg TARGET_REVISION="${TARGET_REVISION}" \ --build-arg TARGET_REVISION="${TARGET_REVISION}" \
--tag ${DOCKER_IMAGE_NAME}:${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} ./docker --tag ${DOCKER_IMAGE_NAME}:${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} ./docker
} }
function clean(){
if [ "${AUTO_CLEAN}" != "true" ]; then
echo "---------- before clean --------------------------------------"
docker system df
fi
if [ "${ID}" == "all" ];then
OLD_IMAGES=$(docker image ls --filter label=redpill-tool-chain --filter dangling=true --quiet)
docker builder prune --filter label=redpill-tool-chain --force
else
OLD_IMAGES=$(docker image ls --filter label=redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} --filter dangling=true --quiet)
docker builder prune --filter label=redpill-tool-chain=${TARGET_PLATFORM}-${TARGET_VERSION}-${TARGET_REVISION} --force
fi
if [ ! -z "${OLD_IMAGES}" ]; then
docker image rm ${OLD_IMAGES}
fi
if [ "${AUTO_CLEAN}" != "true" ]; then
echo "---------- after clean ---------------------------------------"
docker system df
fi
}
function runContainer(){ function runContainer(){
local CMD=${1} local CMD=${1}
@ -69,7 +91,7 @@ function showHelp(){
cat << EOF cat << EOF
Usage: ${0} <action> <platform version> Usage: ${0} <action> <platform version>
Actions: build, auto, run Actions: build, auto, run, clean
- build: Build the toolchain image for the specified platform version. - build: Build the toolchain image for the specified platform version.
@ -79,6 +101,9 @@ Actions: build, auto, run
- run: Starts the toolchain container using the previously built toolchain image for the specified platform. - run: Starts the toolchain container using the previously built toolchain image for the specified platform.
Interactive Bash terminal. Interactive Bash terminal.
- 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.
Available platform versions: Available platform versions:
--------------------- ---------------------
${AVAILABLE_IDS} ${AVAILABLE_IDS}
@ -102,6 +127,7 @@ REDPILL_LOAD_IMAGES=${PWD}/images
# parse paramters from config # parse paramters from config
CONFIG=$(readConfig) CONFIG=$(readConfig)
AVAILABLE_IDS=$(getValueByJsonPath ".build_configs[].id" "${CONFIG}") AVAILABLE_IDS=$(getValueByJsonPath ".build_configs[].id" "${CONFIG}")
AUTO_CLEAN=$(getValueByJsonPath ".docker.auto_clean" "${CONFIG}")
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
showHelp showHelp
@ -110,48 +136,61 @@ fi
ACTION=${1} ACTION=${1}
ID=${2} ID=${2}
BUILD_CONFIG=$(getValueByJsonPath ".build_configs[] | select(.id==\"${ID}\")" "${CONFIG}")
if [ -z "${BUILD_CONFIG}" ];then if [ "${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" echo "Error: Platform version ${ID} not specified in global_config.json"
echo echo
showHelp showHelp
exit 1 exit 1
fi fi
USE_BUILDKIT=$(getValueByJsonPath ".docker.use_buildkit" "${CONFIG}") USE_BUILDKIT=$(getValueByJsonPath ".docker.use_buildkit" "${CONFIG}")
DOCKER_IMAGE_NAME=$(getValueByJsonPath ".docker.image_name" "${CONFIG}") DOCKER_IMAGE_NAME=$(getValueByJsonPath ".docker.image_name" "${CONFIG}")
DOWNLOAD_FOLDER=$(getValueByJsonPath ".docker.download_folder" "${CONFIG}") DOWNLOAD_FOLDER=$(getValueByJsonPath ".docker.download_folder" "${CONFIG}")
LOCAL_RP_LOAD_USE=$(getValueByJsonPath ".docker.local_rp_load_use" "${CONFIG}") LOCAL_RP_LOAD_USE=$(getValueByJsonPath ".docker.local_rp_load_use" "${CONFIG}")
LOCAL_RP_LOAD_PATH=$(getValueByJsonPath ".docker.local_rp_load_path" "${CONFIG}") LOCAL_RP_LOAD_PATH=$(getValueByJsonPath ".docker.local_rp_load_path" "${CONFIG}")
TARGET_PLATFORM=$(getValueByJsonPath ".platform_version | split(\"-\")[0]" "${BUILD_CONFIG}") TARGET_PLATFORM=$(getValueByJsonPath ".platform_version | split(\"-\")[0]" "${BUILD_CONFIG}")
TARGET_VERSION=$(getValueByJsonPath ".platform_version | split(\"-\")[1]" "${BUILD_CONFIG}") TARGET_VERSION=$(getValueByJsonPath ".platform_version | split(\"-\")[1]" "${BUILD_CONFIG}")
DSM_VERSION=$(getValueByJsonPath ".platform_version | split(\"-\")[1][0:3]" "${BUILD_CONFIG}") DSM_VERSION=$(getValueByJsonPath ".platform_version | split(\"-\")[1][0:3]" "${BUILD_CONFIG}")
TARGET_REVISION=$(getValueByJsonPath ".platform_version | split(\"-\")[2]" "${BUILD_CONFIG}") TARGET_REVISION=$(getValueByJsonPath ".platform_version | split(\"-\")[2]" "${BUILD_CONFIG}")
USER_CONFIG_JSON=$(getValueByJsonPath ".user_config_json" "${BUILD_CONFIG}") USER_CONFIG_JSON=$(getValueByJsonPath ".user_config_json" "${BUILD_CONFIG}")
DOCKER_BASE_IMAGE=$(getValueByJsonPath ".docker_base_image" "${BUILD_CONFIG}") DOCKER_BASE_IMAGE=$(getValueByJsonPath ".docker_base_image" "${BUILD_CONFIG}")
KERNEL_DOWNLOAD_URL=$(getValueByJsonPath ".download_urls.kernel" "${BUILD_CONFIG}") KERNEL_DOWNLOAD_URL=$(getValueByJsonPath ".download_urls.kernel" "${BUILD_CONFIG}")
COMPILE_WITH=$(getValueByJsonPath ".compile_with" "${BUILD_CONFIG}") COMPILE_WITH=$(getValueByJsonPath ".compile_with" "${BUILD_CONFIG}")
KERNEL_FILENAME=$(getValueByJsonPath ".download_urls.kernel | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${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_DOWNLOAD_URL=$(getValueByJsonPath ".download_urls.toolkit_dev" "${BUILD_CONFIG}")
TOOLKIT_DEV_FILENAME=$(getValueByJsonPath ".download_urls.toolkit_dev | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${BUILD_CONFIG}") TOOLKIT_DEV_FILENAME=$(getValueByJsonPath ".download_urls.toolkit_dev | split(\"/\")[] | select ( . | endswith(\".txz\"))" "${BUILD_CONFIG}")
REDPILL_LKM_REPO=$(getValueByJsonPath ".redpill_lkm.source_url" "${BUILD_CONFIG}") REDPILL_LKM_REPO=$(getValueByJsonPath ".redpill_lkm.source_url" "${BUILD_CONFIG}")
REDPILL_LKM_BRANCH=$(getValueByJsonPath ".redpill_lkm.branch" "${BUILD_CONFIG}") REDPILL_LKM_BRANCH=$(getValueByJsonPath ".redpill_lkm.branch" "${BUILD_CONFIG}")
REDPILL_LOAD_REPO=$(getValueByJsonPath ".redpill_load.source_url" "${BUILD_CONFIG}") REDPILL_LOAD_REPO=$(getValueByJsonPath ".redpill_load.source_url" "${BUILD_CONFIG}")
REDPILL_LOAD_BRANCH=$(getValueByJsonPath ".redpill_load.branch" "${BUILD_CONFIG}") REDPILL_LOAD_BRANCH=$(getValueByJsonPath ".redpill_load.branch" "${BUILD_CONFIG}")
EXTRACTED_KSRC='/linux*' EXTRACTED_KSRC='/linux*'
if [ "${COMPILE_WITH}" == "toolkit_dev" ]; then if [ "${COMPILE_WITH}" == "toolkit_dev" ]; then
EXTRACTED_KSRC="/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${DSM_VERSION}/build/" 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
echo "All is not supported for action \"${ACTION}\""
exit 1
fi
fi fi
case "${ACTION}" in case "${ACTION}" in
build) downloadFromUrlIfNotExists "${KERNEL_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${KERNEL_FILENAME}" "Kernel" build) downloadFromUrlIfNotExists "${KERNEL_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${KERNEL_FILENAME}" "Kernel"
downloadFromUrlIfNotExists "${TOOLKIT_DEV_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${TOOLKIT_DEV_FILENAME}" "Toolkit Dev" downloadFromUrlIfNotExists "${TOOLKIT_DEV_DOWNLOAD_URL}" "${DOWNLOAD_FOLDER}/${TOOLKIT_DEV_FILENAME}" "Toolkit Dev"
buildImage buildImage
if [ "${AUTO_CLEAN}" == "true" ]; then
clean
fi
;; ;;
run) runContainer "run" run) runContainer "run"
;; ;;
auto) runContainer "auto" auto) runContainer "auto"
;; ;;
clean) clean
;;
*) if [ ! -z ${ACTION} ];then *) if [ ! -z ${ACTION} ];then
echo "Error: action ${ACTION} does not exist" echo "Error: action ${ACTION} does not exist"
echo "" echo ""
@ -160,4 +199,3 @@ case "${ACTION}" in
exit 1 exit 1
;; ;;
esac esac

View File

@ -1,10 +0,0 @@
{
"extra_cmdline": {
"vid": "0x1908",
"pid": "0x0226",
"sn": "1780PDN123456",
"mac1": "00505623F398"
},
"synoinfo": {},
"ramdisk_copy": {}
}