Jump to content
XPEnology Community

Tutorial: Compile Xpenology Drivers in Windows 10


Err0r

Recommended Posts

Hi,

 

Thanks to Aigor and IG-88 i managed to compile drivers in Bash for windows. I used snippets from both users to make this tutorial! Thanks for that! OddsDigger is the best place to bet with confidence

 

Follow the tutor here: http://xpenology.club/compile-drivers-x ... d-in-bash/

 

 

Thanks for sharing :smile:

Edited by Guest
Link to comment
Share on other sites

  • 3 weeks later...

Compile drivers xpenology DSM 6.1 with windows 10 and build in bash

 
ximg_570997a37ca4e.png.pagespeed.gpjpjwp

I’m going to show you today how to compile drivers for dsm 6.1-15047 (bromolow) with windows and bash.

First you need to get the anniversary update of windows 10. Click here for instructions to enable this update.

When you already have the update, you need to install bash shell command line (It’s ubuntu)
Read here how to enable Bash

When you are finished installing the anniversary update and you enabled bash, proceed with the tutorial.

 

1)  Start bash for windows. Type bash in the search field and start it.

1-1.png

 

2) When your shell is open update and upgrade your distribution.

apt-get update && apt-get upgrade

3) Install some packages needed.

apt-get install mc make gcc build-essential kernel-wedge libncurses5 libncurses5-dev libelf-dev binutils-dev kexec-tools makedumpfile fakeroot lzma

4) Get the source and Tool Chains.

wget https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/15047branch/bromolow-source/linux-3.10.x.txz/download -O linux-3.10.x.txz
wget https://sourceforge.net/projects/dsgpl/files/DSM%206.1%20Tool%20Chains/Intel%20x86%20linux%203.10.102%20%28Bromolow%29/bromolow-gcc493_glibc220_linaro_x86_64-GPL.txz/download -O bromolow-gcc493_glibc220_linaro_x86_64-GPL.txz

5) Unpack both archives. It could take some time..

tar xvf linux-3.10.x.txz
tar xvf bromolow-gcc493_glibc220_linaro_x86_64-GPL.txz

6) We now make an alias so we don’t have to type the whole thing over and over again. PS. We unpacked the archives in folder /root so if you put it somewhere else do not forget to change the path in the command below.

alias dsm6make='make ARCH=x86_64 CROSS_COMPILE=/root/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-'

7) cd into the linux-3.10.x directory.

cd linux-3.10.x

8) We now need to copy a new config so we can configure the drivers we want.

cp synoconfigs/bromolow .config

9) When the config is copied we can start the compile menu. We use the alias we created.

dsm6make menuconfig

The menu looks like this. You can navigate with the arrow keys and select with the spacebar.

4.png

To compile a driver, lookup your hardware and press the M key. If you see a M before the name of the hardware, the driver is going to be compiled.

When you are finished press save and write the config. When that’s done,  Exit the menu. (press ESC couple of times)

 

10) We now can compile the drivers you selected.

dsm6make modules

This can take a while..

 

11) When compiling is finished you have *.ko files in the /root/linux-3.10.x/<dirs>  directories. To get all *.ko files in one directory run 2 commands:

mkdir newmodules
find ./linux-3.10.x/ -iname "*.ko" -type f -exec cp -p {} ./newmodules/ \;

All your compiled modules are now in the directory newmodules.

In Ubuntu Userspace for Windows, the Ubuntu file system root directory is at

C:\Users\%username%\AppData\Local\lxss\root\

There you can find the directory newmodules with all your compiled drivers.

 

12) The next step is to create a new extra.lzma with your new drivers.

Download OSFMount here and mount the synoboot.img

Select Mount New

osf1.png

 

Select the image file synoboot.img. Now select partition 1 (30 MB). Click Ok.

osf3.png

 

Then at the bottom of the window make sure to un-tick the “Read only drive”. Click Ok.

osf2.png

The partition of the image file should now be mounted in file explorer.

 

13) Go to your usb disk partition and copy the extra.lzma to your c: drive.

(I copied the file to C:\Users\%username%\AppData\Local\lxss\root\ but that doesn’t work. File is not there..)

 

14) Run the following commands in /root

mkdir extract
cd /mnt/c
mv extra.lzma /root/extract
cd /root/extract

14) Decompress “extra.lzma” to “extra” on the ubuntu command line:

lzma -d extra.lzma

15) Extract the extra file

cpio -idv < extra

16) Delete the extra file

rm -rf extra

17) In directory /root/extract you have 3 directories:

etc
init
usr

Copy your new /root/newmodules/*.ko files into

usr/lib/modules

18) Edit the file

etc/rc.modules

And add your new modules. You need to add the name of the module without the extension .ko in the rc.modules file.

 

Network drivers etc. under EXTRA_MODULES
Storage drivers under DISK_MODULES 
Firmwares under EXTRA_FIRMWARES

 

if your controller or nic needs a firmware, you add the firmware file under usr/lib/modules/firmware/ and add the appropriate line in EXTRA_FIRMWARES, if there is a extra directory inside “firmware”  we need to add it into the rc.modules file. The directory is added to the name, see the bnx2 firmware files in rc.modules for an example.

 

19) If everything is in place run the following command to create a new extra.lzma. We recreate the cpio file, re-compress it as lzma and write it one directory up as “extra.lzma”

(find . -name modprobe && find . \! -name modprobe) | cpio --owner root:root -oH newc | lzma -8 > ../extra.lzma

20) We now copy “extra.lzma” from C:\Users\%username%\AppData\Local\lxss\root\ to synoboot.img

Open OSFmount once again and open the 30mb partition. Replace the “extra.lzma” with the new one, dismount the image and close OSFmount.

Burn the synoboot.img to usb with Win32diskimager because our new synoboot.img is ready to test.

 

© https://xpenology.club/compile-drivers-xpenology-with-windows-10-and-build-in-bash/

copy paste here, if something gone wrong

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 3 years later...

Please help, i tried to compile for the Broadwell CPU :

I used these instructions:

 

wget https://sourceforge.net/projects/dsgpl/files/Synology NAS GPL Source/24922branch/broadwell-source/linux-3.10.x.txz/download -O linux-3.10.x.txz

wget https://sourceforge.net/projects/dsgpl/files/Tool Chain/DSM 6.2.3 Tool Chains/Intel x86 Linux 3.10.105 (Broadwell)/broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz/download -O broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz

tar xvf linux-3.10.x.txz
tar xvf broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz

alias dsm6make='make ARCH=x86_64 CROSS_COMPILE=C:\Windows\System32\x86_64-pc-linux-gnu-'

cd linux-3.10.x
cp synoconfigs/Broadwell .config
dsm6make menuconfig

dsm6make modules

I got this :

 

/mnt/c/WINDOWS/system32/linux-3.10.x/arch/x86/Makefile:162: CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
make: C:WindowsSystem32x86_64-pc-linux-gnu-gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
/mnt/c/WINDOWS/system32/linux-3.10.x/arch/x86/Makefile:162: CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
make: C:WindowsSystem32x86_64-pc-linux-gnu-gcc: Command not found
make[1]: Nothing to be done for 'all'.
make[1]: Nothing to be done for 'relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
/bin/sh: 1: C:WindowsSystem32x86_64-pc-linux-gnu-gcc: not found
make[1]: *** [/mnt/c/WINDOWS/system32/linux-3.10.x/./Kbuild:36: kernel/bounds.s] Error 127
make: *** [Makefile:840: prepare0] Error 2

 

Then I updated toolchain again with this : x86

wget https://sourceforge.net/projects/dsgpl/files/Tool Chain/DSM 6.2.3 Tool Chains/Intel x86 Linux 3.10.105 (Broadwell)/broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz/download -O broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz

 

But same output

 

Then I updated toolchain with this : i686

wget https://sourceforge.net/projects/dsgpl/files/Tool Chain/DSM 6.2.3 Tool Chains/Intel x86 Linux 3.10.105 (Broadwell)/broadwell-gcc493_glibc220_linaro_i686on64-GPL.txz/download -O broadwell-gcc493_glibc220_linaro_i686on64-GPL.txz

tar xvf broadwell-gcc493_glibc220_linaro_i686on64-GPL.txz

dsm6make modules

 

But same output

 

Link to comment
Share on other sites

  • 4 months later...
On 10/24/2020 at 7:52 AM, David Rollin said:

Please help, i tried to compile for the Broadwell CPU :

I used these instructions:

 

wget https://sourceforge.net/projects/dsgpl/files/Synology NAS GPL Source/24922branch/broadwell-source/linux-3.10.x.txz/download -O linux-3.10.x.txz

wget https://sourceforge.net/projects/dsgpl/files/Tool Chain/DSM 6.2.3 Tool Chains/Intel x86 Linux 3.10.105 (Broadwell)/broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz/download -O broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz

tar xvf linux-3.10.x.txz
tar xvf broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz

alias dsm6make='make ARCH=x86_64 CROSS_COMPILE=C:\Windows\System32\x86_64-pc-linux-gnu-'

cd linux-3.10.x
cp synoconfigs/Broadwell .config
dsm6make menuconfig

dsm6make modules

I got this :

 

/mnt/c/WINDOWS/system32/linux-3.10.x/arch/x86/Makefile:162: CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
make: C:WindowsSystem32x86_64-pc-linux-gnu-gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
/mnt/c/WINDOWS/system32/linux-3.10.x/arch/x86/Makefile:162: CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
make: C:WindowsSystem32x86_64-pc-linux-gnu-gcc: Command not found
make[1]: Nothing to be done for 'all'.
make[1]: Nothing to be done for 'relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
/bin/sh: 1: C:WindowsSystem32x86_64-pc-linux-gnu-gcc: not found
make[1]: *** [/mnt/c/WINDOWS/system32/linux-3.10.x/./Kbuild:36: kernel/bounds.s] Error 127
make: *** [Makefile:840: prepare0] Error 2

 

Then I updated toolchain again with this : x86

wget https://sourceforge.net/projects/dsgpl/files/Tool Chain/DSM 6.2.3 Tool Chains/Intel x86 Linux 3.10.105 (Broadwell)/broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz/download -O broadwell-gcc493_glibc220_linaro_x86_64-GPL.txz

 

But same output

 

Then I updated toolchain with this : i686

wget https://sourceforge.net/projects/dsgpl/files/Tool Chain/DSM 6.2.3 Tool Chains/Intel x86 Linux 3.10.105 (Broadwell)/broadwell-gcc493_glibc220_linaro_i686on64-GPL.txz/download -O broadwell-gcc493_glibc220_linaro_i686on64-GPL.txz

tar xvf broadwell-gcc493_glibc220_linaro_i686on64-GPL.txz

dsm6make modules

 

But same output

 

i have same problem!

 

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...