Recommended Posts

Hi to all,

 

This thread is mainly for advanced uses that has tools to compile the kernel. The idea is share here tweaks, tricks and other things to improve the support of the XPEnology.

 

Please, use one post for each topic!

All contributions are welcome!

 

TotalNAS :grin:

Link to post
Share on other sites

#1: Command line boot parameters for set IS_SYNO_USBBOOT_ID_VENDOR & IS_SYNO_USBBOOT_ID_PRODUCT

 

If you like to use the XPEnology on physical hardware with a USB flash drive for booting, you know that this boot drive is mounted and used as a standard USB drive. In the sources of the syno is the code to prevent this and hide the boot drive. The problem is that this code is based on USB VID:PID numbers.

 

Here one definitive solution:

 

The VID:PID values are store in the file "include/linux/syno.h" as values:

 

#define IS_SYNO_USBBOOT_ID_VENDOR(VENDOR) (0x0DD8 == (VENDOR) || 0xD80D == (VENDOR))

#define IS_SYNO_USBBOOT_ID_PRODUCT(PRODUCT) (0x173C == (PRODUCT) || 0x3C17 == (PRODUCT))

 

And these constants are used in the file "/source/linux-XXXXX/drivers/scsi/sd.c". The main function "syno_disk_type_get()" has the code that uses this constants. You can change the values in the header file to target your pendrive and recompile the kernel...

 

OR YOU CAN WRITE NEW CODE IN "/source/linux-XXXXX/drivers/scsi/sd.c" TO OVERRIDE THESE VALUE WITH BOOT VALUES, LIKE FOR EXAMPLE WITH "syno_hw_version".

 

What needs to be modified?

 

  • 1) Add one new value in "/linux-XXXXX/arch/x86/kernel/setup.c" for new VID:PID parameter (like extern char gszSynoHWRevision[]).
    2) Modify the function "static SYNO_DISK_TYPE syno_disk_type_get(struct device *dev)" in "/source/linux-XXXXX/drivers/scsi/sd.c" to use boot values or the constants.
    3) Add the new parameter to your "grub.conf" file with the VID:PID of your flash drive.

 

That's all!

Link to post
Share on other sites

#2: Add "/proc/config.gz" as a module.

 

For future support of XPEnology you can implement a simple way to continue with your work. The main changes in the kernel are "patches" and "config". Related to patches, you can publish them on this forum (or you can create a huge public source repository). Related to the config, you can INCLUDE THIS INFO in your release.

 

Here the instructions:

 

* When you compile a new kernel, the most relevant file is the ".config". This file can be included in the kernel and you can access to it in the "proc" pseudo-filesystem (as "/proc/config.gz"). This ins't set by default in any of the current releases of the XPEnology. But you can include it AS A MODULE. If your release has the module "configs.ko" (not "configfs.ko") you don't waste any memory space in the kernel. But at any time some user can execute the command "insmod /lib/modules/configs.ko" and can obtain the current kernel configuration with the command "zcat /proc/config.gz > ./.config". After that is VERY EASY to compile new kernel modules or continue your work improving new kernels.

 

* You only need to set this values in the kernel config prior to compile it:

 

CONFIG_IKCONFIG=m
CONFIG_IKCONFIG_PROC=y

 

The first value enables the module, the second one inserts the file in the "/proc" directory.

 

* Remember to include the module "configs.ko" in your final release of the firmware! Your don't need to load this module at boot, only do manual loading for show the kernel configuration.

 

Best!

Link to post
Share on other sites

#3: DM-Mirror support for LVM2 physical relocation

 

One of the most limited functionality in the DSM firmware is the lack of RAID/Volume modification tools. For example, after you create one SHR raid volume you can't move/relocate/decrease/etc. disks. Nevertheless, the Linux kernel has functions to relocate LVM extends. Moreover, you can reduce logical volumes using resize2fs and you have the full power to modify your RAID. All tools are included in the firmware (mdadm, lvm, resize2fs, etc.) except the modules to migrate a LVM extend: dm-mirror.ko

 

Here the modules that you need (for DSM 3.2 kernel 3.2.30 x64):

 

  • DM-LOG:
http://pastebin.com/RaVVpqMb
DM-REGION-HASH: http://pastebin.com/Dj1Z69xy
DM-MIRROR: http://pastebin.com/Jc32M86g

 

You only need to load them in this order to enable the PVMOVE command in the LVM tool:

 

$ insmod /lib/modules/dm-log.ko
$ insmod /lib/modules/dm-region-hash.ko
$ insmod /lib/modules/dm-mirror.ko

 

The command is "lvm pvmove", or you can create the symlink with "ln -s lvm /sbin/pvmove"

 

Moreover, if you like to load these modules at boot create a simple script file in "/usr/syno/etc/rc.d/" to load them (for example, "S15LoadModules.sh").

 

With this great tool I administrate all my RAID/LVM volumes without any limitation!

 

:lol:

Link to post
Share on other sites

#4: OHCI support

 

Current releases of the XPEnology lacks OHCI USB support (remember: USB 1.1 hardware has two different driver models, UHCI and OHCI; also all USB 2.0 hosts has two drivers, one for USB 2.0 protocol (EHCI) and one for USB 1.1 (UHCI or OHCI)). This is the reason because in the HP Microserver you lack USB support for low speed devices (like keyboard, mouse, UPS, etc.). The kernel loads the correct EHCI driver, but for USB 1.1 speeds only has the UHCI driver and the system can't comunicate with your devices.

 

Here the solution: Add support for OHCI driver.

You only need to modify the config file in the kernel with:

 

CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD_SSB=y

 

And this will generate the correct "ohci-hcd.ko" module. This module will be automatically loaded at boot, so you only need to copy them to "/lib/modules/".

 

WARNING:

 

After recompiling this module the module "usbcore.ko" is different. If you try to load the "ohci-hcd.ko" in a system with the original "usbcore.ko" module already loaded you receive a kernel fault. You need to replace also the "usbcore.ko" module!!! :eek:

 

FOR MICROSERVER USERS:

 

If you like to complete your USB support in your machine:

 

1) Download the extended package of kernel modules (modules-4.2-02.05.2013.tar.gz ) and copy all of them in the directory "/lib/modules/": https://docs.google.com/file/d/0B5tpWhE ... _web&pli=1

2) Download the new "usbcore.ko" and "ohci-hcd.ko" modules and copy them to "/lib/modules/": http://pastebin.com/sH4RieEj / http://pastebin.com/4vL65THx

3) Reboot and you have full USB support (all ports, USB 1.1 and USB 2.0 speeds)!

 

:grin:

Link to post
Share on other sites

Can somebody explain what to do with the two text files from Pastebin - how do I convert the text back to binary modules?

 

I've replaced my /lib/modules folder with that from the tar file but now I cannot login to DSM so I'm assuming the other modules are required but I can't work out how to encode the files.

Link to post
Share on other sites
Can somebody explain what to do with the two text files from Pastebin - how do I convert the text back to binary modules?

 

I've replaced my /lib/modules folder with that from the tar file but now I cannot login to DSM so I'm assuming the other modules are required but I can't work out how to encode the files.

 

DJBenson (and anyone else who might wonder), the USB driver files on PasteBin are UUEncoded. if you are on linux use uudecode to change them. See the linux man pages for instructions.If you are on windows. Try UUD64Win. It's free and can decode UUEncloded files. I think that it's made my marks-labs (http://www.marks-lab.com/ but best that you google to find it. I am sure there is a mac equivalent but I do not know one offhand.

Link to post
Share on other sites
Can somebody explain what to do with the two text files from Pastebin - how do I convert the text back to binary modules?

 

I've replaced my /lib/modules folder with that from the tar file but now I cannot login to DSM so I'm assuming the other modules are required but I can't work out how to encode the files.

 

DJBenson (and anyone else who might wonder), the USB driver files on PasteBin are UUEncoded. if you are on linux use uudecode to change them. See the linux man pages for instructions.If you are on windows. Try UUD64Win. It's free and can decode UUEncloded files. I think that it's made my marks-labs (http://www.marks-lab.com/ but best that you google to find it. I am sure there is a mac equivalent but I do not know one offhand.

 

Thanks for the reply - I've decoded the files and copied them to my installation but I still can't log in (Synology Finder says "Starting Services" indefinitely)...

Link to post
Share on other sites
Thanks for the reply - I've decoded the files and copied them to my installation but I still can't log in (Synology Finder says "Starting Services" indefinitely)...

Hi,

 

These drivers don't have collateral effects over your installation. Please, check your configuration. If you need to access to repair, you can use an Ubuntu LiveCD. All disks/LVM/RAID partitions will be detected!

 

TN.

Link to post
Share on other sites
#4: OHCI support

 

Here the solution: Add support for OHCI driver.

You only need to modify the config file in the kernel with:

 

CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD_SSB=y

 

After recompiling this module the module "usbcore.ko" is different. If you try to load the "ohci-hcd.ko" in a system with the original "usbcore.ko" module already loaded you receive a kernel fault. You need to replace also the "usbcore.ko" module!!! :eek:

 

Hi,

 

Related to this post, when I insert a USB 3.0 host card, the system generates a kernel panic when the driver xhci is loaded. I feel that the the new "usbcore.ko" can be incompatible with the original one. To other developers: Can you try to enable the ohci driver and test USB 1.1 / 2.0 / 3.0 hardware?

 

Thank you!

Link to post
Share on other sites
#4: OHCI support

 

Thanks totalnas.

 

My UPS APC 350 is now recognised by my N54L.

 

Thanks quicksilver.

 

For the info on how to decode the pastbin files.

Likewise with my APC ES500.

 

Many thanks!

Link to post
Share on other sites
#4: OHCI support

 

Current releases of the XPEnology lacks OHCI USB support (remember: USB 1.1 hardware has two different driver models, UHCI and OHCI; also all USB 2.0 hosts has two drivers, one for USB 2.0 protocol (EHCI) and one for USB 1.1 (UHCI or OHCI)). This is the reason because in the HP Microserver you lack USB support for low speed devices (like keyboard, mouse, UPS, etc.). The kernel loads the correct EHCI driver, but for USB 1.1 speeds only has the UHCI driver and the system can't comunicate with your devices.

 

Here the solution: Add support for OHCI driver.

You only need to modify the config file in the kernel with:

 

CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD_SSB=y

 

And this will generate the correct "ohci-hcd.ko" module. This module will be automatically loaded at boot, so you only need to copy them to "/lib/modules/".

 

WARNING:

 

After recompiling this module the module "usbcore.ko" is different. If you try to load the "ohci-hcd.ko" in a system with the original "usbcore.ko" module already loaded you receive a kernel fault. You need to replace also the "usbcore.ko" module!!! :eek:

 

FOR MICROSERVER USERS:

 

If you like to complete your USB support in your machine:

 

1) Download the extended package of kernel modules (modules-4.2-02.05.2013.tar.gz ) and copy all of them in the directory "/lib/modules/": https://docs.google.com/file/d/0B5tpWhE ... _web&pli=1

2) Download the new "usbcore.ko" and "ohci-hcd.ko" modules and copy them to "/lib/modules/": http://pastebin.com/sH4RieEj / http://pastebin.com/4vL65THx

3) Reboot and you have full USB support (all ports, USB 1.1 and USB 2.0 speeds)!

 

:grin:

 

I want to get my USB external hard drive working with my HP microserver.

 

I have a few questions:

1) do I need to do both steps? Ie add support for OHCI driver and copy across the kernel modules?

2) if so, which file do I need to modify in the kernel and how do you do this?

3) what's the best method for copying across the modules?

 

It would be great if someone could post a step by step guide to doing this?

 

Thanks

Mike

Link to post
Share on other sites

I want to get my USB external hard drive working with my HP microserver.

 

I have a few questions:

1) do I need to do both steps? Ie add support for OHCI driver and copy across the kernel modules?

2) if so, which file do I need to modify in the kernel and how do you do this?

3) what's the best method for copying across the modules?

 

It would be great if someone could post a step by step guide to doing this?

 

Thanks

Mike

Collect all the .ko files mentioned previously.

 

Using something like WinSCP on a PC running windows, copy these over to /lib/modules on your Xpenology box

 

Reboot and you should have the USB drivers loaded.

Link to post
Share on other sites
Thanks for the reply - I've decoded the files and copied them to my installation but I still can't log in (Synology Finder says "Starting Services" indefinitely)...

Hi,

 

These drivers don't have collateral effects over your installation. Please, check your configuration. If you need to access to repair, you can use an Ubuntu LiveCD. All disks/LVM/RAID partitions will be detected!

 

TN.

 

Something went wrong installing these drivers which caused the box to get stuck in a status of "Starting Services" which could not be resolved. Thankfully SSH and SMB services did start up so I was able to access the box and recover my data, had there been no access to these services it would have been a different matter :sad:

 

Does anybody know of a way to force a factory reset outside of the GUI? On a real Synology box you press a reset button, but on XPenology, you need to do it via DSM - but if DSM is unavailable (and you cannot log in) is there a command line method for a factory reset?

Link to post
Share on other sites

1) Download the extended package of kernel modules (modules-4.2-02.05.2013.tar.gz ) and copy all of them in the directory "/lib/modules/": https://docs.google.com/file/d/0B5tpWhE ... _web&pli=1

2) Download the new "usbcore.ko" and "ohci-hcd.ko" modules and copy them to "/lib/modules/": http://pastebin.com/sH4RieEj / http://pastebin.com/4vL65THx

3) Reboot and you have full USB support (all ports, USB 1.1 and USB 2.0 speeds)!

 

For my NAS with the configuration from my signature it worked with the modules from pastebin. Easy and quick.

Still, it was not working at the beginning because of an error. User error that is: The UPS USB cable was not plugged into the NAS :mrgreen:

 

Dear user,
NAS has been connected to UPS.

Sincerely,
Synology DiskStation

 

Thanks for the info mate. We need definitively need more people like you to come with great ideas and hints like this one here!

Link to post
Share on other sites
For reset settings: restore the USB boot device!

It's easy! :grin:

 

TN.

 

Do you mean just overwrite the USB stick with the original image? This didn't work for me, the box still said "Starting Services" inside Synology Assistant so I couldn't do anything with it.

Link to post
Share on other sites
  • 1 month later...
  • 3 weeks later...

I was just wondering if these modifications, specifically number 4, would work on the latest release of DSM (4.2 3211 v1.2) on a HP micro server. I'm guessing this a silly question however I wanted make sure before making any changes.

 

Also thanks to everyone who's contributed in this thread especially totalnas, hopefully I will finally be able to get my UPS detection problem resolved.

Link to post
Share on other sites
I was just wondering if these modifications, specifically number 4, would work on the latest release of DSM (4.2 3211 v1.2) on a HP micro server. I'm guessing this a silly question however I wanted make sure before making any changes.

 

Also thanks to everyone who's contributed in this thread especially totalnas, hopefully I will finally be able to get my UPS detection problem resolved.

Hi Ollie,

 

OHCI USB support is already included in the repack 4.2 v1.2

 

Regards!

Link to post
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.