Jump to content
XPEnology Community

Compile kernel modules for DS-111's DSM?


Mr Dini

Recommended Posts

Hi,

 

Well, I am a newbie here, and it is a bit off, so sorry for that. But I am looking for help with the DSM porting, and I thought this is the best place where I Can ask my questions. :)

 

I have an ARMv5 NAS, and I decided to install the DSM-111's fw on it (6.1.5 extracted from the pat file). It boots up fine, and I Can see the Diskstation login: over serial console. But I have no NIC support. Maybe because the kernel doesn't support my RTL8168 NIC by default?

 

I Could see these errors and informations  in the console about the network:

[   10.950000] ERROR: sflash_probe - Failed to initialize the SFlash.Loading Marvell Ethernet Driver:
[   10.960000]   o Cached descriptors in DRAM
[   10.960000]   o DRAM SW cache-coherency
[   10.970000]   o 2 Giga ports supported
[   10.970000]   o Single RX Queue support - ETH_DEF_RXQ=0
[   10.970000]   o Single TX Queue support - ETH_DEF_TXQ=0
[   10.980000]   o TCP segmentation offload (TSO) supported
[   10.980000]   o Receive checksum offload supported
[   10.990000]   o Transmit checksum offload supported
[   10.990000]   o SKB Recycle supported - (Enabled)
[   11.000000]   o Rx descripors: q0=128
[   11.000000]   o Tx descripors: q0=532
[   11.010000]   o Loading network interface(s):
[   11.010000]     o  register under mv88fx_eth platform
[   11.020000]     o eth0, ifindex = 2, GbE port = 0
[   11.020000]     o eth0, phy chipid = fffffff0, Support WOL = 0
[   11.030000]
[   11.030000] Warning: Giga 1 is Powered Off
cat: can't open '/proc/sys/kernel/syno_skip_vender_mac_interfaces': No such file or directory
[   21.930000] eth0: started
udhcpc (v1.16.1) started
eth0      Link encap:Ethernet  HWaddr <removed>
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:532
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:11

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

Also, I tried to compile the kernel module manually, but as I Could see, the magic numbers are differs.

$ readelf -h ./8192cu.ko 
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          6346960 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         5069
  Section header string table index: 5066

$ readelf -h ./lib/modules/2.6.32.12/kernel/net/netfilter/nf_conntrack.ko 
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            ARM
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          37228 (bytes into file)
  Flags:                             0x600, GNU EABI, software FP, VFP
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         265
  Section header string table index: 262

 

The first one is the original one, and the second one is a manually compiled module using the Marvell 6281 6.1 GPL sources. I think it won't work because of the small difference... :\ Or will it?

 

What I am doing wrong?

 

Thanks a lot!

Edited by Mr Dini
Link to comment
Share on other sites

I just had to use a different toolchain. Now I Can compile kernel modules with the same magic number. :)

 

But, I Cannot compile the r8168 module using the provided kernel sources. it says that:

  CC [M]  /home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src/rtl_eeprom.o
In file included from /home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src/rtl_eeprom.c:43:0:
/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src/r8168.h: In function 'eth_hw_addr_random':
/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src/r8168.h:42:9: error: implicit declaration of function 'random_ether_addr' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
scripts/Makefile.build:229: recipe for target '/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src/rtl_eeprom.o' failed
make[3]: *** [/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src/rtl_eeprom.o] Error 1
Makefile:1394: recipe for target '_module_/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src' failed
make[2]: *** [_module_/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src] Error 2
make[2]: Leaving directory '/home/kstudio/build/synology/GPL/kernel/linux-2.6.32'
Makefile:105: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/home/kstudio/build/synology/GPL/kernel/r8168-8.045.08/src'
Makefile:40: recipe for target 'modules' failed
make: *** [modules] Error 2

What Can I do?

Edited by Mr Dini
Link to comment
Share on other sites

  • 2 weeks later...

why do you want to compile from external source? the driver you need is already in the kernel, have look at

\linux-2.6.32\drivers\net\r8169.c

 

	u32 RxConfigMask;	/* Clears the bits supported by this chip */
} rtl_chip_info[] = {
	_R("RTL8169",		RTL_GIGA_MAC_VER_01, 0xff7e1880), // 8169
	_R("RTL8169s",		RTL_GIGA_MAC_VER_02, 0xff7e1880), // 8169S
	_R("RTL8110s",		RTL_GIGA_MAC_VER_03, 0xff7e1880), // 8110S
	_R("RTL8169sb/8110sb",	RTL_GIGA_MAC_VER_04, 0xff7e1880), // 8169SB
	_R("RTL8169sc/8110sc",	RTL_GIGA_MAC_VER_05, 0xff7e1880), // 8110SCd
	_R("RTL8169sc/8110sc",	RTL_GIGA_MAC_VER_06, 0xff7e1880), // 8110SCe
	_R("RTL8102e",		RTL_GIGA_MAC_VER_07, 0xff7e1880), // PCI-E
	_R("RTL8102e",		RTL_GIGA_MAC_VER_08, 0xff7e1880), // PCI-E
	_R("RTL8102e",		RTL_GIGA_MAC_VER_09, 0xff7e1880), // PCI-E
	_R("RTL8101e",		RTL_GIGA_MAC_VER_10, 0xff7e1880), // PCI-E
	_R("RTL8168b/8111b",	RTL_GIGA_MAC_VER_11, 0xff7e1880), // PCI-E
	_R("RTL8168b/8111b",	RTL_GIGA_MAC_VER_12, 0xff7e1880), // PCI-E
	_R("RTL8101e",		RTL_GIGA_MAC_VER_13, 0xff7e1880), // PCI-E 8139
	_R("RTL8100e",		RTL_GIGA_MAC_VER_14, 0xff7e1880), // PCI-E 8139
	_R("RTL8100e",		RTL_GIGA_MAC_VER_15, 0xff7e1880), // PCI-E 8139
	_R("RTL8168b/8111b",	RTL_GIGA_MAC_VER_17, 0xff7e1880), // PCI-E
	_R("RTL8101e",		RTL_GIGA_MAC_VER_16, 0xff7e1880), // PCI-E
	_R("RTL8168cp/8111cp",	RTL_GIGA_MAC_VER_18, 0xff7e1880), // PCI-E
	_R("RTL8168c/8111c",	RTL_GIGA_MAC_VER_19, 0xff7e1880), // PCI-E
	_R("RTL8168c/8111c",	RTL_GIGA_MAC_VER_20, 0xff7e1880), // PCI-E
	_R("RTL8168c/8111c",	RTL_GIGA_MAC_VER_21, 0xff7e1880), // PCI-E
	_R("RTL8168c/8111c",	RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E
	_R("RTL8168cp/8111cp",	RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E
	_R("RTL8168cp/8111cp",	RTL_GIGA_MAC_VER_24, 0xff7e1880), // PCI-E
	_R("RTL8168d/8111d",	RTL_GIGA_MAC_VER_25, 0xff7e1880), // PCI-E
	_R("RTL8168d/8111d",	RTL_GIGA_MAC_VER_26, 0xff7e1880), // PCI-E
	_R("RTL8168dp/8111dp",	RTL_GIGA_MAC_VER_27, 0xff7e1880)  // PCI-E
};
#undef _R

 

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