Skip to content

Commit

Permalink
Added Patch DTC function
Browse files Browse the repository at this point in the history
  • Loading branch information
pocopico committed Mar 15, 2022
1 parent a40e20a commit 6a98d04
Show file tree
Hide file tree
Showing 2 changed files with 330 additions and 3 deletions.
243 changes: 243 additions & 0 deletions ds1621p.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
/dts-v1/;

/ {
compatible = "Synology";
model = "synology_v1000_1621+";
version = <0x1>;
syno_spinup_group = <0x6>;
syno_spinup_group_delay = <0x0>;
syno_hdd_powerup_seq = "true";
syno_smbus_hdd_type = "tca9555";
syno_smbus_hdd_adapter = <0x1>;
syno_smbus_hdd_address = <0x20>;
syno_cmos_reg_secure_flash = <0xe0>;
syno_cmos_reg_secure_boot = <0xe2>;

DX517 {
compatible = "Synology";
model = "synology_dx517";

pmp_slot@1 {

libata {
EMID = <0x0>;
pmp_link = <0x0>;
};
};

pmp_slot@2 {

libata {
EMID = <0x0>;
pmp_link = <0x1>;
};
};

pmp_slot@3 {

libata {
EMID = <0x0>;
pmp_link = <0x2>;
};
};

pmp_slot@4 {

libata {
EMID = <0x0>;
pmp_link = <0x3>;
};
};

pmp_slot@5 {

libata {
EMID = <0x0>;
pmp_link = <0x4>;
};
};
};

internal_slot@1 {
protocol_type = "sata";
led_type = "lp3943";

ahci {
pcie_root = "00:1e.0,01.0,07.0";
ata_port = <0x0>;
};

led_green {
led_name = "syno_led0";
};

led_orange {
led_name = "syno_led1";
};
};

internal_slot@2 {
protocol_type = "sata";
led_type = "lp3943";

ahci {
pcie_root = "00:1e.0,01.0,07.0";
ata_port = <0x1>;
};

led_green {
led_name = "syno_led2";
};

led_orange {
led_name = "syno_led3";
};
};

internal_slot@3 {
protocol_type = "sata";
led_type = "lp3943";

ahci {
pcie_root = "00:1e.0,01.0,07.0";
ata_port = <0x2>;
};

led_green {
led_name = "syno_led4";
};

led_orange {
led_name = "syno_led5";
};
};

internal_slot@4 {
protocol_type = "sata";
led_type = "lp3943";

ahci {
pcie_root = "00:1e.0,01.0,07.0";
ata_port = <0x3>;
};

led_green {
led_name = "syno_led6";
};

led_orange {
led_name = "syno_led7";
};
};

internal_slot@5 {
protocol_type = "sata";
led_type = "lp3943";

ahci {
pcie_root = "00:01.6,00.0";
ata_port = <0x2>;
};

led_green {
led_name = "syno_led8";
};

led_orange {
led_name = "syno_led9";
};
};

internal_slot@6 {
protocol_type = "sata";
led_type = "lp3943";

ahci {
pcie_root = "00:01.6,00.0";
ata_port = <0x3>;
};

led_green {
led_name = "syno_led10";
};

led_orange {
led_name = "syno_led11";
};
};

esata_port@1 {

ahci {
pcie_root = "00:01.5,00.0";
ata_port = <0x0>;
};
};

esata_port@2 {

ahci {
pcie_root = "00:01.6,00.0";
ata_port = <0x0>;
};
};

nvme_slot@1 {
pcie_root = "00:01.3";
port_type = "ssdcache";
};

nvme_slot@2 {
pcie_root = "00:01.4";
port_type = "ssdcache";
};

pcie_slot@1 {
pcie_root = "00:01.2";
};

usb_slot@1 {

vbus {
syno_gpio = <0x2a 0x1>;
};

usb2 {
usb_port = "1-2";
};

usb3 {
usb_port = "2-2";
};
};

usb_slot@2 {

vbus {
syno_gpio = <0xb 0x1>;
};

usb2 {
usb_port = "3-1";
};

usb3 {
usb_port = "4-1";
};
};

usb_slot@3 {

vbus {
syno_gpio = <0xc 0x1>;
};

usb2 {
usb_port = "1-3";
};

usb3 {
usb_port = "2-3";
};
};
};
90 changes: 87 additions & 3 deletions rploader.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,101 @@
#!/bin/bash
#
# Author :
# Date : 22141312
# Version : 0.4.7.1
# Date : 22150320
# Version : 0.4.8.0
#
#
# User Variables :

rploaderver="0.4.7.1"
rploaderver="0.4.8.0"
rploaderepo="https://github.com/pocopico/tinycore-redpill/raw/main/rploader.sh"

redpillextension="https://github.com/pocopico/rp-ext/raw/main/redpill/rpext-index.json"
modextention="https://github.com/pocopico/rp-ext/raw/main/rpext-index.json"
modalias4="https://raw.githubusercontent.com/pocopico/tinycore-redpill/main/modules.alias.4.json.gz"
modalias3="https://raw.githubusercontent.com/pocopico/tinycore-redpill/main/modules.alias.3.json.gz"
dtcbin="https://raw.githubusercontent.com/pocopico/tinycore-redpill/main/dtc"

# END Do not modify after this line
######################################################################################################


function patchdtc(){

loaderdisk=`mount |grep -i optional | grep cde | awk -F / '{print $3}' |uniq | cut -c 1-3`
localdisks=`lsblk |grep -i disk |grep -i sd | awk '{print $1}' |grep -v $loaderdisk`
localnvme=`lsblk |grep -i nvme |awk '{print $1}' `


if [ "${TARGET_PLATFORM}" = "v1000" ] ; then
SYNOMODEL="ds1621p"
else
echo "${TARGET_PLATFORM} does not require model.dtc patching "
return
fi

if [ ! -d /lib64 ] ; then
sudo ln -s /lib /lib64
fi

echo "Downloading dtc binary"
curl --location --progress-bar "$dtcbin" -O

if [ -!f ${SYNOMODEL}.dts ] ; then

echo "dts file for ${SYNOMODEL} not found, trying to download"
curl --location --progress-bar -O "https://raw.githubusercontent.com/pocopico/tinycore-redpill/main/${SYNOMODEL}.dts"

fi

echo "Found `echo $localdisks|wc -w` disks and `echo $localnvme |wc -w` nvme"
let diskslot=1
echo "Collecting disk paths"

for disk in $localdisks
do
diskpath=`udevadm info --query path --name $disk | awk -F "\/" '{print $4 ":" $5 }' | awk -F ":" '{print $2 ":" $3 "," $6}'`

echo "Found local disk $disk with path $diskpath, adding into internal_slot $diskslot"

sed -i "/internal_slot\@${diskslot} {/!b;n;n;n;n;n;cpcie_root = \"$diskpath\";" ${SYNOMODEL}.dts


let diskslot=$diskslot+1
done

if [ `echo $localnvme | wc -w` -gt 0 ] ; then
let nvmeslot=1
echo "Collecting nvme paths"

for nvme in $localnvme
do
nvmepath=`udevadm info --query path --name $nvme | awk -F "\/" '{print $4 ":" $5 }' | awk -F ":" '{print $2 ":" $3 "," $6}'`

echo "Found local nvme $nvme with path $nvmepath, adding into m2_card $nvmeslot"

sed -i "/m2_card\@${nvmeslot} {/!b;n;n;n;cpcie_root = \"$nvmepath\";" ${SYNOMODEL}.dts


let nvmeslot=$diskslot+1
done

else

echo "NO NVME disks found, returning"

fi

echo "Converting dts to dtb"
./dtc -I dts -O dtb ${SYNOMODEL}.dts > ${SYNOMODEL}.dtb 2>&1 > /dev/null

echo "Remember to replace extension model file ..."

}




function mountshare(){

echo "smb user of the share, leave empty when you do not want to use one"
Expand Down Expand Up @@ -608,6 +685,8 @@ Actions: build, ext, download, clean, update, listmod, serialgen, identifyusb, s
- identifyusb: Tries to identify your loader usb stick VID:PID and updates the user_config.json file
- patchdtc: Tries to identify and patch your dtc model for your disk and nvme devices
- satamap: Tries to identify your SataPortMap and DiskIdxMap values and updates the user_config.json file
- backup: Backup and make changes /home/tc changed permanent to your loader disk
Expand Down Expand Up @@ -1257,6 +1336,11 @@ case $1 in
identifyusb)
usbidentify
;;
patchdtc)
getvars $2
checkinternet
patchdtc
;;
satamap)
satamap
;;
Expand Down

0 comments on commit 6a98d04

Please sign in to comment.