Closed hapklaar closed 2 years ago
In theory, it can be made to work on any Linux-based platform. At a high level, you need to:
Build the modules (n5550_board
and n5550_ahci_leds
) for the running kernel. See https://github.com/ipilcher/n5550/issues/17 for some changes needed to compile them on more recent kernels. Note also, that the LED module only works if ahci
and libahci
drivers are modules; it uses some rather hacky jiggery-pokery to trigger the drive LEDs.
Ensure that the relevant modules get loaded at the appropriate time on boot. On CentOS 7, this is accomplished with a combination of /usr/lib/udev/rules.d/99-n5550.rules
(https://github.com/ipilcher/n5550/blob/master/conf/99-n5550.rules), /usr/lib/modules-load.d/n5550.conf
(https://github.com/ipilcher/n5550/blob/master/conf/modules-load_n5550.conf), and /usr/lib/modprobe.d/n5550.conf
(https://github.com/ipilcher/n5550/blob/master/conf/modprobe_n5550.conf).
BTW, the n5550_ahci_leds
module and /usr/lib/modprobe.d/n5550.conf
will need to be built into your initramfs, as they need to load when the AHCI modules are first loaded, before the kernel can mount the root filesystem. On CentOS 7, this is accomplished by /usr/lib/dracut/dracut.conf.d/n5550.conf
(https://github.com/ipilcher/n5550/blob/master/conf/dracut_n5550.conf) and the various files in https://github.com/ipilcher/n5550/tree/master/dracut, which end up in /usr/lib/dracut/modules.d/99n5550
.
If this bit works, the modules will load, and you'll see the following in sysfs
:
/sys/class/leds/n5550:blue:usb
/sys/class/leds/n5550:green:disk-act-0
/sys/class/leds/n5550:green:disk-act-1
/sys/class/leds/n5550:green:disk-act-2
/sys/class/leds/n5550:green:disk-act-3
/sys/class/leds/n5550:green:disk-act-4
/sys/class/leds/n5550:orange:busy
/sys/class/leds/n5550:red:disk-stat-0
/sys/class/leds/n5550:red:disk-stat-1
/sys/class/leds/n5550:red:disk-stat-2
/sys/class/leds/n5550:red:disk-stat-3
/sys/class/leds/n5550:red:disk-stat-4
/sys/class/leds/n5550:red:fail
/sys/class/n5550_ahci_leds/enabled
/sys/devices/platform/it87.656/alarms
/sys/devices/platform/it87.656/driver
/sys/devices/platform/it87.656/fan1_alarm
/sys/devices/platform/it87.656/fan1_input
/sys/devices/platform/it87.656/fan1_min
/sys/devices/platform/it87.656/fan3_alarm
/sys/devices/platform/it87.656/fan3_input
/sys/devices/platform/it87.656/fan3_min
/sys/devices/platform/it87.656/hwmon
/sys/devices/platform/it87.656/in0_alarm
/sys/devices/platform/it87.656/in0_input
/sys/devices/platform/it87.656/in0_max
/sys/devices/platform/it87.656/in0_min
/sys/devices/platform/it87.656/in1_alarm
/sys/devices/platform/it87.656/in1_input
/sys/devices/platform/it87.656/in1_max
/sys/devices/platform/it87.656/in1_min
/sys/devices/platform/it87.656/in2_alarm
/sys/devices/platform/it87.656/in2_input
/sys/devices/platform/it87.656/in2_max
/sys/devices/platform/it87.656/in2_min
/sys/devices/platform/it87.656/in3_alarm
/sys/devices/platform/it87.656/in3_input
/sys/devices/platform/it87.656/in3_max
/sys/devices/platform/it87.656/in3_min
/sys/devices/platform/it87.656/in4_alarm
/sys/devices/platform/it87.656/in4_input
/sys/devices/platform/it87.656/in4_max
/sys/devices/platform/it87.656/in4_min
/sys/devices/platform/it87.656/in5_alarm
/sys/devices/platform/it87.656/in5_input
/sys/devices/platform/it87.656/in5_max
/sys/devices/platform/it87.656/in5_min
/sys/devices/platform/it87.656/in6_alarm
/sys/devices/platform/it87.656/in6_input
/sys/devices/platform/it87.656/in6_max
/sys/devices/platform/it87.656/in6_min
/sys/devices/platform/it87.656/in7_alarm
/sys/devices/platform/it87.656/in7_input
/sys/devices/platform/it87.656/in7_label
/sys/devices/platform/it87.656/in7_max
/sys/devices/platform/it87.656/in7_min
/sys/devices/platform/it87.656/in8_input
/sys/devices/platform/it87.656/in8_label
/sys/devices/platform/it87.656/intrusion0_alarm
/sys/devices/platform/it87.656/modalias
/sys/devices/platform/it87.656/name
/sys/devices/platform/it87.656/power
/sys/devices/platform/it87.656/pwm1
/sys/devices/platform/it87.656/pwm1_auto_channels_temp
/sys/devices/platform/it87.656/pwm1_enable
/sys/devices/platform/it87.656/pwm1_freq
/sys/devices/platform/it87.656/pwm2
/sys/devices/platform/it87.656/pwm2_auto_channels_temp
/sys/devices/platform/it87.656/pwm2_enable
/sys/devices/platform/it87.656/pwm2_freq
/sys/devices/platform/it87.656/pwm3
/sys/devices/platform/it87.656/pwm3_auto_channels_temp
/sys/devices/platform/it87.656/pwm3_enable
/sys/devices/platform/it87.656/pwm3_freq
/sys/devices/platform/it87.656/subsystem
/sys/devices/platform/it87.656/temp1_alarm
/sys/devices/platform/it87.656/temp1_input
/sys/devices/platform/it87.656/temp1_max
/sys/devices/platform/it87.656/temp1_min
/sys/devices/platform/it87.656/temp1_offset
/sys/devices/platform/it87.656/temp1_type
/sys/devices/platform/it87.656/temp2_alarm
/sys/devices/platform/it87.656/temp2_input
/sys/devices/platform/it87.656/temp2_max
/sys/devices/platform/it87.656/temp2_min
/sys/devices/platform/it87.656/temp2_offset
/sys/devices/platform/it87.656/temp2_type
/sys/devices/platform/it87.656/temp3_alarm
/sys/devices/platform/it87.656/temp3_input
/sys/devices/platform/it87.656/temp3_max
/sys/devices/platform/it87.656/temp3_min
/sys/devices/platform/it87.656/temp3_offset
/sys/devices/platform/it87.656/temp3_type
/sys/devices/platform/it87.656/uevent
/sys/class/gpio/export
/sys/class/gpio/gpiochip16
/sys/class/gpio/gpiochip195
/sys/class/gpio/unexport
Check that the AHCI LED module was able to "hook" in:
$ cat /sys/class/n5550_ahci_leds/enabled
1
If you get the 1
, then the disk activity LEDs should be working.
You can also check that you can export the GPIO used to reset the front-panel LCD:
# ls /sys/class/gpio
export gpiochip16 gpiochip195 unexport
# echo 31 > /sys/class/gpio/export
# ls /sys/class/gpio
export gpio31 gpiochip16 gpiochip195 unexport
At this point you should be able to compile and run the freecusd
daemon. You'll first need the libcip
configuration file library from https://github.com/ipilcher/libcip; see the RPM SPEC file at https://github.com/ipilcher/libcip/blob/master/libcip.spec to see how this gets built and installed. Then you can compile the daemon (and its S.M.A.R.T. helper executable) by following the process from the RPM SPEC at https://github.com/ipilcher/n5550/blob/master/n5550.spec.
Ooof! That's a handful. Let me know how it goes. :-)
Thanks so much for this! I will have a go at it this weekend and let you know.
Do I need to copy the modules to a specific path after building? Googling a bit and looking at the Makefile I guess adding
install: make -C /lib/modules/$(KERNEL)/build M=$(PWD) modules_install
then doing a make install
(or just run make -C /lib/modules/$(KERNEL)/build M=$(PWD) modules_install
) should do the trick?
Ok, installed dracut and was able to generate a new initramfs image with it, including n5550 module. However I get the following error regarding a missing gpio_ich module:
` ..... dracut: Including module: n5550 dracut: Including module: shutdown dracut: Including modules done dracut-install: Failed to find module 'gpio_ich'
dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.ZznKcY/initramfs --kerneldir /lib/modules/5.9.0-0.bpo.5-amd64/ -m it87 gpio_ich i2c_i801 leds_gpio leds_pca9532 lpc_ich mfd_core n5550_board n5550_ahci_leds libahci dracut: Installing kernel module dependencies dracut: Installing kernel module dependencies done ..... ` Is that an issue?
Unfortunately, yes. The disk activity LEDs are connected to GPIO lines on the ICH. (It's probably worth reading through the board module source here, as it's role is to tell the kernel how all of the various bits are wired up.)
It's possible that the driver is simply built-in to your kernel. Check the CONFIG_GPIO_ICH
setting in the kernel config. (CentOS puts the kernel configs in /boot
; not sure about Debian.) If you see CONFIG_GPIO_ICH=y
, you're good. If not, you'll either need to rebuild the kernel or build that module. I haven't had to do this, but this looks somewhat promising.
HTH
In config-5.9.0-0.bpo.5-amd64 the only occurrence of that line is # CONFIG_GPIO_ICH is not set
Looks like you'll have to build it.
(If you can get this all working, you should reach out to the OpenMediaVault folks and ask them to include this module in their kernel config.)
Will surely do that. In the mean time I will include the steps in my post about installing OMV on the N5550 if I get it working.
Going to have a look at your link about building the module now.
@ipilcher just to be sure, when I do a lsmod and see
I'm good with those drivers?
Yes. That means that the AHCI drivers are modularized, which is required for the n5550_ahci_leds
module to work. When everything is set up properly, you'll see.
[pilcher@n5550 ~]$ lsmod | grep ahci
ahci 34056 82
n5550_ahci_leds 13222 1
libahci 31992 2 ahci,n5550_ahci_leds
libata 243094 3 ahci,libahci,sata_sil24
And:
[pilcher@n5550 ~]$ cat /sys/class/n5550_ahci_leds/enabled
1
Remember that the LEDs will only be enabled if the n5550_ahci_leds
module is loaded immediately after libahci
(before ahci
and sata_sil24
). And this has to happen in the initramfs, because the kernel needs the AHCI driver to see your root filesystem. This is because n5550_ahci_leds
actually "patches" libata
to blink an LED when a command is sent to one of the disks. (See the n5550_ahci_leds_init
in n5550_ahci_leds.c
.) It's honestly a terrible hack, but it's the only to make it work without having to patch and rebuild the built-in driver.
I was able to compile the gpio-ich module and after also creating the leds_pca9532 module and removing mfd_core
from /usr/lib/dracut/dracut.conf.d/n5550.conf
(it's included in the kernel) dracut now succesfully made a initramfs-5.9.0-0.bpo.5-amd64.img
. But this distro works with initrd and still loads initrd.img-5.9.0-0.bpo.5-amd64
on boot (grub).
Seems like we're getting closer now :-)
root@N5550-OMV:~# lsmod | grep ahci
ahci 40960 16
n5550_ahci_leds 16384 1
libahci 45056 2 ahci,n5550_ahci_leds
libata 286720 3 libahci,ahci,sata_sil24
root@N5550-OMV:~# cat /sys/class/n5550_ahci_leds/enabled
1
Unfortunately no disk led activity yet
Sorry Ian, I changed my message while you were replying to it ...
What does dmesg | grep ich
say?
hmm
root@N5550-OMV:~# dmesg | grep ich
[ 3.644287] lpc_ich: Resource conflict(s) found affecting gpio_ich
OK, I suspect that this is an ACPI resource conflict. Try adding acpi_enforce_resources=lax
to your kernel command line.
The other warnings support that I think:
[ 3.281274] clocksource: Switched to clocksource tsc
[ 3.644223] ACPI Warning: SystemIO range 0x0000000000000428-0x000000000000042F conflicts with OpRegion 0x0000000000000400-0x000000000000047F (\PMIO) (20200717/utaddress-213)
[ 3.644241] ACPI Warning: SystemIO range 0x0000000000000428-0x000000000000042F conflicts with OpRegion 0x0000000000000400-0x000000000000042F (\SWC1) (20200717/utaddress-213)
[ 3.644254] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
[ 3.644259] ACPI Warning: SystemIO range 0x0000000000000530-0x000000000000053F conflicts with OpRegion 0x0000000000000500-0x000000000000053F (\GBAS) (20200717/utaddress-213)
[ 3.644270] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
[ 3.644273] ACPI Warning: SystemIO range 0x0000000000000500-0x000000000000052F conflicts with OpRegion 0x0000000000000500-0x000000000000053F (\GBAS) (20200717/utaddress-213)
[ 3.644285] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
[ 3.644287] lpc_ich: Resource conflict(s) found affecting gpio_ich
[ 3.668006] i801_smbus 0000:00:1f.3: SMBus using PCI interrupt
I'll try your suggestion now.
Getting closer, but no led activity yet unfortunately
root@N5550-OMV:~# dmesg | grep ich
[ 3.871810] gpio_ich: loading out-of-tree module taints kernel.
[ 3.871889] gpio_ich: module verification failed: signature and/or required key missing - tainting kernel
[ 3.873296] gpio_ich gpio_ich.2.auto: GPIO from 451 to 511
Also no mention of n5550 in /sys/class/leds/ yet
root@N5550-OMV:~# ls -al /sys/class/leds/
total 0
drwxr-xr-x 2 root root 0 Jan 22 21:33 .
drwxr-xr-x 53 root root 0 Jan 22 21:33 ..
lrwxrwxrwx 1 root root 0 Jan 22 21:33 input2::capslock -> ../../devices/pci0000:00/0000:00:1d.1/usb5/5-2/5-2:1.0/0003:046D:C30E.0001/input/input2/input2::capslock
lrwxrwxrwx 1 root root 0 Jan 22 21:33 input2::numlock -> ../../devices/pci0000:00/0000:00:1d.1/usb5/5-2/5-2:1.0/0003:046D:C30E.0001/input/input2/input2::numlock
lrwxrwxrwx 1 root root 0 Jan 22 21:33 input2::scrolllock -> ../../devices/pci0000:00/0000:00:1d.1/usb5/5-2/5-2:1.0/0003:046D:C30E.0001/input/input2/input2::scrolllock
ps hope you're not getting tired of me yet ;)
ps hope you're not getting tired of me yet ;)
Absolutely not. This is interesting!
Did the n5550_board
module get loaded? It's also required to get the LEDs working (although the timing is not critical).
It looks like you'll need to set the ICH GPIO base when you load it as well (i.e. modprobe n5550_board ich_gpio_base=451
).
(Alternatively, you can use the gpio_ich
module's gpiobase
param to set it to 195.)
I dont see the n5550_board module when I do a lsmod | grep n5550
:
root@N5550-OMV:~# lsmod | grep n5550
n5550_ahci_leds 16384 1
libahci 45056 2 ahci,n5550_ahci_leds
After executing modprobe n5550_board ich_gpio_base=451
it is listed and the bottom 4 green drive leds are now continuously lit.
Looks like the n5550_board module is not loaded upon startup. It is included in the file /usr/lib/modprobe.d/n5550.conf
:
install n5550_board /sbin/modprobe i2c_i801; /sbin/modprobe --ignore-install n5550_board
install libahci /sbin/modprobe --ignore-install libahci; /sbin/modprobe n5550_ahci_leds
install it87 /sbin/modprobe --ignore-install it87 fix_pwm_polarity=1; echo 1 > /sys/devices/platform/it87.656/pwm3_enable; echo 255 > /sys/devices/platform/it87.656/pwm3
remove it87 echo 0 > /sys/devices/platform/it87.656/pwm3_enable; /sbin/modprobe -r --ignore-remove it87
Maybe this is of interest as well
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.875293] leds-gpio leds-gpio: Skipping unavailable LED gpio 195 (n5550:green:disk-act-0)
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.875304] leds-gpio leds-gpio: Skipping unavailable LED gpio 197 (n5550:green:disk-act-1)
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.875310] leds-gpio leds-gpio: Skipping unavailable LED gpio 198 (n5550:green:disk-act-2)
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.875316] leds-gpio leds-gpio: Skipping unavailable LED gpio 199 (n5550:green:disk-act-3)
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.875322] leds-gpio leds-gpio: Skipping unavailable LED gpio 200 (n5550:green:disk-act-4)
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.891665] leds-pca953x 0-0064: setting platform data
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.898377] leds-pca953x 0-0062: setting platform data
Jan 22 22:10:25 N5550-OMV kernel: [ 2228.903271] leds-pca953x 0-0062: gpios 16...31
Yeah. That file tells modprobe what to do when it loads a module, but it doesn't actually trigger the load. There's a udev
rule that's supposed to do that, but it looks like that has a dependency on the ICH GPIO number.
So you've got the option of adjusting the GPIO number, or adjusting the rule, or using some other mechanism to load the module. CentOS has systemd-modules-load.service
, which loads modules listed in files in /etc/modules-load.d
and /usr/lib/modules-load.d
. If Debian has that, it's easy to add n5550_board
to /usr/lib/modules-load.d/n5550.conf
.
The "Skipping unavailable LED" messages look like you've still got a GPIO number mismatch. You likely need to reboot and load n5550_board
with ich_gpio_base=451
.
It's working :)
Just like you said I had to add n5550_board
to /usr/lib/modules-load.d/n5550.conf
and created a file /etc/modprobe.d/n5550.conf
with one line options n5550_board ich_gpio_base=451
.
Great!
Awesome!
Now that you've got it working, you'll want to give some thought to how it it will survive kernel upgrades. The most popular approach to rebuilding modules for every kernel is DKMS, but it has the disadvantage of requiring that the initrd/initramfs be built twice for every kernel installation, which is quite slow on the N5550's Atom CPU.
That's why I took the approach of using a dracut module, which rebuilds the modules at the time that the initrd is built. Google says that Debian uses dracut, so I suspect that you should be able to do the same if you want.
You'll also want to build & run the daemon as well, of course.
Have fun!
Thanks again for your help yesterday, much appreciated! Have learned a lot regarding modules, compiling, etc.
Going to see if I can get the lcd to work as well. Have been fiddling with it a bit, but haven't been able to get past compiling libcip and creating a rpm so far. Will try some more later on when I have some more time.
Have a good weekend!
I've been trying to get the LEDs working on OpenMediaVault (kernel 5.10.0-0.bpo.5-amd64) following this issue. I've already applied the patch for newer kernels, and managed to make
the modules. I built and loaded the gpio-ich
module, and copied the various configuration files in their places.
However I'm having a problem while trying to build the image using dracut:
dracut: Executing: /usr/bin/dracut --force
[...]
dracut: *** Including module: fs-lib ***
dracut: *** Including module: n5550 ***
dracut: installkernel failed in module n5550
Even using --debug
I'm not able to guess what the error could be caused from:
dracut: *** Including module: n5550 ***
/usr/bin/dracut@1456(): [[ '' == yes ]]
/usr/bin/dracut@1462(): module_install n5550
//usr/lib/dracut/dracut-init.sh@675(module_install): echo /usr/lib/dracut/modules.d/99n5550
//usr/lib/dracut/dracut-init.sh@675(module_install): read a b
//usr/lib/dracut/dracut-init.sh@675(module_install): echo /usr/lib/dracut/modules.d/99n5550
/usr/lib/dracut/dracut-init.sh@675(module_install): local _moddir=/usr/lib/dracut/modules.d/99n5550
/usr/lib/dracut/dracut-init.sh@676(module_install): local _ret
/usr/lib/dracut/dracut-init.sh@677(module_install): [[ -d /usr/lib/dracut/modules.d/99n5550 ]]
/usr/lib/dracut/dracut-init.sh@678(module_install): [[ ! -f /usr/lib/dracut/modules.d/99n5550/module-setup.sh ]]
/usr/lib/dracut/dracut-init.sh@679(module_install): [[ -x /usr/lib/dracut/modules.d/99n5550/install ]]
/usr/lib/dracut/dracut-init.sh@680(module_install): return 1
/usr/bin/dracut@1463(): [[ '' != yes ]]
/usr/bin/dracut@1464(): module_installkernel n5550
//usr/lib/dracut/dracut-init.sh@696(module_installkernel): echo /usr/lib/dracut/modules.d/99n5550
//usr/lib/dracut/dracut-init.sh@696(module_installkernel): read a b
//usr/lib/dracut/dracut-init.sh@696(module_installkernel): echo /usr/lib/dracut/modules.d/99n5550
/usr/lib/dracut/dracut-init.sh@696(module_installkernel): local _moddir=/usr/lib/dracut/modules.d/99n5550
/usr/lib/dracut/dracut-init.sh@697(module_installkernel): local _ret
/usr/lib/dracut/dracut-init.sh@698(module_installkernel): [[ -d /usr/lib/dracut/modules.d/99n5550 ]]
/usr/lib/dracut/dracut-init.sh@699(module_installkernel): [[ ! -f /usr/lib/dracut/modules.d/99n5550/module-setup.sh ]]
/usr/lib/dracut/dracut-init.sh@700(module_installkernel): [[ -x /usr/lib/dracut/modules.d/99n5550/installkernel ]]
/usr/lib/dracut/dracut-init.sh@701(module_installkernel): return 1
/usr/bin/dracut@1465(): dfatal 'installkernel failed in module n5550'
/usr/lib/dracut/dracut-logger.sh@438(dfatal): set +x
dracut: installkernel failed in module n5550
/usr/bin/dracut@1466(): exit 1
/usr/bin/dracut@2(): ret=1
/usr/bin/dracut@3(): [[ -n '' ]]
/usr/bin/dracut@3(): [[ -n /var/tmp/dracut.fMnUMo ]]
/usr/bin/dracut@3(): rm -rf -- /var/tmp/dracut.fMnUMo
/usr/bin/dracut@4(): exit 1
Do you have any suggestion? Thanks in advance!
@marc0777
First, I want to apologize for taking so long to respond to this. The past couple of weeks have been absolutely crazy for me, but I'm finally able to poke my head above water, so ...
I'm not 100% sure, but I think that the important errors are:
/usr/lib/dracut/dracut-init.sh@679(module_install): [[ -x /usr/lib/dracut/modules.d/99n5550/install ]]
/usr/lib/dracut/dracut-init.sh@680(module_install): return 1
And:
/usr/lib/dracut/dracut-init.sh@700(module_installkernel): [[ -x /usr/lib/dracut/modules.d/99n5550/installkernel ]]
/usr/lib/dracut/dracut-init.sh@701(module_installkernel): return 1
These lines are checking that the module scripts (/usr/lib/dracut/modules.d/99n5550/install
and /usr/lib/dracut/modules.d/99n5550/installkernel
) are executable and apparently failing because they aren't. So it may be a simple matter of running chmod 0755
on each of those scripts.
Let me know if that helps (and sorry about the delay again).
@marc0777 - Were you able to get things working?
Hello, I apologize for not repliying sooner, I have been very busy between university and other reasons.
In the last few months I haven't been where I keep my N5550, and I didn't want to mess with it without having physical access to recover it from any problem.
However I can confirm that those file were indeed not executable: as soon as I'm able I'll try again with the correct permissions applied to those file, and report back.
Thanks very much for your help, and sorry about not updating you sooner.
Hello, I apologize for not repliying sooner, I have been very busy between university and other reasons.
No problem. I understand completely.
In the last few months I haven't been where I keep my N5550, and I didn't want to mess with it without having physical access to recover it from any problem.
Makes sense. You also probably don't have a lot of need for the LEDs & LCD panel right now. :-D
However I can confirm that those file were indeed not executable: as soon as I'm able I'll try again with the correct permissions applied to those file, and report back.
Perfect!
I'm trying to clean up the issues in this repo. Is there any reason that this can't be closed?
Thanks!
no reason at all :) closing!
This opensource NAS software runs great on the N5550, but alas no HDD LED or LCD functionality.
This distribution is based on Debian I believe, and currently runs kernel 5.9.0-0.bpo.5-amd64
I have no idea how to go about getting this to work on OMV, but would love to try if someone could explain or make a little write-up!