Howto compile Loadable Kernel Modules on/for DS212+/DS207+

Questions that don't fit in any category below may go here
Forum rules
Please note the disclaimer before modifying your Synology Product.

Howto compile Loadable Kernel Modules on/for DS212+/DS207+

Postby pz1 » Tue May 29, 2012 2:53 pm

Summary of thread: I learned in this discussion that native compilation of Kernel Modules on DS212+ will not work with the IPKG toolchain.So I did install Ubuntu 10.4 (openSuse gave to many difficulties/problems) in a virtualBox on my PC to do cross-compilation.

My goal: I am trying to compile a driver for a kind of serial USB stick (Aeon Z-Wave S2) on my DS212+. I have described in this post the compilation of the ZWave>Me-system where I need that device.

Due to my lack of knowledge I am stuck. So before digging deeper in the rather complex procedures I have seen, my questions are:

  1. Can I in principle compile a Loadable Kernel Module on the DS212+? Apparently: No
  2. I have installed Toolchain, Synology GPL-sources, but do not know how to relate with Aeon stick sources. If you can help, please skip the first few posts and continue reading at this post further down.

2012-06-14: I have submitted a support request to Synology, to solve some imho serious flaws in Toolchain/GPL-sources
2012-06-20: I received useful feedback from Synology support.
Thank you for your feedback.
We only provide "make oldconfig", therefore there's no libncurses in toolchain.
If you want to do menuconfig, you would need to install libncurses just as building normal kernel source.
Run

# apt-get install libncurses5-dev

Then
make menuconfig
make modules
Hope this could help

The compilation did work now. I have as yet to test on the synology boxes, and complete the descriptions in this thread.
Last edited by pz1 on Sun Jun 24, 2012 9:30 am, edited 10 times in total.
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby pz1 » Thu May 31, 2012 7:16 am

Have all the linux specialists left this forum?
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby CoolRaoul » Thu May 31, 2012 8:38 am

You have to cross compile your modules on a x86 based Linux host.

On Synology site, go to page named 3rd Party Apps Integration

There you'll find a link to download:
Synology DiskStation 3rd-Party Apps Integration Guide

On page 11: "Compile Kernel Modules"

(you will need the toolchain for your target platform)
CR
CoolRaoul
Versed
Versed
 
Posts: 216
Joined: Tue May 18, 2010 7:08 pm

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby pz1 » Thu May 31, 2012 1:40 pm

CoolRaoul wrote:You have to cross compile your modules on a x86 based Linux host.

On Synology site, go to page named 3rd Party Apps Integration

There you'll find a link to download:
Synology DiskStation 3rd-Party Apps Integration Guide

On page 11: "Compile Kernel Modules"

(you will need the toolchain for your target platform)

Thanks, I was aware of this information, but for this I need to have a separate machine or virtual machine manager. That complicates things. (I am in the process of describing in detail the installation of a Home Automation client on Synology, which should be reproducible by other users. See viewtopic.php?f=27&t=51823)

Using IPKG I have installed the Toolchain for my DS212+, so I would expect I could compile kernel modules for USB on that same machine. Why wouldn't that work?
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby CoolRaoul » Thu May 31, 2012 1:52 pm

pz1 wrote:Using IPKG I have installed the Toolchain for my DS212+, so I would expect I could compile kernel modules for USB on that same machine. Why wouldn't that work?



The toolchain provided by Synology uses X86 binaries ant targets X86 based Linux hosts exclusively

I don't know what you have been able to install "Using IPKG" but I'm pretty sure it is not the correct one (where did you get that IPKG package, and inside which tutorial/FAQ have you found the information to install it?)
CR
CoolRaoul
Versed
Versed
 
Posts: 216
Joined: Tue May 18, 2010 7:08 pm

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby pz1 » Thu May 31, 2012 2:22 pm

CoolRaoul wrote:I don't know what you have been able to install "Using IPKG" but I'm pretty sure it is not the correct one (where did you get that IPKG package, and inside which tutorial/FAQ have you found the information to install it?)

I did use the instructions from the Synology WIKI http://forum.synology.com/wiki/index.ph ... ,_ipkg_etc (for mv6282 ARM models)
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby CoolRaoul » Thu May 31, 2012 2:36 pm

pz1 wrote:I did use the instructions from the Synology WIKI http://forum.synology.com/wiki/index.ph ... ,_ipkg_etc (for mv6282 ARM models)


Even if the title of the paragraph is "Toolchain", the text of the paragraph explain how to install "optware-devel" package which is used to compile *user mode* optware applications.

The toolchains I've given the download links are official Synology downloads. To compile kernel modules you have to use the one which targets your hardware platform inside a cross-compiling environment.

And the last sentence:
If you do want to create your own ipkg packages, these need to be created using cross-compilation. See http://www.nslu2-linux.org/wiki/Optware ... eToOptware

even if it not explicitly specified, applies also to kernel modules
CR
CoolRaoul
Versed
Versed
 
Posts: 216
Joined: Tue May 18, 2010 7:08 pm

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby Teerling » Fri Jun 01, 2012 8:58 am

I tend to disagree with the previous post. If you look at the _second_part_ of this page http://pcloadletter.co.uk/tag/cross-compile/ which says:
ARM native compile on Synology NAS hardware (you will need to have bootstrapped your NAS and have the development tools installed)

It suggests that you can natively compile other sources than optware module, provided you have the necessary tools installed. That is what pz1 has done. The question that remains is whether it is possible and safe to do so with kernel modules.
Teerling
I'm New!
I'm New!
 
Posts: 2
Joined: Tue May 29, 2012 8:26 pm
Location: Sint-Niklaas, Belgium

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby CoolRaoul » Fri Jun 01, 2012 9:17 am

Teerling wrote:I tend to disagree with the previous post. If you look at the _second_part_ of this page http://pcloadletter.co.uk/tag/cross-compile/ which says:
ARM native compile on Synology NAS hardware (you will need to have bootstrapped your NAS and have the development tools installed)

It suggests that you can natively compile other sources than optware module, provided you have the necessary tools installed. That is what pz1 has done. The question that remains is whether it is possible and safe to do so with kernel modules.



In my post, "optware applications" was supposed to bed understood as "applications linked against optware libraries".

Of course optware-devel toolkit is not limited to compile optware packages (and since those are already available in binary form, this would be an unacceptable limitation!): you can compile *any* source as long it is glibc compatible (and even others, providing having installed the required "*-devel" packages)

But the initial question was about *DSM kernel modules* which are totally out of the target of optware developement toolkit.
CR
CoolRaoul
Versed
Versed
 
Posts: 216
Joined: Tue May 18, 2010 7:08 pm

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby pz1 » Fri Jun 01, 2012 9:35 am

CoolRaoul wrote:But the initial question was about *DSM kernel modules* which are totally out of the target of optware developement toolkit.

Thanks, this makes your post clear. I'll continue with cross compiling. (I am following these instructions http://hallard.wikidot.com/synomodules. They do give the pieces that are missing from the Synology document from 2011))
Last edited by pz1 on Sun Jun 03, 2012 2:19 pm, edited 1 time in total.
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands

Re: Can I compile Loadable Kernel Modules on DS212+ ?

Postby pz1 » Sun Jun 03, 2012 2:18 pm

pz1 wrote:I'll continue with cross compiling. (I am following the Synology 3rd-Party Apps Developer Guide and the instructions http://hallard.wikidot.com/synomodules, that adds some missing pieces in the Synology document from 2011

I got stuck with that procedure with my DS212+ for compiling an Aeon Z-stick S2
I did follow your procedure as follows:
  1. First I installed Ubuntu 10.04.4 (2012-2-14) in VirtualBox on my Intel PC with Windows XP. It was installed for first user named aa.
    (I got stuck with OpenSuse at the point where I had to compile oldconfig, where gcc could not be found.)
  2. Within The Gnome Menus select System/Administration/Users and Groups change the account type in Administrator (this version of Ubuntu does not support a root login, which, at least for me, is a real unnecessary pain.)
  3. Start a terminal and use sudo -i to run in root mode. Download Toolchain, and DS212+ sources to the download area
    Code: Select all
    > sudo -i
    > cd /home/aa/Downloads
    > wget http://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/2198branch/synogpl-2198-6281.tbz
    > wget http://sourceforge.net/projects/dsgpl/files/Tool%20Chain/Marvell%2088F6281%20Linux%202.6.24/gcc421_glibc25_88f6281.tar.gz
  4. continues to unpack sources, and copy the corresponding config file
    Code: Select all
    > tar -xvzf gcc421_glibc25_88f6281-GPL.tgz -C /usr/local/
    > tar -xvjf synogpl-2198-6281.tbz -C /usr/local/arm-none-linux-gnueabi/
    > cd /usr/local/arm-none-linux-gnueabi/source/linux-2.6.32
    > cp synoconfigs/88f6281 .config

    In a telnet session on the DS212+ I did:
    Code: Select all
    ds212+> uname -a
    Linux DS212 2.6.32.12 #2228 Thu May 10 02:19:28 CST 2012 armv5tel GNU/Linux
  5. edited the makefile to set:
    Code: Select all
    ARCH=arm
    CROSS_COMPILE=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
  6. Next I issued the command make oldconfig, which resulted in:
    Code: Select all
    root@aa-desktop:/usr/local/arm-none-linux-gnueabi/source/linux-2.6.32# make oldconfig
      HOSTCC  scripts/basic/fixdep
      HOSTCC  scripts/basic/docproc
      HOSTCC  scripts/basic/hash
      HOSTCC  scripts/kconfig/conf.o
    scripts/kconfig/conf.c: In function 'conf_askvalue':
    scripts/kconfig/conf.c:105: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result
    scripts/kconfig/conf.c: In function 'conf_choice':
    scripts/kconfig/conf.c:307: warning: ignoring return value of 'gets', declared with attribute warn_unused_result
      HOSTCC  scripts/kconfig/kxgettext.o
      SHIPPED scripts/kconfig/zconf.tab.c
      SHIPPED scripts/kconfig/lex.zconf.c
      SHIPPED scripts/kconfig/zconf.hash.c
      HOSTCC  scripts/kconfig/zconf.tab.o
      HOSTLD  scripts/kconfig/conf
    scripts/kconfig/conf -o arch/arm/Kconfig
    #
    # configuration written to .config
    #
  7. What must I do about the warnings displayed above?
  8. Next you need to run the command make menuconfig. If you want to do menuconfig, you would need to install once libncurses just as building normal kernel source. Run:
    Code: Select all
    > apt-get install libncurses5-dev


    WARNING: Text needs revision from here onwards

    Code: Select all
    root@aa-desktop:/usr/local/arm-none-linux-gnueabi/source/linux-2.6.32# make menuconfig
     *** Unable to find the ncurses libraries or the
     *** required header files.
     *** 'make menuconfig' requires the ncurses libraries.
     ***
     *** Install ncurses (ncurses-devel) and try again.
     ***
    make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
    make: *** [menuconfig] Error 2

    This is strange, because if have nothing changed to the sources. I would have expected that the ncurces was included. So at this point it does not make sense to take the following steps (make modules, and install modules) mentioned in the Synology 3rd-Party Apps Developer Guide(page 11 top).


  1. I repeated the procedure above for my DS207+ with even more negative results:
    Code: Select all
    ds207+> uname -a
    Linux Synology 2.6.15 #1594 Fri Feb 25 18:57:37 CST 2011 armv5tejl GNU/Linux synology_88f5281_207+
  2. Next
    Code: Select all
    ARCH=arm
    CROSS_COMPILE=/usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-
  3. Code: Select all
    aa@aa-desktop:~$ sudo -i
    [sudo] password for aa:
    root@aa-desktop:~# cd /home/aa/Downloads
    root@aa-desktop:/# wget http://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/1594branch/synogpl-1628-5281.tbz
    root@aa-desktop:/# wget http://sourceforge.net/projects/dsgpl/files/Tool%20Chain/Marvell%2088F5281%20Linux%202.6.15/gcc343_glibc232_88f5281.tar.gz
    root@aa-desktop:/# tar -xvzf gcc343_glibc232_88f5281.tar.gz -C /usr/local/
    root@aa-desktop:/# tar -xvjf synogpl-1628-5281.tbz -C /usr/local/arm-marvell-linux-gnu/
    root@aa-desktop:/# cd /usr/local/arm-marvell-linux-gnu/source/linux-2.6.15
    root@aa-desktop:/usr/local/arm-marvell-linux-gnu/source/linux-2.6.15# cp 88f5281-config .config
    root@aa-desktop:/usr/local/arm-marvell-linux-gnu/source/linux-2.6.15# make oldconfig
  4. The make oldconfig resulted in a very verbose textual output where at the very start I see:
    Code: Select all
    root@aa-desktop:/usr/local/arm-marvell-linux-gnu/source/linux-2.6.15# make oldconfig | more
    scripts/kconfig/conf -o arch/arm/Kconfig
    drivers/md/Kconfig:218:warning: 'select' used by config symbol 'DM_CRYPT' refer to undefined symbol 'CRYPTO_CBC'
  5. The make menuconfig resulted in:
    Code: Select all
    root@aa-desktop:/usr/local/arm-marvell-linux-gnu/source/linux-2.6.15# make menuconfig
    /usr/bin/ld: cannot find -lncurses
    collect2: ld returned 1 exit status
    -e
    >> Unable to find the Ncurses libraries.
    >>
    >> You must install ncurses-devel in order
    >> to use 'make menuconfig'

    make[2]: *** [scripts/lxdialog/ncurses] Error 1
    make[1]: *** [menuconfig] Error 2
    make: *** [menuconfig] Error 2


    At this point I lack the deeper knowledge on how to proceed.
  1. For the Toolchain and Synology sources I have installed 240962 files in 14990 directories in my openSuse machine, just to compile a few files for my Aeon Z-stick. It seems that I have to compile the whole installation? The makefile is huge!
  2. Where do I place the Linux sources of the Aeon stick, and moreover what is the role of the makefile that comes with those sources? There is an older version of a [i]cp210x.c file in directory /usr/local/arm-none-linux-gnueabi/linux-2.6.32/drivers/usb/serial/[/i]

Help appreciated
Last edited by pz1 on Sun Jun 24, 2012 1:56 pm, edited 4 times in total.
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands

Errors in Toolchain/GPL sources

Postby pz1 » Wed Jun 13, 2012 2:02 pm

pz1 wrote:[*]Next I issued the command make menuconfig, which resulted in:
Code: Select all
root@aa-desktop:/usr/local/arm-none-linux-gnueabi/source/linux-2.6.32# make menuconfig
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2


As I strictly followed the instructions from the Synology 3rd-Party Apps Developer Guide I can only assume there is an serious error in the Toolchain/GPL sources distribution from Synology.

There may even be more problems with the distributution. I found also this post from nielsterp:
nielsterp wrote:
At least in my version, you have to make a small modifikation to the Makefile: Line 454 reads:

Code: Select all
config %config: scripts_basic outputmakefile FORCE


For some reason, the compiler doesn't like this construction. Remove the first 'config', so that line 454 reads:

Code: Select all
%config: scripts_basic outputmakefile FORCE


Both of the above issues I found in DS207+ and in DS212+

EDIT: I have submitted a support request for this.
DS-207+ 128MB; DSM 3.1-1594
HDD: WDC WD10EADS-00L5B1 (01.01A01)
LMS 7.7.1 via SSODS4.9.1mod2 (by j-r)
DS212+ 512MB; DSM 4.0-2228
LMS 7.7.2-007 via Synology spk
pz1
Knowledgeable
Knowledgeable
 
Posts: 373
Joined: Fri Oct 19, 2007 9:56 am
Location: Netherlands


Return to General Mods

Who is online

Users browsing this forum: No registered users and 1 guest