2011-07-05 10:39:30     Excluding default libraries from image?

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-07-05 10:39:30     Excluding default libraries from image?

Gilles Ganault (FRANCE)

Message: 102131   

Hello,

 

Although I made sure no library was checked in the Library Configuration section ("make config_menuconfig"), ./roms/lib contains shared libraries that aren't used by any application (libgfortran.so.3, libgomp.so.1,etc.)

 

Which Makefile adds those libraries, so I can comment this out?

 

Thank you.

QuoteReplyEditDelete

 

 

2011-07-05 12:20:54     Re: Excluding default libraries from image?

Mike Frysinger (UNITED STATES)

Message: 102138   

 

it's added automatically.  use the trim elf config option in the dist, or have your vendor Makefile delete the specific libs you dont want.

QuoteReplyEditDelete

 

 

2011-07-05 14:51:50     Re: Excluding default libraries from image?

Reggy Perrin (UNITED STATES)

Message: 102142   

 

In vendors/AnalogDevices/____/Makefile, I have:

 

 

 

CONFIG_UNNEEDED_LIBS_DEL = y

 

UNNEEDED_LIBS-$(CONFIG_UNNEEDED_LIBS_DEL) = libgfortran.so.1 libgfortran.so.3 libgomp.so.1 libmudflap.so.0 libmudflapth.so.0 libnsl.so.0 libobjc.so.2

#for i in $(/opt/uClinux/bfin-elf/bin/bfin-elf-readelf -d $(find -P ./romfs -perm -001 -type f | \

            grep -v ".sh" | grep -v "./lib/") | grep NEEDED | awk '{print $5}' | sort | uniq | \

            sed -e 's/\[//' -e 's/\]//' ) ; do \

    echo $i; /opt/uClinux/bfin-elf/bin/bfin-elf-readelf -d ./romfs/lib/$i 2>/dev/null | grep NEEDED | awk '{print $5}' | sed -e 's/\[//' -e 's/\]//' ; \

done | sort | uniq

 

romfs.post:: romfs.shared.libs

 

    for f in $(UNNEEDED_LIBS-y); do \

        if [ -f $(ROMFSDIR)/lib/$$f ]; then \

            rm $(ROMFSDIR)/lib/$$f ; \

        fi ; \

    done

 

QuoteReplyEditDelete

 

 

2011-07-05 14:59:03     Re: Excluding default libraries from image?

Mike Frysinger (UNITED STATES)

Message: 102143   

 

in general, that looks fine.

 

your little script there that does find/readelf/etc... is obsoleted by CONFIG_INSTALL_ELF_TRIM_LIBS=y.

QuoteReplyEditDelete

 

 

2011-07-05 15:00:49     Re: Excluding default libraries from image?

Mike Frysinger (UNITED STATES)

Message: 102144   

 

another tip ... you dont need to modify the Makefile.  simply add a Makefile.local in the dir and it'll get sourced automatically.

QuoteReplyEditDelete

 

 

2011-07-06 18:13:02     Re: Excluding default libraries from image?

Gilles Ganault (FRANCE)

Message: 102178   

 

Thanks Mike for the tip on CONFIG_INSTALL_ELF_TRIM_LIBS and Makefile.local.

Attachments

    Outcomes