Compiling Ralink usb-wifi dongle driver -> arm binary 10x larger than x86

Started by jlumme, April 08, 2013, 04:46:48 PM

Previous topic - Next topic

jlumme

This isn't really A13 related issue, but since this is the most active area of these boards, I thought maybe someone might have experience and could help.

I have Buffalo WLI-UC-GNM USB-WiFi module, that uses rt8070 chipset from Ralink.
I can find a driver for this from Ralink website, and I can get it compiled for my PC, and also cross compiled for arm.
However, the resulting binary for ARM is over 10 times larger:


-rw-rw-r--  1 jlumme jlumme  1273210 Apr  8 22:33 rt5370sta.ko
-rw-rw-r--  1 jlumme jlumme 14598288 Apr  8 20:48 rt5370sta.ko.arm


I was thinking maybe for arm it compiles a static package, but at least 'file' doesn't mention it:


jlumme@simppa:/tftpboot$ file rt5370sta.ko
rt5370sta.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=0x8a7cabf032c6456569f87e5e992437edad3ebe29, not stripped
jlumme@simppa:/tftpboot$ file rt5370sta.ko.arm
rt5370sta.ko.arm: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), BuildID[sha1]=0x37b13887272b4525c7e1af28de3a8efeb3840e74, not stripped


The difference is of course that in "normal" version, I use compiler and kernel sources that come with my distro (Ubuntu 12.10), and in arm version, I define crosscompiler from buildroot, and freescales' kernel sources..

Can I somehow see if the driver is being linked statically ? How could I see the flag differences during compilation ?
I saw advice to use make showcommands, but that didn't work with the provided make file

Lioric

> arm-none-gnueabihf-strip -strip-debug rt5370sta.ko.arm

Or whatever cross compiler you are using

Strip all unneeded if you want,  read strip docs


QuoteCan I somehow see if the driver is being linked statically

Linked with what? are there any external libs used by the linker on this module?
Anyway, use readElf or ldd and read the dynamic section to see external dependencies

QuoteHow could I see the flag differences during compilation ?

You have the source right? open make file(s) and look there, CFLAGS CXXFLAGS
Or just read the compilation output, it will print the complete command line used per file (including flags)

JohnS

The size command should help you see the true sizes of the sections inside the files.

John

jlumme

Thanks guys for your help! 8)
Indeed by using strip, the arm binary became only ~710KB in size. Actually smaller than stripped the x86 binary! (~720KB)