Jump to content
XPEnology Community

using jun's build in patch in image to make SHR and higher disk count "permanant"


IG-88

Recommended Posts

hi,

 

if some one has some time to spare

 

it might worth a try to have a look into the extra.lzma /etc/jun.patch

jun is using that to patch (diff files) dsm config files at boot

on 916+ he is patching synoinfo.conf to maxdisks=12

(there might be a mistake in that case as he sets the intern disks to 0xff instead of 0xfff? - maybe just a typo no one recognized before?)

 

that could also be done on 3515/17 to achieve a higher disk count and activate shr and as patch (diff) kicks in if it exactly matches it could be done in a way that it kicks in when the already modded synoinfo.conf is reset to the default one like when a dsm update reseting the synoinfo.conf

 

mostly interesting for people with a higher disk count then 12

 

any one willing to do and test it?

if done and tested it could be part of the extra.lzma i do for the additional drivers (extended jun.patch file)

like new default disk count to 24 (needs to touch maxdisks, usbportcfg, internalportcfg, esataportcfg) and activate SHR

 

in best case there will be much less hassle when updating dsm

 

 

 

Link to comment
Share on other sites

That 0xff (8 drives) seems indeed in contradiction with the maxdisk="12" setting in the jun.patch diff file. @jun care to explain? 

 

I don't recommend activating SHR by default or changing any other default values. It's not the vanilla setting for 3615xs/3617xs and perhaps some people also don't want it. I would leave that to people's choice to modify the synoinfo.conf file as they see fit.

I think it is best to separate modding (modifying settings) from compatibility (adding modules). These are 2 separate matters and shouldn't be mixed.

 

You could provide the synoinfo.conf mod settings as a separate mod from the extra.lzma in the proper Software Modding section as a tutorial for example or we could add a FAQ on the matter if this is something popular.

Link to comment
Share on other sites

Tried to edit jun.patch with the following, did not work for me though.

System did boot after restore, no changes found in synoinfo.conf after boot.

 

 

diff --git a/etc/synoinfo.conf b/etc/synoinfo.conf
index 3536bde..f158b28 100755
--- a/etc/synoinfo.conf
+++ b/etc/synoinfo.conf
@@ -276,7 +276,6 @@ support_disk_performance_test="yes"
 support_share_quota="yes"
 support_dr_snap="yes"
 support_performance_event="yes"
-supportadt7490="yes"
 support_hotspare="yes"
 vpn_conn_max="30"
 buzzeroffen="0x9f"
-maxdisks="12"
+maxdisks="15"
-internalportcfg="0xfff"
+internalportcfg="0x78FF"
-esataportcfg="0x1000"
+esataportcfg="0x0"
-usbportcfg="0xffe000"
+usbportcfg="0x8700"

 

Link to comment
Share on other sites

11 hours ago, Polanskiman said:

That 0xff (8 drives) seems indeed in contradiction with the maxdisk="12" setting in the jun.patch diff file. @jun care to explain?

as i'm already doing a extra.lzma for the drivers that could be changed too, maybe next year after some testing in vm with more disks

 

 

11 hours ago, Polanskiman said:

You could provide the synoinfo.conf mod settings as a separate mod from the extra.lzma in the proper Software Modding section as a tutorial for example or we could add a FAQ on the matter if this is something popular.

yes, that might be the best way, the shr setting might be universal but the internal, esata, usb config will be different in most cases, the thing that hurt most is when you have >12 disks, boot after a update and your raid is broken because of missing disks, the missing shr setting could also be fixed after a update (like with a plugin changing the config?)

 

Link to comment
Share on other sites

I replaced the _replace commands as well, though without effect.

 

Here the complete jun.patch:

 

jun.patch  
diff --git a/etc/passwd b/etc/passwd
index 6a0344d..cf95fbd 100644
--- a/etc/passwd
+++ b/etc/passwd
@@ -1,4 +1,4 @@
-root:x:0:0::/root:/bin/ash
+root::0:0::/root:/bin/ash
 system:x:1:1::/usr/syno/synoman:/usr/bin/nologin
 daemon:x:2:2::/:/bin/sh
 lp:x:7:7::/var/spool/lpd:/bin/sh
diff --git a/etc/rc b/etc/rc
index e706c59..2d29b47 100755
--- a/etc/rc
+++ b/etc/rc
@@ -163,6 +163,8 @@ if [ "$PLATFORM" = "grantley" ]; then
 fi
 
 SYNOLoadIPv6
+. /etc.defaults/rc.modules
+KERNEL_MODULES="${KERNEL_MODULES} ${EXTRA_MODULES}"
 SYNOLoadModules ${KERNEL_MODULES}
 SYNOLoadAdt7490
 SoftLink7490fanInput
diff --git a/etc/synoinfo.conf b/etc/synoinfo.conf
index 3536bde..f158b28 100755
--- a/etc/synoinfo.conf
+++ b/etc/synoinfo.conf
@@ -276,7 +276,6 @@ support_disk_performance_test="yes"
 support_share_quota="yes"
 support_dr_snap="yes"
 support_performance_event="yes"
-supportadt7490="yes"
 support_hotspare="yes"
 vpn_conn_max="30"
 buzzeroffen="0x9f"
 -maxdisks="12"
+maxdisks="15"
-internalportcfg="0xfff"
+internalportcfg="0x78FF"
-esataportcfg="0x1000"
+esataportcfg="0x0"
-usbportcfg="0xffe000"
+usbportcfg="0x8700"
diff --git a/linuxrc.syno b/linuxrc.syno
index 78583d2..a8f641b 100755
--- a/linuxrc.syno
+++ b/linuxrc.syno
@@ -37,12 +37,48 @@ USB_MODULES="${USB_MODULES} etxhci-hcd" # for Etron USB3.0
 SupportSAS=`/bin/get_key_value $SYNOINFO_DEF supportsas`
 SupportDualhead=`/bin/get_key_value $SYNOINFO_DEF support_dual_head`
 
+FixSynoboot()
+{
+	tail -n+3 /proc/partitions | while read major minor sz name
+	do
+		if echo $name | grep -q "^sd[[:alpha:]]*$";then
+			basename=$name
+			minor0=$minor
+			synoboot1=""
+			synoboot2=""
+			continue
+		fi
+		if [ $name = "${basename}1" -a $sz -le 512000 ]; then
+			synoboot1="$name"
+			minor1=$minor
+		elif [ $name = "${basename}2" -a $sz -le 512000 ]; then
+			synoboot2="$name"
+			minor2=$minor
+		else
+			continue
+		fi
+		if [ -n "$synoboot1" -a -n "$synoboot2" ]; then
+			rm "/dev/$basename"
+			rm "/dev/$synoboot1"
+			rm "/dev/$synoboot2"
+			# leave other partitions as is for now
+			mknod /dev/synoboot b $major $minor0
+			mknod /dev/synoboot1 b $major $minor1
+			mknod /dev/synoboot2 b $major $minor2
+			break
+		fi
+	done
+}
+
 Exit()
 {
 	if [ -n "$2" ]; then
 		echo "Exit on error [$1] $2..."
 	fi
 
+	sleep 2
+	[ -e /dev/synoboot ] || FixSynoboot
+
 	# show date for login info
 	date
 
@@ -80,6 +116,9 @@ fi
 # insert basic USB modules for detect f401/FDT
 echo "Insert basic USB modules..."
 SYNOLoadModules $USB_MODULES
+SYNOLoadModules "usb-storage"
+. /etc.defaults/rc.modules
+SYNOLoadModules $DISK_MODULES
 
 #insert net driver(Mindspeed only)
 echo "Insert net driver(Mindspeed only)..."
@@ -345,8 +384,11 @@ fi
 # check if upgrade
 #
 if [ 0 -eq $FsckFailed ]; then
-    echo '------------upgrade'
-    /bin/sh /usr/syno/sbin/upgrade.sh
+    if echo '------------upgrade';then
+        /bin/sh /usr/syno/sbin/upgrade.sh
+    else
+        /bin/sh /usr/syno/sbin/upgrade.sh > /dev/null
+    fi
 	if [ $? -ne 0 ]; then
 		touch /.untar_upgrade_file_failed
 		Exit 6 "upgrade failed"
diff --git a/usr/sbin/init.post b/usr/sbin/init.post
index 17fd86d..b515d25 100755
--- a/usr/sbin/init.post
+++ b/usr/sbin/init.post
@@ -21,6 +21,126 @@ done
 
 mount $RootDevice /tmpRoot -o barrier=1
 
+RC_MODULES=/etc.defaults/rc.modules
+RC_EXTRAS=""
+WL_MODULES=""
+WL_FIRMWARES=""
+OPTIONAL_MODULES=""
+
+if ! fgrep -q "$RC_MODULES" /tmpRoot/etc/rc; then
+	/tmpRoot/usr/bin/sed -i '/^SYNOLoadModules \${KERNEL_MODULES}$/{$!{N;s/^.*\n\SYNOLoadAdt7490$/&/ ;t i;P;D;:i
+i . '"$RC_MODULES"'
+i KERNEL_MODULES="${KERNEL_MODULES} ${EXTRA_MODULES}"
+}}' /tmpRoot/etc/rc
+fi
+
+if ! fgrep -q "$RC_MODULES" /tmpRoot/etc.defaults/rc; then
+	/tmpRoot/usr/bin/sed -i '/^SYNOLoadModules \${KERNEL_MODULES}$/{$!{N;s/^.*\n\SYNOLoadAdt7490$/&/ ;t i;P;D;:i
+i . '"$RC_MODULES"'
+i KERNEL_MODULES="${KERNEL_MODULES} ${EXTRA_MODULES}"
+}}' /tmpRoot/etc.defaults/rc
+fi
+
+if ! fgrep -q '_modpath=/lib/modules/update/${_mod}${_suffix}' /tmpRoot/etc/rc.subr; then
+	/tmpRoot/usr/bin/sed -i '\%^\t\t_modpath=/lib/modules/${_mod}${_suffix}%{
+	i\	\	_modpath=/lib/modules/update/${_mod}${_suffix}
+	i\	\	[ -f "$_modpath"  ] ||
+	}' /tmpRoot/etc/rc.subr
+fi
+
+if ! fgrep -q '_modpath=/lib/modules/update/${_mod}${_suffix}' /tmpRoot/etc.defaults/rc.subr; then
+	/tmpRoot/usr/bin/sed -i '\%^\t\t_modpath=/lib/modules/${_mod}${_suffix}%{
+	i\	\	_modpath=/lib/modules/update/${_mod}${_suffix}
+	i\	\	[ -f "$_modpath"  ] ||
+	}' /tmpRoot/etc.defaults/rc.subr
+fi
+
+/tmpRoot/usr/bin/cmp -s "$RC_MODULES" "/tmpRoot/$RC_MODULES" ||
+        cp "$RC_MODULES" "/tmpRoot/$RC_MODULES"
+
+. $RC_MODULES
+
+
+# $1 src, $2 dst, $3 shortname
+_cp_mod()
+{
+	local dest="/tmpRoot/$2"
+	[ -f "$1" ] || return 1
+	/tmpRoot/usr/bin/cmp -s "$1" "$dest" && return 2
+
+	if [ -f "$dest" ]; then
+		echo "Updating $dest..."
+	else
+		[ "x$1" != "x$2" -a -f "/tmpRoot/$1" ] &&
+			/tmpRoot/usr/bin/cmp -s "$1" "/tmpRoot/$1" &&
+			return 3
+		echo "Installing $dest..."
+                local d=`dirname "$dest"`
+                [ -d "$d"  ] || mkdir -p "$d" || return 4
+	fi
+	cp -a "$1" "$dest"
+}
+
+# should modify module to avoid overwrite firmware
+# otherwise there is no good way to update firmware
+_cp_fw()
+{
+	local dst="/tmpRoot/$2"
+	/tmpRoot/usr/bin/cmp -s "$1" "$dst" && return 1
+        if [ -f "$dst"  ]; then
+                echo "Updating $dst..."
+        else
+                local d=`dirname "$dst"`
+                [ -d "$d"  ] || mkdir -p "$d" || return 2
+                echo "Installing $dst..."
+        fi
+        cp -a "$1" "/tmpRoot/$2"
+}
+
+for mod in $DISK_MODULES $EXTRA_MODULES $OPTIONAL_MODULES; do
+	src=/usr/lib/modules/${mod}.ko
+	dest=/usr/lib/modules/update/${mod}.ko
+	_cp_mod $src $dest
+	#echo "install $mod returns $?"
+done
+
+for fw in $EXTRA_FIRMWARES; do
+	path=/usr/lib/firmware/${fw}
+	_cp_fw $path $path
+	#echo "install $fw returns $?"
+done
+
+#$1 pattern, $2 path
+_del()
+{
+	if grep -q "$1" "$2";then
+		/tmpRoot/usr/bin/sed -i "$2" -e "/$1/ d"
+	fi
+}
+
+_del 'supportadt7490="yes"' /tmpRoot/etc.defaults/synoinfo.conf
+
+#$1 pattern, $2 replace, $3 path
+_replace()
+{
+	if grep -q "$1" "$3";then
+		/tmpRoot/usr/bin/sed -i "$3" -e "s/$1/$2/"
+	fi
+}
+
+_replace 'esataportcfg="ff000"' 'esataportcfg="0x0"' /tmpRoot/etc.defaults/synoinfo.conf
+_replace 'usbportcfg="0x300000"' 'usbportcfg="0x8700"' /tmpRoot/etc.defaults/synoinfo.conf
+_replace 'internalportcfg="0xfff"' 'internalportcfg="0x78FF"' /tmpRoot/etc.defaults/synoinfo.conf
+_replace 'maxdisks="12"' 'maxdisks="15"' /tmpRoot/etc.defaults/synoinfo.conf
+
+UPSTART="/tmpRoot/usr/share/init"
+
+if ! echo; then
+	_replace '^start on' '#start on' $UPSTART/tty.conf
+	_replace "console output" "console none" $UPSTART/syno_poweroff_task.conf
+	_replace "console output" "console none" $UPSTART/burnin_loader.conf
+	_replace "console output" "console none" $UPSTART/udevtrigger.conf
+	_replace "console output" "console none" $UPSTART/bs-poweroff.conf
+	_replace "console output" "console none" $UPSTART/udevd.conf
+else
+	_replace '^#start on' 'start on' $UPSTART/tty.conf
+fi
+
 mkdir -p /tmpRoot/initrd
 
 umount /proc &> /dev/null

 

Hide  
Edited by MBchristoff
Link to comment
Share on other sites

You seem to have modified plenty of things in that diff file. I suggest you take it easy and only start with the disk count first. I also saw what seems to be an inconsistency:

+_replace 'internalportcfg="0xfff"' 'internalportcfg="0x78FF"' /tmpRoot/etc.defaults/synoinfo.conf
+_replace 'maxdisks="12"' 'maxdisks="15"' /tmpRoot/etc.defaults/synoinfo.conf

0x78FF is not 15 disks but 12 > 0000 0000 0111 1000 1111 1111

or am I missing something?

 

This is the binary version of what you are actually replacing in the settings in regards to disk ports:

 

0000 0000 0000 0000 0000 0000 (esata ports)
0000 0000 1000 0111 0000 0000 (usb ports)
0000 0000 0111 1000 1111 1111 (internal ports)

 

Link to comment
Share on other sites

11 hours ago, Polanskiman said:

0x78FF is not 15 disks but 12 > 0000 0000 0111 1000 1111 1111

or am I missing something?

 

I tinkered around with those values because I wanted to exclude the msata ports on the motherboard since I'm not using them and they create a gap in my drives on port 9-10-11.

 

Do you guys figure the value should be on the part under "@@ -276,7 +276,6 @@ support_disk_performance_test="yes"" too, the 916 jun.patch mentioned the drive count twice but only mentions the port configuration in the replace part.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...