Hi all, Please find below a proof-of-concept of the mklibs.py reduction integration in OpenWrt. I have not been able to strip the uClibc loader more than 4KB out of 28KB (original size) but it might significantly better results with more softare installed in the rootfs. --- Index: Config.in =================================================================== --- Config.in (revision 16963) +++ Config.in (working copy) @@ -142,6 +142,13 @@ This will install all compiled package binaries into build_dir/target-*/debug-*/, useful for cross-debugging via gdb/gdbserver
+config USE_MKLIBS + bool "Run mklibs.py on the final root filesystem to strip down even more libraries" + default n + help + This will run mklibs.py on the root filesystem and recompile the libraries to remove + unused symbols. + comment "Kernel build options" config KERNEL_KALLSYMS Index: tools/mklibs/Makefile =================================================================== --- tools/mklibs/Makefile (revision 0) +++ tools/mklibs/Makefile (revision 0) @@ -0,0 +1,30 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=mklibs +PKG_VERSION:=0.1.26 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/m/mklibs/ +PKG_MD5SUM:=708f284975f1b567b817d27f7677a95f + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Install + $(INSTALL_BIN) \ + $(HOST_BUILD_DIR)/src/mklibs.py \ + $(HOST_BUILD_DIR)/src/mklibs-copy.py \ + $(HOST_BUILD_DIR)/src/mklibs-readelf/mklibs-readelf \ + $(STAGING_DIR_HOST)/bin/ +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/mklibs* +endef + +$(eval $(call HostBuild)) Index: tools/Makefile =================================================================== --- tools/Makefile (revision 16963) +++ tools/Makefile (working copy) @@ -11,7 +11,7 @@ # subdirectories to descend into tools-y := tools-$(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4) += gmp mpfr -tools-y += m4 autoconf automake bison pkg-config sed +tools-y += m4 autoconf automake bison pkg-config sed mklibs tools-y += sstrip ipkg-utils genext2fs squashfs squashfs4 mtd-utils lzma-old mkimage tools-y += firmware-utils patch-cmdline quilt yaffs2 Index: include/image.mk =================================================================== --- include/image.mk (revision 16963) +++ include/image.mk (working copy) @@ -125,6 +125,20 @@ $(call Image/mkfs/prepare/default) endef +ifeq ($(CONFIG_USE_MKLIBS),y) + define Image/mklibs + # Generate the list of programs + - rm $(KDIR)/mklibs-progs + find $(TARGET_DIR) -type f -perm +100 -exec \ + file -r -N -F '' {} + | \ + awk ' /executable.*dynamically/ { print $$$$1 }' > $(KDIR)/mklibs-progs + ifeq ($(CONFIG_USE_UCLIBC),y) + $(STAGING_DIR_HOST)/bin/mklibs.py -D -L $(STAGING_DIR)/lib -L $(TOOLCHAIN_DIR)/lib --ldlib=$(TOOLCHAIN_DIR)/lib/ld-uClibc.so.0 \ + --target=$(GNU_TARGET_NAME) -d $(TARGET_DIR) `cat $(KDIR)/mklibs-progs` + endif + endef +endif + define BuildImage download: prepare: @@ -137,6 +151,7 @@ ifneq ($(IB),1) install: compile install-targets FORCE + $(call Image/mklibs) $(call Image/Prepare) $(call Image/mkfs/prepare) $(call Image/BuildKernel) -- Best regards, Florian Fainelli Email: flor...@openwrt.org Web: http://openwrt.org IRC: [florian] on irc.freenode.net ------------------------------- _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel