Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-06 Thread Hauke Mehrtens
On 01/03/2013 09:17 PM, Hauke Mehrtens wrote:
 On 12/31/2012 05:07 PM, Bastian Bittorf wrote:
 since 2 years we are using zram[0] in our production
 networks and we love it. i like to kick out the package
 compcache which is very outdated and just use the mainline
 implementation. at the moment we are manually go into
 kernel_menuconfig and switch on:

 General setup:
 --- [*] Support for paging of anonymous memory (swap)

 Device Drivers
 --- Staging drivers --- [*] Compressed RAM block device support

 which means:
 CONFIG_FRONTSWAP is not set
 CONFIG_SWAP=y
 CONFIG_HIBERNATION is not set
 CONFIG_MTD_SWAP is not set
 CONFIG_ZRAM=y
 CONFIG_ZRAM_DEBUG is not set
 CONFIG_ZSMALLOC=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y

 also we use our own rc-file, so we can do
 /etc/init.d/zram start|stop

 https://github.com/bittorf/kalua/blob/master/openwrt-addons/etc/init.d/zram

 IMHO it should be a menuconfig-entry in base-system, because it
 is fundamental for all 16mb routers. What i need for baking a Makefile
 is a hint for a package which

 a) activates some symbols in kernel-config
 b) enforces building and loading of a kmodule
 c) has an rc-file

 I'am new to Make, so please help 8-) Also i like to have feedback.
 For the motivation, the output of a WRT54G running 3.6.11:

 root@openwrt:~ free
  total used free   shared  buffers
 Mem: 1300411420 15840  696
 -/+ buffers:  10724 2280
 Swap: 6140  584 5556

 bye, bastian

 [0] https://code.google.com/p/compcache/
 
 Nice work Bastian.
 
 I would not add it as a global option, but as a module, so it could also
 be used by someone not building his own image, but using a prebuild
 image, with kernel 3.6.11 I had a problem building this as a module.
 
 The swap utils e.g. from busybox are also needed, this increases the
 busybox binary by 3.2K uncompressed.
 CONFIG_BUSYBOX_CONFIG_MKSWAP=y
 CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y
 
 Attached is a patch adding zram as a module. The default image without
 zram should be 3.2K bigger (uncompressed) but there are no more
 influences to a image without zram support. Bastian could you test this
 and give feedback?
 
 Hauke
 

This was committed in a modified version hopefully incorporating all the
good comments and the new version of the script in r35025.

Hauke
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-06 Thread Bastian Bittorf
* Hauke Mehrtens ha...@hauke-m.de [06.01.2013 18:34]:
 
 This was committed in a modified version hopefully incorporating all the
 good comments and the new version of the script in r35025.

root@openwrt:~ /etc/init.d/zram 
-ash: /etc/init.d/zram: Permission denied

bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-05 Thread Damian Kaczkowski
On 5 January 2013 10:58, Bastian Bittorf bitt...@bluebottle.com wrote:

 * Damian Kaczkowski damian.kaczkow...@gmail.com [05.01.2013 09:37]:
  mkswap and swapon bins (but not swapoff btw.)). Maybe better would be
 what
  hauke proposed? - just set CONFIG_BUSYBOX_CONFIG_MKSWAP=y,
  CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y as default config. Then also some other
  packages might benefit from this, eg. block-mount

 i dont like the idea to bloat the standard build, this is my proposal:


Me too.


 - build zram as kmodule
 - build user-package zram-swap, which has the deps:
   mkswap + swaponoff + zram-kmodule

 if a user on a standard build does 'opkg install zram-swap' it
 must also install the applets 'busybox-mkswap' and 'busybox-swaponoff'
 so they must be build separately in the standard-build (so the repo's
 gets them)


You can't install applets alone. Its one package busybox with enabled or
disabled functionality.


is there a way the define a global var SWAPUTILS which can point
 busybox-stuff OR gnu-stuff?


There already is a package which has needed tools - PACKAGE_swap-utils
(utilities - disck - swap-utils)


Just use DEPENDS which Stefan proposed. They will do the trick:

  DEPENDS:=+kmod-lib-lzo +kmod-zsmalloc \
+!BUSYBOX_CONFIG_MKSWAP:swap-utils \
+!BUSYBOX_CONFIG_SWAPONOFF:swap-utils

You can manually select busybox applets when building your own image, and
for people using prebuild images (without busybox applets enabled) opkg
will install swap-utils instead.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-05 Thread Bastian Bittorf
* Damian Kaczkowski damian.kaczkow...@gmail.com [05.01.2013 15:37]:
 
 You can't install applets alone. Its one package busybox with enabled or
 disabled functionality.

ofcourse you can package an applet. dont know if the buildsystem can
do that, but it is possible. (but bound to the specific busybox-version)

e.g. http://ipkg.berlin.freifunk.net/packages/busybox-awk_1.0.1_mipsel.ipk

   DEPENDS:=+kmod-lib-lzo +kmod-zsmalloc \
 +!BUSYBOX_CONFIG_MKSWAP:swap-utils \
 +!BUSYBOX_CONFIG_SWAPONOFF:swap-utils
 
 You can manually select busybox applets when building your own image, and
 for people using prebuild images (without busybox applets enabled) opkg
 will install swap-utils instead.

ok, i'am fine with this.

another thing which we must think about: the kernel-symbol

CONFIG_SWAP=y (Support for paging of anonymous memory)

has to be active, i'm not sure of all platform have this.
can somebody check this?

bye, bastian.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-05 Thread Damian Kaczkowski
On 5 January 2013 15:47, Bastian Bittorf bitt...@bluebottle.com wrote:

 * Damian Kaczkowski damian.kaczkow...@gmail.com [05.01.2013 15:37]:
 
  You can't install applets alone. Its one package busybox with enabled
 or
  disabled functionality.

 ofcourse you can package an applet. dont know if the buildsystem can
 do that, but it is possible. (but bound to the specific busybox-version)

 e.g. http://ipkg.berlin.freifunk.net/packages/busybox-awk_1.0.1_mipsel.ipk


Hmm. Thanks for pointers. Do you have makefile for this package? Isn't this
just a standalone busybox with only awk feature enabled?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Jonathan Bither

Hauke,
	I tested this patch today and just wanted to give some feedback. The 
patch applies cleanly and installs everything correctly, however it does 
not activate the swap on boot up. Executing '/etc/init.d/zram start' 
successfully starts. There is also a uci error when starting when the 
'zram_size_mb' is not set.


On 01/03/2013 03:17 PM, Hauke Mehrtens wrote:

On 12/31/2012 05:07 PM, Bastian Bittorf wrote:

since 2 years we are using zram[0] in our production
networks and we love it. i like to kick out the package
compcache which is very outdated and just use the mainline
implementation. at the moment we are manually go into
kernel_menuconfig and switch on:

General setup:
--- [*] Support for paging of anonymous memory (swap)

Device Drivers
--- Staging drivers --- [*] Compressed RAM block device support

which means:
CONFIG_FRONTSWAP is not set
CONFIG_SWAP=y
CONFIG_HIBERNATION is not set
CONFIG_MTD_SWAP is not set
CONFIG_ZRAM=y
CONFIG_ZRAM_DEBUG is not set
CONFIG_ZSMALLOC=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y

also we use our own rc-file, so we can do
/etc/init.d/zram start|stop

https://github.com/bittorf/kalua/blob/master/openwrt-addons/etc/init.d/zram

IMHO it should be a menuconfig-entry in base-system, because it
is fundamental for all 16mb routers. What i need for baking a Makefile
is a hint for a package which

a) activates some symbols in kernel-config
b) enforces building and loading of a kmodule
c) has an rc-file

I'am new to Make, so please help 8-) Also i like to have feedback.
For the motivation, the output of a WRT54G running 3.6.11:

root@openwrt:~ free
  total used free   shared  buffers
Mem: 1300411420 15840  696
-/+ buffers:  10724 2280
Swap: 6140  584 5556

bye, bastian

[0] https://code.google.com/p/compcache/


Nice work Bastian.

I would not add it as a global option, but as a module, so it could also
be used by someone not building his own image, but using a prebuild
image, with kernel 3.6.11 I had a problem building this as a module.

The swap utils e.g. from busybox are also needed, this increases the
busybox binary by 3.2K uncompressed.
CONFIG_BUSYBOX_CONFIG_MKSWAP=y
CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y

Attached is a patch adding zram as a module. The default image without
zram should be 3.2K bigger (uncompressed) but there are no more
influences to a image without zram support. Bastian could you test this
and give feedback?

Hauke



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Bastian Bittorf
* Hauke Mehrtens ha...@hauke-m.de [03.01.2013 21:30]:

 I would not add it as a global option, but as a module, so it could also
 be used by someone not building his own image, but using a prebuild
 image, with kernel 3.6.11 I had a problem building this as a module.
 
 The swap utils e.g. from busybox are also needed, this increases the
 busybox binary by 3.2K uncompressed.
 CONFIG_BUSYBOX_CONFIG_MKSWAP=y
 CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y
 
 Attached is a patch adding zram as a module. The default image without
 zram should be 3.2K bigger (uncompressed) but there are no more
 influences to a image without zram support. Bastian could you test this
 and give feedback?

i compiled it for 2 different platforms (ar7xxx + brcm47xx) and it
mostly works, these are my issues:

- zram initfile is not enabled by default, there is some magic needed
in the Makefile, e.g. '$(INSTALL_BIN) ./files/zram.init $(1)/etc/init.d/zram'
- the minor error during uci calls an unset var is fixed:
https://github.com/bittorf/kalua/blob/master/openwrt-addons/etc/init.d/zram
diff:
https://github.com/bittorf/kalua/commit/078b53388f08cf752b32e4606bf8c60ce7630847
- MKSWAP and SWAPONOFF has to be a dependency, the old package compcache
  does this via

  DEPENDS:=@BUSYBOX_CONFIG_SWAPONOFF @BUSYBOX_CONFIG_MKSWAP

but: gogogo! it's working - we want it 8-)

bye, bastian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Felix Fietkau
On 2013-01-03 9:17 PM, Hauke Mehrtens wrote:
 diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk
 index 2374d19..b3bf6fd 100644
 --- a/package/kernel/modules/other.mk
 +++ b/package/kernel/modules/other.mk
 @@ -729,3 +729,40 @@ define KernelPackage/ikconfig/description
  endef
  
  $(eval $(call KernelPackage,ikconfig))
 +
 +define KernelPackage/zsmalloc
 +  SUBMENU:=$(OTHER_MENU)
 +  TITLE:=ZSMALLOC
 +  DEPENDS:=@!LINUX_3_3
 +  KCONFIG:=CONFIG_ZSMALLOC
 +  FILES:=$(LINUX_DIR)/drivers/staging/zsmalloc/zsmalloc.ko
 +  AUTOLOAD:=$(call AutoLoad,20,zsmalloc)
 +endef
 +
 +define KernelPackage/zsmalloc/description
 + Memory allocator for compressed pages
 +endef
 +
 +$(eval $(call KernelPackage,zsmalloc))
 +
 +define KernelPackage/zram
 +  SUBMENU:=$(OTHER_MENU)
 +  TITLE:=ZRAM
 +  DEPENDS:=+kmod-lib-lzo +kmod-zsmalloc
 +  KCONFIG:= \
 + CONFIG_ZRAM \
 + CONFIG_ZRAM_DEBUG=n
 +  FILES:=$(LINUX_DIR)/drivers/staging/zram/zram.ko
 +  AUTOLOAD:=$(call AutoLoad,25,zram)
 +endef
 +
 +define KernelPackage/zram/description
 + Compressed RAM block device support
 +endef
 +
 +define KernelPackage/zram/install
 + $(INSTALL_DIR) $(1)/etc/init.d
 + $(INSTALL_BIN) ./files/zram $(1)/etc/init.d/zram
 +endef
 +
 +$(eval $(call KernelPackage,zram))
Can you merge these two into one package? I don't think there's anything
else using zsmalloc, so there's no need to add an extra package for it.
The rest looks good to me.

- Felix

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Damian Kaczkowski
Hi.

On 4 January 2013 18:25, Bastian Bittorf bitt...@bluebottle.com wrote:

 - MKSWAP and SWAPONOFF has to be a dependency, the old package compcache
   does this via

   DEPENDS:=@BUSYBOX_CONFIG_SWAPONOFF @BUSYBOX_CONFIG_MKSWAP


I think better dependency would be:

define KernelPackage/zram/config
  select BUSYBOX_CONFIG_MKSWAP if !PACKAGE_swap-utils
  select BUSYBOX_CONFIG_SWAPONOFF if !PACKAGE_swap-utils
endef


btw.
@devs - is there an openwrt DEPENDS:= equivalent for select symbol if
expr ?

Greets.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Damian Kaczkowski
On 4 January 2013 21:52, Damian Kaczkowski damian.kaczkow...@gmail.comwrote:

 On 4 January 2013 18:25, Bastian Bittorf bitt...@bluebottle.com wrote:

 - MKSWAP and SWAPONOFF has to be a dependency, the old package compcache
   does this via

   DEPENDS:=@BUSYBOX_CONFIG_SWAPONOFF @BUSYBOX_CONFIG_MKSWAP


 I think better dependency would be:

 define KernelPackage/zram/config
   select BUSYBOX_CONFIG_MKSWAP if !PACKAGE_swap-utils
   select BUSYBOX_CONFIG_SWAPONOFF if !PACKAGE_swap-utils
 endef



btw. Do we really need dependency for mkswap / swaponoff ? You can use any
fs on zram disk not only swap (also your init script already checks for
mkswap and swapon bins (but not swapoff btw.)). Maybe better would be what
hauke proposed? - just set CONFIG_BUSYBOX_CONFIG_MKSWAP=y,
CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y as default config. Then also some other
packages might benefit from this, eg. block-mount
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Daniel Dickinson

On 13-01-04 04:23 PM, Damian Kaczkowski wrote:

On 4 January 2013 21:52, Damian Kaczkowski damian.kaczkow...@gmail.comwrote:


On 4 January 2013 18:25, Bastian Bittorf bitt...@bluebottle.com wrote:


- MKSWAP and SWAPONOFF has to be a dependency, the old package compcache
   does this via

   DEPENDS:=@BUSYBOX_CONFIG_SWAPONOFF @BUSYBOX_CONFIG_MKSWAP


I think better dependency would be:

define KernelPackage/zram/config
   select BUSYBOX_CONFIG_MKSWAP if !PACKAGE_swap-utils
   select BUSYBOX_CONFIG_SWAPONOFF if !PACKAGE_swap-utils
endef



btw. Do we really need dependency for mkswap / swaponoff ? You can use any
fs on zram disk not only swap (also your init script already checks for
mkswap and swapon bins (but not swapoff btw.)). Maybe better would be what
hauke proposed? - just set CONFIG_BUSYBOX_CONFIG_MKSWAP=y,
CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y as default config. Then also some other
packages might benefit from this, eg. block-mount
Actually swaponoff and mkswap were ditched by default due to size 
(block-mount is an optional package).  Also depends that change busybox 
configuration are considered bad and it was an error to have them before 
(it creates incompatible bb builds depending on what packages are 
built).  Better only have the util-linux dependency (if it's even needed).

--
Daniel Dickinson PowerCloud Systems, Palo Alto, CA Senior Firmware 
Engineer (In Canada: Senior Firmware Analyst)

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Stefan Hellermann
 I think better dependency would be:

 define KernelPackage/zram/config
   select BUSYBOX_CONFIG_MKSWAP if !PACKAGE_swap-utils
   select BUSYBOX_CONFIG_SWAPONOFF if !PACKAGE_swap-utils
 endef


 btw.
 @devs - is there an openwrt DEPENDS:= equivalent for select symbol if
 expr ?


Yes there is:
DEPENDS:=+@!PACKAGE_swap-utils:BUSYBOX_CONFIG_MKSWAP

I tried something like this yesterday and added it to
http://wiki.openwrt.org/doc/devel/dependencies

Cheers,
Stefan
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Damian Kaczkowski
On 4 January 2013 23:46, Stefan Hellermann ste...@the2masters.de wrote:

  I think better dependency would be:
 
  define KernelPackage/zram/config
select BUSYBOX_CONFIG_MKSWAP if !PACKAGE_swap-utils
select BUSYBOX_CONFIG_SWAPONOFF if !PACKAGE_swap-utils
  endef
 
 
  btw.
  @devs - is there an openwrt DEPENDS:= equivalent for select symbol
 if
  expr ?
 

 Yes there is:
 DEPENDS:=+@!PACKAGE_swap-utils:BUSYBOX_CONFIG_MKSWAP


Nice. Thanks for the hint Stefan!


I wanted to use such DEPENDS type instead of define (...)/config block
but unfortunately after converting Kconfig selects to equivalent openwrt
DEPENDS:, eg:

*DEPENDS:=+@!PACKAGE_swap-utils:BUSYBOX_CONFIG_MKSWAP
+@!PACKAGE_swap-utils:BUSYBOX_CONFIG_SWAPONOFF*

I got this in opkg control file:

*Package: kmod-zram
Version: 3.6.11-1
Depends: kernel (=3.6.11-1-479d5850a6a04abbd6713ee6c4ef65ac), kmod-lib-lzo,
kmod-zsmalloc, **BUSYBOX_CONFIG_MKSWAP, **BUSYBOX_CONFIG_SWAPONOFF,
*
This doesn't look good, does it? So I tried to reverse this dependency to
allow people using buildroot to have the possibility to optimize their
builds and be able to select busybox applets instead of swap-utils package,
and also leaving other people using prebuild images the possibility to
install this kmod package through opkg with appropriate dependencies.

Unfortunately with this:

*DEPENDS:=+@!BUSYBOX_CONFIG_MKSWAP:PACKAGE_swap-utils
+@!BUSYBOX_CONFIG_SWAPONOFF:PACKAGE_swap-utils*

I got this in opkg control file:

*Package: kmod-zram
Version: 3.6.11-1
Depends: kernel (=3.6.11-1-479d5850a6a04abbd6713ee6c4ef65ac), kmod-lib-lzo,
kmod-zsmalloc, PACKAGE_swap-utils, PACKAGE_swap-utils
*
Which still doesn't look good.

@devs: Is there any chance for patch to opkg system so it generates proper
Depends: in such situations? I mean swap-utils instead of 
PACKAGE_swap-utils This would be useful I think. What do you think?


btw.
 shouldn't we move init script to some seperate userspace package and put
the dependencies there? zram doesn't need swap-utils ... what if one want
to use it for some other stuff. I know that init script is not much for a
seperate package... but...  is it a good idea to put some init script in
kernel module package?

btw2.
This also doesn't work:

*DEPENDS:=+@!BUSYBOX_CONFIG_MKSWAP:swap-utils
+@!BUSYBOX_CONFIG_SWAPONOFF:swap-utils*
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Stefan Hellermann
 I wanted to use such DEPENDS type instead of define (...)/config block
 but unfortunately after converting Kconfig selects to equivalent openwrt
 DEPENDS:, eg:

 DEPENDS:=+@!PACKAGE_swap-utils:BUSYBOX_CONFIG_MKSWAP
 +@!PACKAGE_swap-utils:BUSYBOX_CONFIG_SWAPONOFF

 I got this in opkg control file:

 Package: kmod-zram
 Version: 3.6.11-1
 Depends: kernel (=3.6.11-1-479d5850a6a04abbd6713ee6c4ef65ac), kmod-lib-lzo,
 kmod-zsmalloc, BUSYBOX_CONFIG_MKSWAP, BUSYBOX_CONFIG_SWAPONOFF,

 This doesn't look good, does it? So I tried to reverse this dependency to
 allow people using buildroot to have the possibility to optimize their
 builds and be able to select busybox applets instead of swap-utils package,
 and also leaving other people using prebuild images the possibility to
 install this kmod package through opkg with appropriate dependencies.

 Unfortunately with this:

 DEPENDS:=+@!BUSYBOX_CONFIG_MKSWAP:PACKAGE_swap-utils
 +@!BUSYBOX_CONFIG_SWAPONOFF:PACKAGE_swap-utils

 I got this in opkg control file:

 Package: kmod-zram
 Version: 3.6.11-1
 Depends: kernel (=3.6.11-1-479d5850a6a04abbd6713ee6c4ef65ac), kmod-lib-lzo,
 kmod-zsmalloc, PACKAGE_swap-utils, PACKAGE_swap-utils

 Which still doesn't look good.

 @devs: Is there any chance for patch to opkg system so it generates proper
 Depends: in such situations? I mean swap-utils instead of 
 PACKAGE_swap-utils This would be useful I think. What do you think?

That's easy:
DEPENDS:=+!BUSYBOX_CONFIG_MKSWAP:swap-utils

the @ is only needed if you want to select a symbol. I have never
watched into a opkg control file, otherwise I would have seen that
busybox depends will not work. For compiling you own image it's fine.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Damian Kaczkowski
On 5 January 2013 01:37, Stefan Hellermann ste...@the2masters.de wrote:

 That's easy:
 DEPENDS:=+!BUSYBOX_CONFIG_MKSWAP:swap-utils

 the @ is only needed if you want to select a symbol. I have never
 watched into a opkg control file, otherwise I would have seen that
 busybox depends will not work. For compiling you own image it's fine.



Unfortunately this doesn't work. Menuconfig does not see the symbol
swap-utils which is expected behavior.

* Symbol: PACKAGE_kmod-zram [=n]
  x Prompt: kmod-zram Compressed RAM
block device
  x   Defined at tmp/.config-package.in:7970
  x   Location:
  x - Kernel modules
  x   - Other modules
  x   Selects: swap-utils  PACKAGE_kmod-lib-lzo [=y]  swap-utils 
PACKAGE_kmod-zsmalloc [=n]
*
It won't select PACKAGE_swap-utils if BUSYBOX_CONFIG_MKSWAP is *not* set
(because it tries to select swap-utils symbol which is nonexistent). Thus
leaving package with broken dependencies.


I think this has to be workaround/pached on buildroot first so it allows
DEPENDS like above and generates proper opkg control files in such
situations. Eg:

a) It should strip the PACKAGE_ portion from opkg control file in such
case:

*DEPENDS:=+!BUSYBOX_CONFIG_MKSWAP:PACKAGE_swap-utils*

b) but also It should strip the whole symbol in case it is not a package
symbol, eg:

*DEPENDS:=+!PACKAGE_swap-utils*:*BUSYBOX_CONFIG_MKSWAP
*

Then it should work ok I think.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Damian Kaczkowski
On 5 January 2013 02:36, Damian Kaczkowski damian.kaczkow...@gmail.comwrote:

 I think this has to be workaround/pached on buildroot first so it allows
 DEPENDS like above and generates proper opkg control files in such
 situations. Eg:

 a) It should strip the PACKAGE_ portion from opkg control file in such
 case:

 *DEPENDS:=+!BUSYBOX_CONFIG_MKSWAP:PACKAGE_swap-utils*

 b) but also It should strip the whole symbol in case it is not a package
 symbol, eg:

 *DEPENDS:=+!PACKAGE_swap-utils*:*BUSYBOX_CONFIG_MKSWAP
 *



c) or just append PACKAGE_ to appropriate parts of generated tmp/.
config-package.in file when used such DEPENDS:

*DEPENDS:=+!BUSYBOX_CONFIG_MKSWAP:swap-utils*
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Stefan Hellermann
 On 5 January 2013 01:37, Stefan Hellermann ste...@the2masters.de wrote:

 That's easy:
 DEPENDS:=+!BUSYBOX_CONFIG_MKSWAP:swap-utils


 Unfortunately this doesn't work. Menuconfig does not see the symbol
 swap-utils which is expected behavior.

  Symbol: PACKAGE_kmod-zram [=n]
   x Prompt: kmod-zram Compressed RAM
 block device
   x   Defined at tmp/.config-package.in:7970
   x   Location:
   x - Kernel modules
   x   - Other modules
   x   Selects: swap-utils  PACKAGE_kmod-lib-lzo [=y]  swap-utils 
 PACKAGE_kmod-zsmalloc [=n]

 It won't select PACKAGE_swap-utils if BUSYBOX_CONFIG_MKSWAP is not set
 (because it tries to select swap-utils symbol which is nonexistent). Thus
 leaving package with broken dependencies.


Hmm, here it works! I double checked it!
A package with DEPENDS:= +!BUSYBOX_CONFIG_HOSTNAME:net-tools-hostname

I compiled it with BUSYBOX_CONFIG_HOSTNAME=y and the resulting opkg
does not depend on net-tools-hostname
Then I removed BUSYBOX_CONFIG_HOSTNAME and compiled the package again,
now it depends on net-tools-hostname and it is even build before my
own package.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-04 Thread Stefan Hellermann
 My bad! You are right Stephan. I apologizes. I have overlooked missing @
 in your DEPENDS ... been testing with +@! ... -.- Time to sleep. Sorry all
 and thank you again Stefan.

When doing funky DEPENDS always think of poor opkg which has to
install a package later. It cannot add a applet to busybox...
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2013-01-03 Thread Hauke Mehrtens
On 12/31/2012 05:07 PM, Bastian Bittorf wrote:
 since 2 years we are using zram[0] in our production
 networks and we love it. i like to kick out the package
 compcache which is very outdated and just use the mainline
 implementation. at the moment we are manually go into
 kernel_menuconfig and switch on:
 
 General setup:
 --- [*] Support for paging of anonymous memory (swap)
 
 Device Drivers
 --- Staging drivers --- [*] Compressed RAM block device support
 
 which means:
 CONFIG_FRONTSWAP is not set
 CONFIG_SWAP=y
 CONFIG_HIBERNATION is not set
 CONFIG_MTD_SWAP is not set
 CONFIG_ZRAM=y
 CONFIG_ZRAM_DEBUG is not set
 CONFIG_ZSMALLOC=y
 CONFIG_LZO_COMPRESS=y
 CONFIG_LZO_DECOMPRESS=y
 
 also we use our own rc-file, so we can do
 /etc/init.d/zram start|stop
 
 https://github.com/bittorf/kalua/blob/master/openwrt-addons/etc/init.d/zram
 
 IMHO it should be a menuconfig-entry in base-system, because it
 is fundamental for all 16mb routers. What i need for baking a Makefile
 is a hint for a package which
 
 a) activates some symbols in kernel-config
 b) enforces building and loading of a kmodule
 c) has an rc-file
 
 I'am new to Make, so please help 8-) Also i like to have feedback.
 For the motivation, the output of a WRT54G running 3.6.11:
 
 root@openwrt:~ free
  total used free   shared  buffers
 Mem: 1300411420 15840  696
 -/+ buffers:  10724 2280
 Swap: 6140  584 5556
 
 bye, bastian
 
 [0] https://code.google.com/p/compcache/

Nice work Bastian.

I would not add it as a global option, but as a module, so it could also
be used by someone not building his own image, but using a prebuild
image, with kernel 3.6.11 I had a problem building this as a module.

The swap utils e.g. from busybox are also needed, this increases the
busybox binary by 3.2K uncompressed.
CONFIG_BUSYBOX_CONFIG_MKSWAP=y
CONFIG_BUSYBOX_CONFIG_SWAPONOFF=y

Attached is a patch adding zram as a module. The default image without
zram should be 3.2K bigger (uncompressed) but there are no more
influences to a image without zram support. Bastian could you test this
and give feedback?

Hauke
From 57063b771aebde8b0e1a938c2e2c42b61aeffe1d Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens ha...@hauke-m.de
Date: Thu, 3 Jan 2013 20:54:46 +0100
Subject: [PATCH] zram

---
 package/busybox/config/util-linux/Config.in |4 +-
 package/kernel/files/zram   |  105 +++
 package/kernel/modules/other.mk |   37 ++
 3 files changed, 144 insertions(+), 2 deletions(-)
 create mode 100755 package/kernel/files/zram

diff --git a/package/busybox/config/util-linux/Config.in b/package/busybox/config/util-linux/Config.in
index 14d4777..d60b139 100644
--- a/package/busybox/config/util-linux/Config.in
+++ b/package/busybox/config/util-linux/Config.in
@@ -474,7 +474,7 @@ config BUSYBOX_CONFIG_FEATURE_MDEV_LOAD_FIRMWARE
 
 config BUSYBOX_CONFIG_MKSWAP
 	bool mkswap
-	default n
+	default y
 	help
 	  The mkswap utility is used to configure a file or disk partition as
 	  Linux swap space. This allows Linux to use the entire file or
@@ -652,7 +652,7 @@ config BUSYBOX_CONFIG_SETARCH
 
 config BUSYBOX_CONFIG_SWAPONOFF
 	bool swaponoff
-	default n
+	default y
 	select BUSYBOX_CONFIG_PLATFORM_LINUX
 	help
 	  This option enables both the 'swapon' and the 'swapoff' utilities.
diff --git a/package/kernel/files/zram b/package/kernel/files/zram
new file mode 100755
index 000..04ab693
--- /dev/null
+++ b/package/kernel/files/zram
@@ -0,0 +1,105 @@
+#!/bin/sh /etc/rc.common
+
+START=00
+
+ram_size()
+{
+	local line
+
+	while read line; do case $line in MemTotal:*) set $line; echo $2; break ;; esac; done /proc/meminfo
+}
+
+zram_size()	# in megabytes
+{
+	local zram_size=$( uci get system.@system[0].zram_size_mb )
+	local ram_size=$( ram_size )
+
+	[ -z $zram_size ]  {
+		# e.g. 6mb for 16mb-routers or 61mb for 128mb-routers
+		zram_size=$(( $ram_size / 2048 ))
+	}
+
+	echo $zram_size
+}
+
+zram_applicable()
+{
+	local zram_dev=$1
+
+	grep -sq ^$zram_dev  /proc/swaps  {
+		logger -s -t zram_applicable -p daemon.notice [OK] '$zram_dev' already active
+		return 1
+	}
+
+	[ -e $zram_dev ] || {
+		logger -s -t zram_applicable -p daemon.crit [ERROR] device '$zram_dev' not found
+		return 1
+	}
+
+	which mkswap /dev/null || {
+		logger -s -t zram_applicable -p daemon.err [ERROR] 'mkswap' not installed
+		return 1
+	}
+
+	which swapon /dev/null || {
+		logger -s -t zram_applicable -p daemon.err [ERROR] 'swapon' not installed
+		return 1
+	}
+}
+
+zram_dev()
+{
+	local core=$1
+
+	echo /dev/zram${core:-0}
+}
+
+list_cpu_idx()
+{
+	local line i=0
+
+	while read line; do {
+		case $line in
+			[Pp]rocessor*)
+echo $i
+i=$(( $i + 1 ))
+			;;
+		esac
+	} done /proc/cpuinfo
+}
+
+start()
+{
+	# http://shmilyxbq-compcache.googlecode.com/hg/README
+	# if 1 cpu_core, reinit kmodule with e.g. num_devices=4
+
+	

[OpenWrt-Devel] compcache / ramzswap / zram / frontswap

2012-12-31 Thread Bastian Bittorf
since 2 years we are using zram[0] in our production
networks and we love it. i like to kick out the package
compcache which is very outdated and just use the mainline
implementation. at the moment we are manually go into
kernel_menuconfig and switch on:

General setup:
--- [*] Support for paging of anonymous memory (swap)

Device Drivers
--- Staging drivers --- [*] Compressed RAM block device support

which means:
CONFIG_FRONTSWAP is not set
CONFIG_SWAP=y
CONFIG_HIBERNATION is not set
CONFIG_MTD_SWAP is not set
CONFIG_ZRAM=y
CONFIG_ZRAM_DEBUG is not set
CONFIG_ZSMALLOC=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y

also we use our own rc-file, so we can do
/etc/init.d/zram start|stop

https://github.com/bittorf/kalua/blob/master/openwrt-addons/etc/init.d/zram

IMHO it should be a menuconfig-entry in base-system, because it
is fundamental for all 16mb routers. What i need for baking a Makefile
is a hint for a package which

a) activates some symbols in kernel-config
b) enforces building and loading of a kmodule
c) has an rc-file

I'am new to Make, so please help 8-) Also i like to have feedback.
For the motivation, the output of a WRT54G running 3.6.11:

root@openwrt:~ free
 total used free   shared  buffers
Mem: 1300411420 15840  696
-/+ buffers:  10724 2280
Swap: 6140  584 5556

bye, bastian

[0] https://code.google.com/p/compcache/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel