@bodhi Kernel rebuilt and the extra bottle of shiraz enabled me to complete without further mistakes :) No need to change DTS so we are still on v9 and last line of poweroff from console; [ 490.764237] qnap_power_off: triggering power-off... and everything is switched off! Checked for triggers before and after kernel update with new CONFIG_CPU_THERMAL=y and a diff showed no changes;by richjn - Debian
@bodhi I've taken a quick look and it just seems to be sending a 1 byte char for "compatable synology, poweroff" so if I have my head around this echo 1 > /dev/ttyS1 would be the same as printf "\\31" > /dev/ttyS1. Easy enough to test once the kernel has finished building, if it works I think we just need to amend the DTSby richjn - Debian
@bodhi QuoteWill be back in another 12hrs or so I'm happy to do the leg work I'm just conscious you are far more knowledgeable than I am so asking you before I burn hours seems a sensible thing to do. I'm quite a way through the new kernel build and anyway I would like to see if the new triggers turn up so plan of action. 1) Finnish build and see what new triggers turn upby richjn - Debian
@bodhi QuoteMost likely the Synology poweroff code need to be modified, I suspect so. Should I abort the build and address the poweroff code first then ? The address for pulling the plug is 0x31 but just to be clear this literally pulls the plug and doesn't commence a shutdown or anything like that. In our v9 DTS we have addressed the location as reg = <0x12100 0x100 Can I getby richjn - Debian
@bodhi I think you may be right the answer is more beer not less, oh and don't mention the shiraz it is my preferred red and now you have mentioned it I may need to fetch a bottle :) Started building linux-5.1.2 with the extra config enabled and this time I remembered -j2by richjn - Debian
@bodhi I may need to recompile the kernel again.... not sure. In a moment of not thinking I did a make clean in the build directory after the kernel compile and hence blew away the new zImage before I had copied it to boot.. Doh! I did create a new uInitrd after installing the new built packages. The poweroff command still leaves things powered up but I'm unclear if this is because of myby richjn - Debian
@bodhi Whilst waiting for the kernel to finish I was just thinking about the fan control and although it is trivial to write a userspace script to echo "0" or "1" to /sys/class/hwmon/hwmon1/fan1_target on cpu temp changes it would be much nicer to just "package" control into the DTS. Is there a built in cpu temp trigger we could use in a similar fashion to how you aby richjn - Debian
@bodhi Cool Whats not so cool though is I forgot -j2 when I started compiling the kernel :( too late to be worth starting over but watching paint dry will be a little longer than I hoped, we're up to dvb drivers at the moment.by richjn - Debian
@bodhi I looked up the kernel commit for the driver HERE which included Quote+Required Properties: +- compatible: Should be "qnap,power-off" + +- reg: Address and length of the register set for UART1 +- clocks: tclk clock But I will try it as is first. EDIT Sorry if comment came across a bit terse, I was interrupted, what I meant was I will try as is first because I agreeby richjn - Debian
@bodhi I think I need to change the poweroff node in the DTS Current compatible = "synology,power-off"; To compatible = "qnap,power-off"; Are there any other changes I should make ?by richjn - Debian
@bodhi Running now but it will take a whileby richjn - Debian
@bodhi Maybe one of # CONFIG_POWER_AVS is not set CONFIG_POWER_RESET=y # CONFIG_POWER_RESET_BRCMKONA is not set # CONFIG_POWER_RESET_BRCMSTB is not set CONFIG_POWER_RESET_GPIO=y CONFIG_POWER_RESET_GPIO_RESTART=y # CONFIG_POWER_RESET_LTC2952 is not set # CONFIG_POWER_RESET_QNAP is not set # CONFIG_POWER_RESET_RESTART is not set # CONFIG_POWby richjn - Debian
@bodhi Just tested the following printf "\\x31" > /dev/ttyS1 This pulls the plug on everything but not sure how you could implement that in a custom poweroff script i.e. once the filesystem is down /dev/ttyS1 no longer exists but posting in the hope you may know a way to implement it.by richjn - Debian
@bodhi cat /proc/mtd dev: size erasesize name mtd0: 00400000 00001000 "boot" mtd1: 00400000 00001000 "spi-rootfs" cat /etc/fw_env.config # MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd1 0x0000 0x80000 0x20000 4 fw_printenv Warning: Bad CRC, usingby richjn - Debian
@bodhi I had started the shutdown -h before I saw your last post I will get to the flash bit straight after this post. The system is going down for system halt NOW! INIT: Switching to run Using makefile-style concurrent boot in runlevel 0. [ ok ] Stopping hotplug events dispatcher: systemd-udevd. [....] Stopping busybox' klogd implementation: klogd2780 (klogd) Stopped klogd (pid 27by richjn - Debian
@bodhi Thinking through things that need attention / implementing 1) Fix poweroff Currently from Debian filesystems are unmounted but the disks are left powered and the system is in a "hung" state requiring the mains to be switched off / on before you can power back up. I have removed the poweroff function in the v10 DTS attached to see if it made any difference but it doesn'tby richjn - Debian
@bodhi Power LED is not on gpio From the synobios write up linked above the Power LED can be set to solid (non-flashing) with the following printf "\\x34" > /dev/ttyS1 And the status LED set to green with printf "\\x38" > /dev/ttyS1 But apart from "looking nice" just setting them without some condition being met seems pointless and is it even poby richjn - Debian
@bohdi Yes, the fan control it was on my list for later but you are right it does need to be bottomed out. ls -l /sys/class/hwmon/hwmon* lrwxrwxrwx 1 root root 0 May 14 18:04 /sys/class/hwmon/hwmon0 -> ../../devices/platform/soc/soc:internal-regs/f1072004.mdio/mdio_bus/f1072004.mdio-mii/f1072004.mdio-mii:01/hwmon/hwmon0 lrwxrwxrwx 1 root root 0 May 14 18:04 /sys/class/hwmon/hwmon1 ->by richjn - Debian
@bodhi I'm running linux-5.1.1 patched with your 4.20.6 patch and using your config updated simply via make menuconfig to get new configs plus a couple of minor changes from me. Does your latest patch contain more goodies ? and if so can I get a copy please.by richjn - Debian
@bohdi Slightly pointless post but just wanted to say I am trying to track down what controls the power LED states. I was very careful going through the gpio pins last time but I admit my attention was more on the other LED's so I will redo the pin cycling just to be 100% sure its not gpio linked. I think the answer may be found in the synobios module but as a propriety piece of softwareby richjn - Debian
@bodhi Been out all morning but replied via pm before I saw your above post.by richjn - Debian
@bodhi All done at last! Booted with v9 DTS and the led's operate as you described Both echo commands work root@debian:~# echo none > /sys/class/leds/rs816:green:sata1/trigger root@debian:~# echo ide-disk1 > /sys/class/leds/rs816:green:sata1/trigger In terms of variance from stock we have the following; 1) Power LED in stock flashes until the system is up then stays on soliby richjn - Debian
@bodhi Yes 4 core Intel Atom @2.4ghz, actually quite a quick box with 4 x nic's 2 x e-sata plus pcie based ssd cache accelerator. It used to be my main backup box with 5 x 8TB 7,000rpm HDD's but its been retired for a couple of years. I know a little bit more about grub than I do u-boot but still next to nothing when it comes to hacking. Recovery from a console is very doable withby richjn - Debian
@bodhi Not a typo; rootfs is on 10GB raid 1 swap 2GB raid 1 files 5.4TB raid 5 Your rootfs stripped down a bit but including dev tools takes up 875M so circa 10%. This box won't have much in the way of software installed so 10GB should be fine. All data will go on the raid 5 mount. Disk sync is getting there slowly cat /proc/mdstat Personalities : md1 : active (auto-rby richjn - Debian
@bodhi Thanks for v9 and some test commands to try I will get to this shortly. As we are getting quite close on this one I am preparing things for real world use. I'm setting rootfs up on a 10GB 4 disk raid1 (meta 0.9) swap on a 2GB 4 disk raid1 and the remainder as a 4 disk raid 5. Once we have the DTS as we want it I could do with some help embedding this into the mtdblock which wilby richjn - Debian
@bodhi I have added fan control based on armada-385-synology-rs816-v1.dts but with just 1 pin (48) this is now active at boot but I'm not sure how to get the box hot enough to test because even whilst recompiling the kernel the rootfs HDD remains ~28C according to hddtemp whilst idle is ~26C gpio-fan { compatible = "gpio-fan"; gpios = <&gpio1 16 GPIO_ACTIVE_HIGby richjn - Debian
@bodhi You haven't posted V8 yetby richjn - Debian
@bodhi Just re-ran pin 6 toggle active / inactive to check results and slightly different to as I reported above. Quote2) Drive 1 led green (recognized as /dev/sdb) but only if a drive is plugged in. The observed action is Drive 1 led green regardless of if a HDD is plugged in or not. Everything else as stated, however, I'm 100% sure the light went out when I pulled the drive last timeby richjn - Debian
@bodhi Setting pin 6 active / inactive turns all of the following on / off 1) Both nic's but no led until an ethernet cable is plugged in 2) Drive 1 led green (recognized as /dev/sdb) but only if a drive is plugged in. 3) Drive 2, 3 4 led amber regardless of whether a drive is plugged in or not I have completed the gpio cycling manually one pin at a time and carfuly checking for chaby richjn - Debian