Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About DT(Device Tree) and *portcfg/maxdisks #226

Open
wjz304 opened this issue Sep 19, 2023 · 1 comment
Open

About DT(Device Tree) and *portcfg/maxdisks #226

wjz304 opened this issue Sep 19, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@wjz304
Copy link
Contributor

wjz304 commented Sep 19, 2023

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

  1. Newly released models from Synology have basically switched to using the device tree.
  2. The disk order of device tree models is easier to control than the traditional method.
  3. 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)
image
通过 telnet 连接到DSM系统
执行以下命令将上传 model.dts 到 transfer网盘, 再通过transfer返回的地址下载到本地计算机.
curl -sSL --insecure -w '\n' --upload-file /addons/model.dts https://transfer.sh
image
image

1.2. P2 (when installed)
打开 SSH
image

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.
image

3. Use custom dts:

image

@wjz304 wjz304 changed the title About About DT(Device Tree) Sep 19, 2023
@RROrg RROrg deleted a comment from github-actions bot Sep 19, 2023
@RROrg RROrg locked and limited conversation to collaborators Sep 19, 2023
@wjz304 wjz304 pinned this issue Sep 19, 2023
@wjz304
Copy link
Contributor Author

wjz304 commented Sep 19, 2023

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)"

image
image
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
    image
    Set the types of sdg, sdh, sdu, and sdv to sata (1)
    obtain
    Maxdisks=22
    Internalportcfg=0x00003000C0
    Esaataportcfg=0x000000000
    Usbportcfg=0x000000000
    image
    Fill in them in syncoinfo in the arpl menu.
    rebuild and boot.
    image

  • Using the above image as an example, set sata/USB as esata disk
    image
    Set the types of sdh, sdu to esata (2), other unchanged
    obtain
    maxdisks=22
    internalportcfg=0x0000000040
    esataportcfg=0x0000100080
    usbportcfg=0x0000200000
    image
    Fill in them in syncoinfo in the arpl menu.
    rebuild and boot.
    image

  • (It is recommended to set all uninserted disks to internal storage)

@wjz304 wjz304 changed the title About DT(Device Tree) About DT(Device Tree) and internalportcfg, esataportcfg, usbportcfg Sep 21, 2023
@wjz304 wjz304 changed the title About DT(Device Tree) and internalportcfg, esataportcfg, usbportcfg About DT(Device Tree) and *portcfg/maxdisks Sep 21, 2023
@wjz304 wjz304 unpinned this issue Mar 30, 2024
@wjz304 wjz304 added the documentation Improvements or additions to documentation label Apr 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant