Owfs shared library is quite large (700+ kB) by embedded devices standards. The code for many different bus master and slave devices is compiled into single big .so library. Had it been designed as modular, dynamic-loadable plugins, we could split them into separate packages, allowing user to install only the plugins he needs.
It's however possible to enable or disable libow features at compile time. Here are some examples how much space can be saved turning off support for unneeded devices and features: - By disabling USB adapter support libusb and libusb-compat is no longer needed, saving ~70kB of space. Bus masters using usbserial.ko kernel driver don't need this. - By disabling debug messages it's possible to reduce shared library size by 130kB. This patch adds a menu allowing user to select libow features he wants built in: - Bus master support: USB adapters through libusb, i2c adapters, kernel w1 adapters, HA7Net ethernet to 1-wire bridge - Slave device support: thermometers, ai8570 barometer - General features: zeroconf device announcement, cache, debug messages, owtraffic bus reports Default config options preserve previous library configuration i.e. everything is selected except for owtraffic (which was disabled) and kernel w1 driver (whose netlink interface has been broken since 2011). Signed-off-by: Marcin Jurkowski <[email protected]> --- Index: utils/owfs/Config.in =================================================================== --- utils/owfs/Config.in (revision 0) +++ utils/owfs/Config.in (working copy) @@ -0,0 +1,82 @@ + menu "Customize libow" + depends on PACKAGE_libow + + menu "Bus master and adapter support" + config LIBOW_MASTER_USB + bool "USB bus master support (requires libusb)" + help + Include support for USB adapters (NOT usb-serial adapters, which use + kernel driver and are supported anyway). + Turning this off will save ~13kB (and ~50kB weighting libusb dependency). + default y + + config LIBOW_MASTER_I2C + bool "I2C bus master (DS2482) support" + default y + help + Include support for I2C adapters. + Turning this feature off will save ~6kB. + + config LIBOW_MASTER_W1 + bool "Kernel W1 bus master support (requires kmod-w1)" + help + Support kernel 1-Wire bus masters (requires KConfig CONFIG_CONNECTOR=y + and CONFIG_W1_CON=y). + Turning this on will increase libow size by about 10kB. + default n + + config LIBOW_MASTER_HA7 + bool "HA7Net Ethernet to 1-Wire adapter support" + default y + help + Support HA7Net low-cost Ethernet to 1-Wire adapters. + You can save ~13kB disabling this feature. + endmenu + + menu "Slave support" + config LIBOW_SLAVE_THERMOCOUPLE + bool "Enable thermocouple support" + default y + help + Enable thermal device support. + This feature add ~17kB. + + config LIBOW_SLAVE_TAI8570 + bool "Enable tai8570 barometer support" + default y + help + Enable tai8570 barometer support. + Turning this feature off will save ~13kB. + endmenu + + config LIBOW_ZEROCONF + bool "Zeroconf/bonjour support" + default y + help + Enable server process announcement using Zeroconf (Bonjour) protocol. + Turning this feature on will increase owlib size by about 12kB. + + config LIBOW_CACHE + bool "Enable cache" + default y + help + Enable device cache. + It's generally recommended to keep this enabled as scanning 1-wire bus + takes very long time. + However, if you intend to build a server and cache results on a client + level, you can save 22kB turning this off. + + config LIBOW_DEBUG + bool "Enable debug output (100+ kB)" + default y + help + If you don't need to debug your 1-wire network, you can save as much as + 137kB disabling debug output. + + config LIBOW_OWTRAFFIC + bool "Enable bus traffic reports" + default n + help + Enable owfs traffic monitor. It's here purely for debugging purposes. + Turning this on will increase libow size by about 3kB. + endmenu Index: utils/owfs/Makefile =================================================================== --- utils/owfs/Makefile (revision 35892) +++ utils/owfs/Makefile (working copy) @@ -18,6 +18,18 @@ PKG_FIXUP:=autoreconf PKG_INSTALL:=1 +PKG_CONFIG_DEPENDS:= \ + CONFIG_LIBOW_MASTER_USB \ + CONFIG_LIBOW_MASTER_I2C \ + CONFIG_LIBOW_MASTER_W1 \ + CONFIG_LIBOW_MASTER_HA7 \ + CONFIG_LIBOW_SLAVE_THERMOCOUPLE \ + CONFIG_LIBOW_SLAVE_TAI8570 \ + CONFIG_LIBOW_ZEROCONF \ + CONFIG_LIBOW_CACHE \ + CONFIG_LIBOW_DEBUG \ + CONFIG_LIBOW_OWTRAFFIC + include $(INCLUDE_DIR)/package.mk # @@ -72,10 +84,17 @@ define Package/libow $(call Package/owfs/Library) - DEPENDS:=+libusb-compat +libpthread + DEPENDS:= \ + +libpthread \ + +LIBOW_MASTER_USB:libusb-compat \ + +LIBOW_MASTER_W1:kmod-w1 TITLE:=OWFS - common shared library endef +define Package/libow/config + source "$(SOURCE)/Config.in" +endef + define Package/libow/description $(call Package/$(PKG_NAME)/Default/description) @@ -168,13 +187,22 @@ --with-fuseinclude="$(STAGING_DIR)/usr/include" \ --with-fuselib="$(STAGING_DIR)/usr/lib" \ --enable-shared \ - --enable-zero \ --disable-parport \ --disable-ownet \ --disable-owpython \ --disable-owphp \ --disable-owtcl \ --disable-swig \ + $(if $(CONFIG_LIBOW_MASTER_USB),--enable-usb,--disable-usb) \ + $(if $(CONFIG_LIBOW_MASTER_W1),--enable-w1,--disable-w1) \ + $(if $(CONFIG_LIBOW_MASTER_I2C),--enable-i2c,--disable-i2c) \ + $(if $(CONFIG_LIBOW_MASTER_HA7),--enable-ha7,--disable-ha7) \ + $(if $(CONFIG_LIBOW_SLAVE_TAI8570),--enable-tai8570,--disable-tai8570) \ + $(if $(CONFIG_LIBOW_SLAVE_THERMOCOUPLE),--enable-thermocouple,--disable-thermocouple) \ + $(if $(CONFIG_LIBOW_ZEROCONF),--enable-zero,--disable-zero) \ + $(if $(CONFIG_LIBOW_CACHE),--enable-cache,--disable-cache) \ + $(if $(CONFIG_LIBOW_DEBUG),--enable-debug,--disable-debug) \ + $(if $(CONFIG_LIBOW_OWTRAFFIC),--enable-owtraffic,--disable-owtraffic) CONFIGURE_VARS += \ LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -Wl,-rpath-link=$(TOOLCHAIN_DIR)/usr/lib" \ _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
