About DT(Device Tree) and *portcfg/maxdisks
wjz304 opened this issue · 1 comments
About DT(Device Tree)
Terminology
- dt: device tree
- dts: device tree source
- The dts file is an ASCII text description of the Device Tree.
- dtc: device tree compiler
- DTC is a compilation tool that can compile .dts files into .dtb files.
- dtb: device tree blob
- DTC compiles the binary file (*.dtb) generated by *.dts. When the bootloader boots the kernel, it will pre-read *.dtb into the memory and then be parsed by the kernel.
Tools
dtc_64bit.exe.gz windows_x64
dtc_arm.gz
dtc_aarch64.gz
dtc_i686.gz
dtc_x86_64.gz
DSM's DT
- Newly released models from Synology have basically switched to using the device tree.
- The disk order of device tree models is easier to control than the traditional method.
- But the issue with the current DSM 4.x kernel DT model HBA has not been resolved yet.
Custom DTS
1. Get the current dts file:
arpl will make a dts file (/addons/model.dts) at startup based on the actual hardware conditions. When the DSM system is installed, a backup will be kept in /etc/model.dtb, so I provide two ways to get it.
1.1. P1 (when not installed)
通过 telnet 连接到DSM系统
执行以下命令将上传 model.dts 到 transfer网盘, 再通过transfer返回的地址下载到本地计算机.
curl -sSL --insecure -w '\n' --upload-file /addons/model.dts https://transfer.sh
1.2. P2 (when installed)
打开 SSH
sudo -i
curl -kL https://github.com/RROrg/rr/files/14824625/dtc_x86_64.gz -o ~/dtc_x86_64.gz
gzip -dc ~/dtc_x86_64.gz >~/dtc
chmod +x ~/dtc
~/dtc -I dtb -O dts /etc/model.dtb > ~/model.dts
curl -sSL --insecure -w '\n' --upload-file ~/model.dts https://transfer.sh
2. Edit dts file:
2.1 Get drive disk data.
# sata
cat /sys/block/sata*/device/syno_block_info
# nvme
cat /sys/block/nvme*/device/syno_block_info
2.2. You need to replenish uninserted disk data as needed.
3. Use custom dts:
About internalportcfg, esataportcfg, usbportcfg
DSM
eg:
ls -d /dev/sd[a-z]
synodisk --enum -t internal
synodisk --enum -t usb
cat /etc/synoinfo.conf | grep -E "(portcfg|maxdisks)"
sdg -> 硬盘 7
sdh -> 硬盘 8
sdu -> USB Disk 1
sdv -> USB Disk 2
- maxdisks
- maxdisks is the subscript of the maximum disk, meaning that if the maximum disk is sdz, then maxdisks should be 26.
- The largest one in the above figure is sdv, so maxdisks=22 (maxdisks can be set to a number greater than 22, but cannot be set to a value greater than 26 when the DSM system is not installed)
- internalportcfg
- internalportcfg is the label bit (binary) of the internal disk, which means that if all 26 disks are internal disks, i.e , 11111111111111111111111111B (0x3FFFFFF)
- In the above figure, only sdg and sdh are internal disks, therefore it is 00000000000000000011000000B (0xC0), but in order to achieve hot swapping, the first 20 bits are all used as internal interfaces, so it is 00000000111111111111111111B (0xfffff),
- esataportcfg
- esataportcfg is the label bit (binary) of the esata disk. The principle is the same as internalportcfg.
- In the above figure, because there is no esata disk, it is 0x00.
- usbportcfg
- usbportcfg is the label bit (binary) of the esata disk. The principle is the same as internalportcfg.
- In the above figure, only sdu and sdv are usb disks, therefore it is 00001100000000000000000000(0x300000).
Tools:
internalportcfg,esataportcfg,usbportcfg计算.xlsx
Custom internalportcfg, esataportcfg, usbportcfg
-
Using the above image as an example, set USB as internal disk
Set the types of sdg, sdh, sdu, and sdv to sata (1)
obtain
Maxdisks=22
Internalportcfg=0x00003000C0
Esaataportcfg=0x000000000
Usbportcfg=0x000000000
Fill in them in syncoinfo in the arpl menu.
rebuild and boot.
-
Using the above image as an example, set sata/USB as esata disk
Set the types of sdh, sdu to esata (2), other unchanged
obtain
maxdisks=22
internalportcfg=0x0000000040
esataportcfg=0x0000100080
usbportcfg=0x0000200000
Fill in them in syncoinfo in the arpl menu.
rebuild and boot.
-
(It is recommended to set all uninserted disks to internal storage)