Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-user:additional-software:saving-space [2018/09/08 19:52] – [Modifying build configuration variables] per | docs:guide-user:additional-software:saving_space [2022/09/24 18:48] (current) – +external links: tiny wiki, runtime memory, yurt bkil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Saving firmware space ====== | + | ====== Saving firmware space and RAM ====== |
| ===== Excluding packages ===== | ===== Excluding packages ===== | ||
| - | Flash space is scarce on devices with only 4MB flash. You can save some space while compiling your own image (e.g. with the [[docs: | + | Flash space is scarce on devices with only 4MB flash. |
| - | In order to completely remove IPv6 support and related packages you also need to ask the imagebuilder to do so by also passing this option to the make command: | + | You can save some space while compiling your own image (e.g. with the [[docs: |
| + | In order to completely remove IPv6 support and related packages you also need to ask the imagebuilder to do so by also passing this option to the make command: | ||
| - | ^ Action | + | ^ Action ^ Packages |
| - | | remove pppoe | + | | remove pppoe | '' |
| - | | remove IPv6 | '' | + | | remove IPv6 | '' |
| - | | remove dhcp server | + | | remove dhcp server | '' |
| - | | remove | + | | remove iptables | '' |
| - | | remove opkg | '' | + | | remove opkg | '' |
| - | | add LuCI minimal | + | | add LuCI minimal | '' |
| - | | add zram | + | | | '' |
| + | | | '' | ||
| + | | add zram | '' | ||
| + | :!: Do not use zram-swap for 4MB flash devices as it // | ||
| + | It is listed here as it is helpful on machines with very little RAM memory. | ||
| - | === Build image for devices with only 4MB flash === | + | :?: The minus '' |
| - | **Example image builder command line**\\ | + | ==== Build image for devices with only 4MB flash ==== |
| - | **Note:** In the command line shown below, you need to adjust '' | + | **Example image builder command line** |
| - | ^ LuCI ^ Action ^ Imagebuilder commandline ^ | + | **Note:** In the command line shown below, you need to adjust |
| - | | with LuCI | - remove pppoe and IPv6\\ + include only needed luci components, not full luci package. | '' | + | Use '' |
| - | | without LuCI | - remove pppoe and IPv6 | '' | + | |
| + | ^ LuCI ^ Action ^ Imagebuilder commandline ^ | ||
| + | | with LuCI | - remove pppoe and IPv6\\ + include only needed luci components, not full luci package. | '' | ||
| + | PACKAGES=" | ||
| + | luci-app-firewall luci-mod-admin-full luci-theme-bootstrap \ | ||
| + | -ppp -ppp-mod-pppoe -ip6tables -odhcp6c \ | ||
| + | -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only"'' | ||
| + | | without LuCI | - remove pppoe and IPv6 | '' | ||
| + | PACKAGES=" | ||
| + | -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only"'' | ||
| Resources: | Resources: | ||
| Line 29: | Line 42: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | * Talk [[https:// | ||
| - | + | ==== Build image for devices with only 16/32MB RAM ==== | |
| - | === Build image for devices with only 16/32MB RAM === | + | |
| If the device has 16MB or less of RAM, then it should only be used as Internal AP (e.g. to extend Wi-Fi coverage).\\ | If the device has 16MB or less of RAM, then it should only be used as Internal AP (e.g. to extend Wi-Fi coverage).\\ | ||
| - | **Example image builder command line**\\ | + | **Example image builder command line** |
| **Note:** In the command line shown below, you need to adjust '' | **Note:** In the command line shown below, you need to adjust '' | ||
| + | Use '' | ||
| - | ^ RAM | + | ^ RAM ^ Action ^ Imagebuilder commandline ^ |
| - | | 16MB | - remove pppoe and IPv6\\ - remove all related elements to iptables\\ - remove dhcp servers \\ + add LUCI\\ + add zram-swap\\ - remove opkg - not needed after making these adjustments | '' | + | | 16MB | - remove pppoe and IPv6\\ - remove all related elements to iptables\\ - remove dhcp servers \\ + add LUCI\\ + add zram-swap\\ - remove opkg - not needed after making these adjustments | '' |
| - | | 32MB | - remove pppoe and IPv6\\ + add LUCI\\ + add zram-swap\\ - remove opkg - not needed after making these adjustments | '' | + | PACKAGES=" |
| + | luci-base luci-app-firewall luci-mod-admin-full | ||
| + | luci-theme-bootstrap zram-swap | ||
| + | -ppp -ppp-mod-pppoe -iptables -ip6tables -odhcp6c -kmod-ipv6 | ||
| + | -kmod-ip6tables | ||
| + | | 32MB | - remove pppoe and IPv6\\ + add LUCI\\ + add zram-swap\\ - remove opkg - not needed after making these adjustments | '' | ||
| + | PACKAGES=" | ||
| + | luci-app-firewall luci-mod-admin-full luci-theme-bootstrap zram-swap | ||
| + | -ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 | ||
| + | -kmod-ip6tables | ||
| Resources: | Resources: | ||
| Line 47: | Line 71: | ||
| * [[https:// | * [[https:// | ||
| - | ===== Modifying build configuration variables | + | ===== Making all kernel modules built-in |
| + | This option compiles the kernel modules inside the kernel, you can either pick what modules you think can be integrated and make them built-in by pressing " | ||
| - | You can also save space by changing configuration variables using '' | + | <code bash> |
| + | sed -i -e " | ||
| + | </ | ||
| - | Options that can be disabled | + | This will work only if your device' |
| - | ^ Config variable | + | This was reported by Daniel Santos in an [[https://lists.infradead.org/pipermail/openwrt-devel/2018-October/014459.html|email to the OpenWrt developer mailing list]], 30 Oct 2018. |
| - | | CONFIG_KERNEL_CRASHLOG | + | |
| - | | CONFIG_KERNEL_SWAP | + | |
| - | | CONFIG_KERNEL_KALLSYMS | + | |
| - | | CONFIG_KERNEL_DEBUG_INFO | Global build settings / Kernel build options / Compile the kernel with debug information | | + | |
| - | | CONFIG_KERNEL_ELF_CORE | + | |
| - | | KERNEL_MAGIC_SYSRQ | + | |
| - | | PACKAGE_MAC80211_DEBUGFS | Kernel modules / Wireless Drivers / kmod-mac80211 | + | |
| - | | PACKAGE_MAC80211_MESH | + | |
| - | Options that can be enabled to save space. | + | His comments: |
| - | ^ Config variable | + | //I did a quick experiment of this and **instead of saving 4k, my *image* is a full 256k smaller**. |
| - | | CONFIG_STRIP_KERNEL_EXPORTS | Global build settings | + | I haven' |
| - | | CONFIG_USE_MKLIBS | + | Further, modules inherently have greater overhead, even after __init sections have been discarded. |
| + | |||
| + | The only downside is that built-ins cannot be unloaded and will always occupy a portion of RAM. | ||
| + | But having them built into the kernel | ||
| + | |||
| + | (The " | ||
| + | See, for example '' | ||
| + | |||
| + | In a follow up mail by Phillip Prindeville pointed out the main drawback of this method. | ||
| + | |||
| + | //Some hardware (it’s rare but not unheard of) can only be reset by unloading and reloading the module that controls it. | ||
| + | Otherwise, you have to reboot the box. | ||
| + | If you build all of your drivers in, then rebooting is all you have.// | ||
| + | |||
| + | ===== Modifying build configuration variables ===== | ||
| + | You can also save space by changing configuration variables using '' | ||
| + | In addition to the ones mentioned here you can save a tiny bit of space by disabling commands in busybox. | ||
| - | Increase block size from the default 256 KB to improve compression. Warning: By default 3 blocks will be cached so this will also make the router use more RAM. | + | ==== Saving space ==== |
| + | ^ Config variable\\ ('' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| - | ^ Config variable ^ Menu path ^ | + | :!: Block size must be a power of 2, between 4096 bytes and 1 Megabyte. By default, 3 blocks will be cached so this will also make the router use more RAM (if 3 blocks are cached, and a block size of 1024 KB is used, this will use 2,304 KB more RAM (3 * 1024 KB - 3 * 256 KB)). It may also make the router use more CPU to decompress the larger blocks. |
| - | | TARGET_SQUASHFS_BLOCK_SIZE | Target Images / squashfs / Block size | | + | |
| - | Options | + | :!: To **build a kernel |
| + | [[https:// | ||
| - | ^ Config variable ^ Menu path ^ | + | ==== Saving RAM ==== |
| - | | PACKAGE_zram-swap | Base system | | + | ^ Config variable\\ ('' |
| - | | PROCD_ZRAM_TMPFS | + | | '' |
| + | | '' | ||
| + | | '' | ||
| - | Reduce the number of cached blocks by running '' | + | ===== Replace LuCI icons with a blank pixel ===== |
| + | The icons in LuCI are not strictly necessary and replacing them with a blank image will save about 15 KB. | ||
| + | This bash script will take an OpenWrt git path as parameter and replace the images with a blank using the [[docs: | ||
| - | ^ Config variable ^ Menu path ^ | + | < |
| - | | CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE | + | <code bash> |
| + | #!/bin/sh | ||
| + | if [ -z " | ||
| + | cd " | ||
| + | gitpath=`pwd` | ||
| + | echo Installing to $gitpath | ||
| + | mkdir -p files/www/luci-static/ | ||
| + | mkdir -p files/ | ||
| + | wget -O files/ | ||
| + | wget -O files/ | ||
| + | cd feeds/ | ||
| + | for a in *.gif; do ln -s blank.gif " | ||
| + | cd ../icons | ||
| + | for a in *.gif; do ln -s ../ | ||
| + | for a in *.png; do ln -s ../ | ||
| + | </ | ||
| + | </ | ||
| + | ======External links====== | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||