mirror of
https://ghproxy.com/https://github.com/tossp/redpill-tool-chain.git
synced 2024-09-20 08:07:43 +00:00
添加 DVA3221 支持
This commit is contained in:
parent
e252f88c21
commit
eb7df3c222
23
.github/workflows/test.yml
vendored
23
.github/workflows/test.yml
vendored
|
@ -33,6 +33,8 @@ jobs:
|
||||||
version: 7.0.1-42218
|
version: 7.0.1-42218
|
||||||
- platform: ds1621p
|
- platform: ds1621p
|
||||||
version: 7.0.1-42218
|
version: 7.0.1-42218
|
||||||
|
- platform: dva3221
|
||||||
|
version: 7.0.1-42218
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出项目文件
|
- name: 检出项目文件
|
||||||
|
@ -58,20 +60,33 @@ jobs:
|
||||||
sed -i -e 's\0x0001\0x0002\g' -e 's\0x46f4\0x0002\g' ${{matrix.platform}}_user_config.json
|
sed -i -e 's\0x0001\0x0002\g' -e 's\0x46f4\0x0002\g' ${{matrix.platform}}_user_config.json
|
||||||
|
|
||||||
# 调整SN和MAC 最好使用 actions secrets 引入
|
# 调整SN和MAC 最好使用 actions secrets 引入
|
||||||
sed -i -e 's\1234XXX123\0123456789\g' -e 's\XXYYXXYYXXYY\00AAAAAAAAAA\g' ${{matrix.platform}}_user_config.json
|
sntext=`./redpill_tool_chain.sh sn ${{matrix.platform}}`
|
||||||
|
use_sn=`echo ${sntext} | grep 'Serial Number' | awk '{print $3}'`
|
||||||
|
use_mac=`echo ${sntext} | grep 'Mac Address' | awk '{print $3}' | sed 's\:\\g'`
|
||||||
|
echo ${sntext}
|
||||||
|
sed -i -e "s\1234XXX123\${use_sn}\g" -e 's\XXYYXXYYXXYY\0011323D47F7\g' ${{matrix.platform}}_user_config.json
|
||||||
|
|
||||||
# 添加第二张网卡mac并设置网卡数量
|
# 添加第二张网卡mac并设置网卡数量
|
||||||
sed -i -e 's/00AAAAAAAAAA"/&,\n\t"mac2": "00BBBBBBBBBB",\n\t"netif_num": 2/' ${{matrix.platform}}_user_config.json
|
sed -i -e 's/0011323D47F7"/&,\n\t"mac2": "0011323D47F8",\n\t"netif_num": 2/' ${{matrix.platform}}_user_config.json
|
||||||
|
|
||||||
# 调整synoinfo
|
# 调整synoinfo
|
||||||
sed -i -e 's/"synoinfo": {},/"synoinfo": {\n\t"maxlanport": "2"\n },/' ${{matrix.platform}}_user_config.json
|
sed -i -e 's/"synoinfo": {},/"synoinfo": {\n\t"maxlanport": "2"\n },/' ${{matrix.platform}}_user_config.json
|
||||||
|
|
||||||
# 添加扩展驱动
|
- name: 添加扩展驱动[非dva3221]
|
||||||
|
if: matrix.platform != 'dva3221'
|
||||||
|
run: |
|
||||||
./redpill_tool_chain.sh add https://github.com/jumkey/redpill-load/raw/develop/redpill-acpid/rpext-index.json
|
./redpill_tool_chain.sh add https://github.com/jumkey/redpill-load/raw/develop/redpill-acpid/rpext-index.json
|
||||||
./redpill_tool_chain.sh add https://github.com/jumkey/redpill-load/raw/develop/redpill-virtio/rpext-index.json
|
./redpill_tool_chain.sh add https://github.com/jumkey/redpill-load/raw/develop/redpill-virtio/rpext-index.json
|
||||||
|
|
||||||
|
- name: 添加扩展驱动[dva3221]
|
||||||
|
if: matrix.platform = 'dva3221'
|
||||||
|
run: |
|
||||||
|
# ./redpill_tool_chain.sh add https://github.com/pocopico/rp-ext/raw/main/redpill/rpext-index.json
|
||||||
|
./redpill_tool_chain.sh add https://github.com/pocopico/rp-ext/raw/main/redpill/rpext-index.json
|
||||||
|
./redpill_tool_chain.sh add https://github.com/orpheegt/redpill-load/raw/develop/redpill-virtio/rpext-index.json
|
||||||
|
|
||||||
- name: 添加 jumkey.misc
|
- name: 添加 jumkey.misc
|
||||||
if: endsWith(matrix.version,'42218')
|
if: endsWith(matrix.version,'42218') && matrix.platform != 'dva3221'
|
||||||
run: |
|
run: |
|
||||||
./redpill_tool_chain.sh add https://github.com/jumkey/redpill-load/raw/develop/redpill-misc/rpext-index.json
|
./redpill_tool_chain.sh add https://github.com/jumkey/redpill-load/raw/develop/redpill-misc/rpext-index.json
|
||||||
|
|
||||||
|
|
42
README.md
42
README.md
|
@ -11,8 +11,9 @@
|
||||||
## 关于项目?
|
## 关于项目?
|
||||||
|
|
||||||
- 基于[RedPill-TTG](https://github.com/RedPill-TTG)源码制作
|
- 基于[RedPill-TTG](https://github.com/RedPill-TTG)源码制作
|
||||||
- 为`DS918+`提供适当的支持 ( 感谢 [@jumkey](https://github.com/jumkey) )
|
- 为`DS918+`提供DSM7适配支持 ( 感谢 [@jumkey](https://github.com/jumkey) )
|
||||||
- 为`DS3617xs`提供适当的支持 ( 感谢 [@jimmyGALLAND](https://github.com/jimmyGALLAND) )
|
- 为`DS3617xs`提供DSM7适配支持 ( 感谢 [@jimmyGALLAND](https://github.com/jimmyGALLAND) )
|
||||||
|
- 为`DVA3221`提供DSM7适配支持 ( 感谢 [@dogodefi](https://github.com/dogodefi) )
|
||||||
- 整理社区扩展驱动 ( 感谢 [@pocopico](https://github.com/pocopico) )
|
- 整理社区扩展驱动 ( 感谢 [@pocopico](https://github.com/pocopico) )
|
||||||
- `redpill_lkm_make_target`字段的可选值有 `dev-v6`, `dev-v7`, `test-v6`, `test-v7`, `prod-v6` 或者 `prod-v7`,
|
- `redpill_lkm_make_target`字段的可选值有 `dev-v6`, `dev-v7`, `test-v6`, `test-v7`, `prod-v6` 或者 `prod-v7`,
|
||||||
需要注意后缀为`-v6`的值用于 DSM6 版本构建, 需要注意后缀为`-v7`的值用于 DSM7 版本构建. 默认使用的是 `dev-v6` 和 `dev-v7`。
|
需要注意后缀为`-v6`的值用于 DSM6 版本构建, 需要注意后缀为`-v7`的值用于 DSM7 版本构建. 默认使用的是 `dev-v6` 和 `dev-v7`。
|
||||||
|
@ -22,20 +23,20 @@
|
||||||
|
|
||||||
如果您发现工具链的构建方式有问题或者有改进的想法,请让我知道。
|
如果您发现工具链的构建方式有问题或者有改进的想法,请让我知道。
|
||||||
|
|
||||||
对于所有其他问题:请向社区提出——我知道的并不比其他人多。
|
对于所有其他问题:请向[社区ddr](https://xpenology.com/forum/forum/35-developer-discussion-room/)提出——我知道的并不比其他人多。
|
||||||
|
|
||||||
## 如何使用?
|
## 如何使用?
|
||||||
|
|
||||||
1. 复制`sample_user_config.json`为`ds3615xs_user_config.json`或者`ds918p_user_config.json`
|
1. 复制`sample_user_config.json`为`ds3615xs_user_config.json`或者`ds918p_user_config.json`
|
||||||
1. 编辑`<platform>_user_config.json`比如 918+ 就编辑 `ds918p_user_config.json` 文件
|
1. 编辑`<platform>_user_config.json`比如 918+ 就编辑 `ds918p_user_config.json` 文件
|
||||||
1. 添加扩展驱动:
|
1. 添加扩展驱动:
|
||||||
比如 `redpill_tool_chain.sh add https://raw.githubusercontent.com/pocopico/rp-ext/master/mpt3sas/rpext-index.json`
|
比如 `./redpill_tool_chain.sh add https://raw.githubusercontent.com/pocopico/rp-ext/master/mpt3sas/rpext-index.json`
|
||||||
1. 为你想要的平台和版本构建编译镜像:
|
1. 为你想要的平台和版本构建编译镜像:
|
||||||
比如 `redpill_tool_chain.sh build ds918p-7.0-41890`
|
比如 `./redpill_tool_chain.sh build ds918p-7.0-41890`
|
||||||
1. 为你想要的平台和版本构建引导:
|
1. 为你想要的平台和版本构建引导:
|
||||||
比如 `redpill_tool_chain.sh auto ds918p-7.0-41890`
|
比如 `./redpill_tool_chain.sh auto ds918p-7.0-41890`
|
||||||
|
|
||||||
`redpill_tool_chain.sh auto`运行结束之后,将会在宿主机的`./image`文件夹中生成 RedPill引导镜像。
|
`./redpill_tool_chain.sh auto`运行结束之后,将会在宿主机的`./image`文件夹中生成 RedPill引导镜像。
|
||||||
|
|
||||||
`<platform>_user_config.json`文件中的`extensions`字段保持为空,会自动打包所有已安装的自定义驱动。
|
`<platform>_user_config.json`文件中的`extensions`字段保持为空,会自动打包所有已安装的自定义驱动。
|
||||||
自定义驱动请按需添加,尽量不要加载无关驱动,否则会因为扩展驱动太大导致打包失败。
|
自定义驱动请按需添加,尽量不要加载无关驱动,否则会因为扩展驱动太大导致打包失败。
|
||||||
|
@ -45,9 +46,9 @@
|
||||||
## 快捷说明
|
## 快捷说明
|
||||||
|
|
||||||
- `docker/Dockerfile` 中补入了阿里云镜像
|
- `docker/Dockerfile` 中补入了阿里云镜像
|
||||||
- `redpill_tool_chain.sh add <URL>`添加扩展驱动
|
- `./redpill_tool_chain.sh add <URL>`添加扩展驱动
|
||||||
- `redpill_tool_chain.sh del <ID>`删除扩展驱动
|
- `./redpill_tool_chain.sh del <ID>`删除扩展驱动
|
||||||
- `redpill_tool_chain.sh run <platform_version>`自定义引导构建过程
|
- `./redpill_tool_chain.sh run <platform_version>`自定义引导构建过程
|
||||||
- 使用`synoboot.sh`写入引导
|
- 使用`synoboot.sh`写入引导
|
||||||
|
|
||||||
### 自定义扩展驱动管理
|
### 自定义扩展驱动管理
|
||||||
|
@ -70,19 +71,25 @@
|
||||||
- `./redpill_tool_chain.sh auto ds3615xs-6.2.4-25556`
|
- `./redpill_tool_chain.sh auto ds3615xs-6.2.4-25556`
|
||||||
- `./redpill_tool_chain.sh auto ds918p-7.0.1-42218`
|
- `./redpill_tool_chain.sh auto ds918p-7.0.1-42218`
|
||||||
|
|
||||||
### Clean old redpill bootloader images and build cache
|
### 清除旧的引导镜像和缓存
|
||||||
|
|
||||||
- `./redpill_tool_chain.sh clean ds3615xs-6.2.4-25556`
|
- `./redpill_tool_chain.sh clean ds3615xs-6.2.4-25556`
|
||||||
- `./redpill_tool_chain.sh clean ds918p-7.0.1-42218`
|
- `./redpill_tool_chain.sh clean ds918p-7.0.1-42218`
|
||||||
- `./redpill_tool_chain.sh clean all`
|
- `./redpill_tool_chain.sh clean all`
|
||||||
|
|
||||||
|
### 生成指定平台的序列号和MAC地址
|
||||||
|
|
||||||
|
- `./redpill_tool_chain.sh sn ds918p`
|
||||||
|
- `./redpill_tool_chain.sh sn dva3221`
|
||||||
|
|
||||||
### 查看帮助文本
|
### 查看帮助文本
|
||||||
|
|
||||||
|
`./redpill_tool_chain.sh`
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
./redpill_tool_chain.sh
|
|
||||||
Usage: ./redpill_tool_chain.sh <action> <platform version>
|
Usage: ./redpill_tool_chain.sh <action> <platform version>
|
||||||
|
|
||||||
Actions: build, auto, run, clean
|
Actions: build, auto, run, clean, add, del, sn
|
||||||
|
|
||||||
- build: Build the toolchain image for the specified platform version.
|
- build: Build the toolchain image for the specified platform version.
|
||||||
|
|
||||||
|
@ -101,6 +108,10 @@ Actions: build, auto, run, clean
|
||||||
- del: To remove an already installed extension you need to know its ID.
|
- del: To remove an already installed extension you need to know its ID.
|
||||||
eg: del 'example_dev.some_extension'
|
eg: del 'example_dev.some_extension'
|
||||||
|
|
||||||
|
- sn: Generates a serial number and mac address for the following platforms
|
||||||
|
DS3615xs DS3617xs DS916+ DS918+ DS920+ DS3622xs+ FS6400 DVA3219 DVA3221 DS1621+
|
||||||
|
eg: sn ds920p
|
||||||
|
|
||||||
Available platform versions:
|
Available platform versions:
|
||||||
---------------------
|
---------------------
|
||||||
ds3615xs-6.2.4-25556
|
ds3615xs-6.2.4-25556
|
||||||
|
@ -113,12 +124,17 @@ ds3617xs-7.0.1-42218
|
||||||
ds3622xsp-7.0.1-42218
|
ds3622xsp-7.0.1-42218
|
||||||
ds920p-7.0.1-42218
|
ds920p-7.0.1-42218
|
||||||
ds1621p-7.0.1-42218
|
ds1621p-7.0.1-42218
|
||||||
|
dva3221-7.0.1-42218
|
||||||
|
|
||||||
Custom Extensions:
|
Custom Extensions:
|
||||||
---------------------
|
---------------------
|
||||||
|
jumkey.acpid2
|
||||||
pocopico.mpt3sas
|
pocopico.mpt3sas
|
||||||
|
pocopico.vmxnet3
|
||||||
thethorgroup.boot-wait
|
thethorgroup.boot-wait
|
||||||
thethorgroup.virtio
|
thethorgroup.virtio
|
||||||
|
|
||||||
|
Check global_settings.json for settings.
|
||||||
```
|
```
|
||||||
|
|
||||||
## 更多细节
|
## 更多细节
|
||||||
|
|
11
README_EN.md
11
README_EN.md
|
@ -58,7 +58,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, clean
|
Actions: build, auto, run, clean, add, del, sn
|
||||||
|
|
||||||
- build: Build the toolchain image for the specified platform version.
|
- build: Build the toolchain image for the specified platform version.
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@ Actions: build, auto, run, clean
|
||||||
- del: To remove an already installed extension you need to know its ID.
|
- del: To remove an already installed extension you need to know its ID.
|
||||||
eg: del 'example_dev.some_extension'
|
eg: del 'example_dev.some_extension'
|
||||||
|
|
||||||
|
- sn: Generates a serial number and mac address for the following platforms
|
||||||
|
DS3615xs DS3617xs DS916+ DS918+ DS920+ DS3622xs+ FS6400 DVA3219 DVA3221 DS1621+
|
||||||
|
eg: sn ds920p
|
||||||
|
|
||||||
Available platform versions:
|
Available platform versions:
|
||||||
---------------------
|
---------------------
|
||||||
ds3615xs-6.2.4-25556
|
ds3615xs-6.2.4-25556
|
||||||
|
@ -89,12 +93,17 @@ ds3617xs-7.0.1-42218
|
||||||
ds3622xsp-7.0.1-42218
|
ds3622xsp-7.0.1-42218
|
||||||
ds920p-7.0.1-42218
|
ds920p-7.0.1-42218
|
||||||
ds1621p-7.0.1-42218
|
ds1621p-7.0.1-42218
|
||||||
|
dva3221-7.0.1-42218
|
||||||
|
|
||||||
Custom Extensions:
|
Custom Extensions:
|
||||||
---------------------
|
---------------------
|
||||||
|
jumkey.acpid2
|
||||||
pocopico.mpt3sas
|
pocopico.mpt3sas
|
||||||
|
pocopico.vmxnet3
|
||||||
thethorgroup.boot-wait
|
thethorgroup.boot-wait
|
||||||
thethorgroup.virtio
|
thethorgroup.virtio
|
||||||
|
|
||||||
|
Check global_settings.json for settings.
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom extended driver management
|
### Custom extended driver management
|
||||||
|
|
|
@ -53,7 +53,7 @@ ENV ARCH=x86_64 \
|
||||||
ARG EXTRACTED_KSRC
|
ARG EXTRACTED_KSRC
|
||||||
COPY --from=extract ${EXTRACTED_KSRC} ${LINUX_SRC}
|
COPY --from=extract ${EXTRACTED_KSRC} ${LINUX_SRC}
|
||||||
|
|
||||||
RUN if [ "apollolake" = "$TARGET_PLATFORM" ] || [ "broadwellnk" = "$TARGET_PLATFORM" ] || [ "geminilake" = "$TARGET_PLATFORM" ] || [ "v1000" = "$TARGET_PLATFORM" ]; then echo '+' > ${LINUX_SRC}/.scmversion; fi && \
|
RUN if [ "apollolake" = "$TARGET_PLATFORM" ] || [ "broadwellnk" = "$TARGET_PLATFORM" ] || [ "geminilake" = "$TARGET_PLATFORM" ] || [ "v1000" = "$TARGET_PLATFORM" ] || [ "denverton" = "$TARGET_PLATFORM" ]; then echo '+' > ${LINUX_SRC}/.scmversion; fi && \
|
||||||
if [ "$COMPILE_WITH" = "kernel" ]; then \
|
if [ "$COMPILE_WITH" = "kernel" ]; then \
|
||||||
cp ${LINUX_SRC}/synoconfigs/${TARGET_PLATFORM} ${LINUX_SRC}/.config && \
|
cp ${LINUX_SRC}/synoconfigs/${TARGET_PLATFORM} ${LINUX_SRC}/.config && \
|
||||||
make -C ${LINUX_SRC} oldconfig && \
|
make -C ${LINUX_SRC} oldconfig && \
|
||||||
|
|
|
@ -288,6 +288,33 @@
|
||||||
"source_url": "https://github.com/jumkey/redpill-load.git",
|
"source_url": "https://github.com/jumkey/redpill-load.git",
|
||||||
"branch": "develop"
|
"branch": "develop"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dva3221-7.0.1-42218",
|
||||||
|
"platform_name": "DVA3221",
|
||||||
|
"platform_version": "denverton-7.0.1-42218",
|
||||||
|
"user_config_json": "dva3221_user_config.json",
|
||||||
|
"docker_base_image": "debian:10-slim",
|
||||||
|
"compile_with": "toolkit_dev",
|
||||||
|
"redpill_lkm_make_target": "dev-v7",
|
||||||
|
"downloads": {
|
||||||
|
"kernel": {
|
||||||
|
"url": "https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/25426branch/denverton-source/linux-4.4.x.txz/download",
|
||||||
|
"sha256": "ac532ebb221d9c55f78236d57288ac31d410dde01f1453f60b0c502333fdf107"
|
||||||
|
},
|
||||||
|
"toolkit_dev": {
|
||||||
|
"url": "https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.denverton-7.0.dev.txz/download",
|
||||||
|
"sha256": "6108f9f7b7f0a13ee985314aef9419303375ab7ded4112be991590339b66ecd1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"redpill_lkm": {
|
||||||
|
"source_url": "https://github.com/dogodefi/redpill-lkm.git",
|
||||||
|
"branch": "develop"
|
||||||
|
},
|
||||||
|
"redpill_load": {
|
||||||
|
"source_url": "https://github.com/dogodefi/redpill-load.git",
|
||||||
|
"branch": "develop"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ function showHelp(){
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: ${0} <action> <platform version>
|
Usage: ${0} <action> <platform version>
|
||||||
|
|
||||||
Actions: build, auto, run, clean
|
Actions: build, auto, run, clean, add, del, sn
|
||||||
|
|
||||||
- build: Build the toolchain image for the specified platform version.
|
- build: Build the toolchain image for the specified platform version.
|
||||||
|
|
||||||
|
@ -210,6 +210,10 @@ Actions: build, auto, run, clean
|
||||||
- del: To remove an already installed extension you need to know its ID.
|
- del: To remove an already installed extension you need to know its ID.
|
||||||
eg: del 'example_dev.some_extension'
|
eg: del 'example_dev.some_extension'
|
||||||
|
|
||||||
|
- sn: Generates a serial number and mac address for the following platforms
|
||||||
|
DS3615xs DS3617xs DS916+ DS918+ DS920+ DS3622xs+ FS6400 DVA3219 DVA3221 DS1621+
|
||||||
|
eg: sn ds920p
|
||||||
|
|
||||||
Available platform versions:
|
Available platform versions:
|
||||||
---------------------
|
---------------------
|
||||||
${AVAILABLE_IDS}
|
${AVAILABLE_IDS}
|
||||||
|
@ -272,7 +276,7 @@ fi
|
||||||
ACTION=${1}
|
ACTION=${1}
|
||||||
ID=${2}
|
ID=${2}
|
||||||
|
|
||||||
if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${ID}" != "all" ]]; then
|
if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${ACTION}" != "sn" && "${ID}" != "all" ]]; then
|
||||||
BUILD_CONFIG=$(getValueByJsonPath ".build_configs[] | select(.id==\"${ID}\")" "${CONFIG}")
|
BUILD_CONFIG=$(getValueByJsonPath ".build_configs[] | select(.id==\"${ID}\")" "${CONFIG}")
|
||||||
if [ -z "${BUILD_CONFIG}" ];then
|
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"
|
||||||
|
@ -312,7 +316,7 @@ if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${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/"
|
EXTRACTED_KSRC="/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${DSM_VERSION}/build/"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${ACTION}" != "clean" ]]; then
|
if [[ "${ACTION}" != "del" && "${ACTION}" != "add" && "${ACTION}" != "sn" && "${ACTION}" != "clean" ]]; then
|
||||||
echo "All is not supported for action \"${ACTION}\""
|
echo "All is not supported for action \"${ACTION}\""
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -341,6 +345,8 @@ case "${ACTION}" in
|
||||||
;;
|
;;
|
||||||
clean) clean
|
clean) clean
|
||||||
;;
|
;;
|
||||||
|
sn) ./serialnumbergen.sh `echo "${2}" | tr 'a-z' 'A-Z' | tr 'P' '+'`
|
||||||
|
;;
|
||||||
*) if [ ! -z ${ACTION} ];then
|
*) if [ ! -z ${ACTION} ];then
|
||||||
echo "Error: action ${ACTION} does not exist"
|
echo "Error: action ${ACTION} does not exist"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
139
serialnumbergen.sh
Executable file
139
serialnumbergen.sh
Executable file
|
@ -0,0 +1,139 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# form https://github.com/pocopico/tinycore-redpill/blob/main/serialnumbergen.sh
|
||||||
|
|
||||||
|
function beginArray() {
|
||||||
|
case $1 in
|
||||||
|
DS3615xs)
|
||||||
|
permanent="LWN"
|
||||||
|
serialstart="1130 1230 1330 1430"
|
||||||
|
;;
|
||||||
|
DS3617xs)
|
||||||
|
permanent="ODN"
|
||||||
|
serialstart="1130 1230 1330 1430"
|
||||||
|
;;
|
||||||
|
DS916+)
|
||||||
|
permanent="NZN"
|
||||||
|
serialstart="1130 1230 1330 1430"
|
||||||
|
;;
|
||||||
|
DS918+)
|
||||||
|
permanent="PDN"
|
||||||
|
serialstart="1780 1790 1860 1980"
|
||||||
|
;;
|
||||||
|
DS920+)
|
||||||
|
permanent="SBR"
|
||||||
|
serialstart="2030 2040 20C0 2150"
|
||||||
|
;;
|
||||||
|
DS3622xsp)
|
||||||
|
permanent="SQR"
|
||||||
|
serialstart="2030 2040 20C0 2150"
|
||||||
|
;;
|
||||||
|
FS6400)
|
||||||
|
permanent="PSN"
|
||||||
|
serialstart="1960"
|
||||||
|
;;
|
||||||
|
DVA3219)
|
||||||
|
permanent="RFR"
|
||||||
|
serialstart="1930 1940"
|
||||||
|
;;
|
||||||
|
DVA3221)
|
||||||
|
permanent="SJR"
|
||||||
|
serialstart="2030 2040 20C0 2150"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function random() {
|
||||||
|
printf "%06d" $(($RANDOM %30000 +1 ))
|
||||||
|
}
|
||||||
|
function randomhex() {
|
||||||
|
val=$(( $RANDOM %255 +1))
|
||||||
|
echo "obase=16; $val" | bc
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateRandomLetter() {
|
||||||
|
for i in a b c d e f g h j k l m n p q r s t v w x y z
|
||||||
|
do echo $i
|
||||||
|
done | sort -R|tail -1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function generateRandomValue() {
|
||||||
|
for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f g h j k l m n p q r s t v w x y z
|
||||||
|
do echo $i
|
||||||
|
done | sort -R|tail -1
|
||||||
|
}
|
||||||
|
|
||||||
|
function toupper() {
|
||||||
|
echo $1 | tr 'a-z' 'A-Z'
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateMacAddress() {
|
||||||
|
#toupper "Mac Address: 00:11:32:$(randomhex):$(randomhex):$(randomhex)"
|
||||||
|
printf '00:11:32:%02X:%02X:%02X' $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateSerial(){
|
||||||
|
beginArray $1
|
||||||
|
case $1 in
|
||||||
|
DS3615xs)
|
||||||
|
serialnum="`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(random)
|
||||||
|
;;
|
||||||
|
DS3617xs)
|
||||||
|
serialnum="`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(random)
|
||||||
|
;;
|
||||||
|
DS916+)
|
||||||
|
serialnum="`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(random)
|
||||||
|
;;
|
||||||
|
DS918+)
|
||||||
|
serialnum="`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(random)
|
||||||
|
;;
|
||||||
|
FS6400)
|
||||||
|
serialnum="`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(random)
|
||||||
|
;;
|
||||||
|
DS920+)
|
||||||
|
serialnum=$(toupper "`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter))
|
||||||
|
;;
|
||||||
|
DS3622xsp)
|
||||||
|
serialnum=$(toupper "`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter))
|
||||||
|
;;
|
||||||
|
DVA3219)
|
||||||
|
serialnum=$(toupper "`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter))
|
||||||
|
;;
|
||||||
|
DVA3221)
|
||||||
|
serialnum=$(toupper "`echo "$serialstart" | tr ' ' '\n' | sort -R | tail -1`$permanent"$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $serialnum
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function showhelp() {
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
$(basename ${0})
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
Usage: ${0} <platform>
|
||||||
|
Available platforms :
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
DS3615xs DS3617xs DS916+ DS918+ DS920+ DS3622xsp FS6400 DVA3219 DVA3221
|
||||||
|
e.g. $(basename ${0}) DS3615xs
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
EOF
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ] ; then
|
||||||
|
showhelp
|
||||||
|
else
|
||||||
|
if [ "$1" = "DS3615xs" ] || [ "$1" = "DS3617xs" ] || [ "$1" = "DS916+" ] || [ "$1" = "DS918+" ] || [ "$1" = "DS920+" ] || [ "$1" = "DS3622xsp" ] || [ "$1" = "FS6400" ] || [ "$1" = "DVA3219" ] || [ "$1" = "DVA3221" ]; then
|
||||||
|
echo -e "Model:\t\t\t$1"
|
||||||
|
echo -e "Mac Address:\t\t$(generateMacAddress)"
|
||||||
|
echo -e "Serial Number:\t\t$(generateSerial $1)"
|
||||||
|
else
|
||||||
|
echo "Error : $1 is not an available model for serial number generation. "
|
||||||
|
echo "Available Models : DS3615xs DS3617xs DS916+ DS918+ DS920+ DS3622xsp DVA3219 DVA3221"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user