[flashrom] flashrom compiled without dependencies

Gianluigi Tiesi sherpya at netfarm.it
Wed Mar 16 02:37:02 CET 2011


On 15/03/2011 22.16, Wop Byte wrote:
> Is there a way to compile flashrom so that it statically includes the
> needed libraries?
>  
> I need to run this on multiple (over 200) machines that runs a
> slim version of linux and they dont have internet access so I can just
> install it.
>  
> If this isnt possible can it be packaged to run as a self extracting file?
>  

copy the last cc command that makefile issues (the one with -o flashrom)
add
-static -lz
at the end, it will complain about statically linking some socket
related stuff but I don't think you need them

you may need also to add -lusb if usb dev is detected.

example, my last command is:


cc  -o flashrom flashrom.o cli_classic.o cli_output.o print.o jedec.o
stm50flw0x0x.o w39.o w29ee011.o sst28sf040.o m29f400bt.o 82802ab.o
m49fl00x.o sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o spi25.o
sharplhf00l04.o udelay.o programmer.o processor_enable.o
chipset_enable.o board_enable.o cbtable.o dmi.o internal.o it87spi.o
it85spi.o ichspi.o sb600spi.o wbsio_spi.o mcp6x_spi.o serprog.o
rayer_spi.o bitbang_spi.o nic3com.o gfxnvidia.o satasii.o ft2232_spi.o
dummyflasher.o drkaiser.o nicrealtek.o nicintel_spi.o ogp_spi.o
buspirate_spi.o satamv.o pcidev.o physmap.o hwaccess.o layout.o serial.o
 -lftdi    -lpci

I add:

-static -lz -lusb

just ignore:
(.text+0x96): warning: Using 'getpwuid' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
serprog.o: In function `serprog_init':
serprog.c:(.text+0x73b): warning: Using 'gethostbyaddr' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
serprog.c:(.text+0x71d): warning: Using 'gethostbyname' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking


strip your binary

Regards

-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/




More information about the flashrom mailing list